### Install SDK dependencies Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@modelcontextprotocol/sdk/README.md Install dependencies from the SDK repo root before running the example server and client. ```bash npm install ``` -------------------------------- ### Quick Start: Install and run Express app Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/express/Readme.md These commands install the Express generator, create a new app in /tmp/foo, install its dependencies, and start the server. The executable's major version matches Express's, and the app is viewable at http://localhost:3000. ```bash npm install -g express-generator@4 ``` ```bash express /tmp/foo && cd /tmp/foo ``` ```bash npm install ``` ```bash npm start ``` -------------------------------- ### Example MCP interaction flow Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/README.md Shows a sample conversation where an AI assistant uses the MCP tools to search, get, and install a component. The install step runs `bunx --bun shadcn@latest add @spectrumui/animateddrawer`. ```text You: "Add the AnimatedDrawer from Spectrum UI to my project" Claude (via MCP): → calls spectrum_ui.search_components("animated drawer") → calls spectrum_ui.get_component("animateddrawer") → calls spectrum_ui.install_component("animateddrawer") runs: bunx --bun shadcn@latest add @spectrumui/animateddrawer → component installed, import ready ✅ ``` -------------------------------- ### Run an example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/express/Readme.md Runs a specific example from the examples directory. ```bash node examples/content-negotiation ``` -------------------------------- ### Usage example for side-channel-list Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel-list/README.md Demonstrates using the side channel: create a channel, check and assert on a key, set a value, get it, and delete it. The example uses assert to verify behavior. ```js const assert = require('assert'); const getSideChannelList = require('side-channel-list'); const channel = getSideChannelList(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install serve-static via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/serve-static/README.md Install the serve-static module using the npm install command. ```sh $ npm install serve-static ``` -------------------------------- ### Install fresh via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/fresh/README.md Install the fresh module using the npm install command. ```bash $ npm install fresh ``` -------------------------------- ### Install on-finished via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/on-finished/README.md Install the on-finished module using the npm install command. ```sh $ npm install on-finished ``` -------------------------------- ### Install pkce-challenge with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/pkce-challenge/README.md Install the package using npm. ```bash npm install pkce-challenge ``` -------------------------------- ### Install call-bind-apply-helpers with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/call-bind-apply-helpers/README.md Install the package using npm. This is the standard installation command for the call-bind-apply-helpers package. ```sh npm install --save call-bind-apply-helpers ``` -------------------------------- ### Install proxy-addr with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/proxy-addr/README.md Install the proxy-addr module from the npm registry. ```sh $ npm install proxy-addr ``` -------------------------------- ### Install Button component Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Installs the shadcn/ui Button component. ```bash npx shadcn@latest add button ``` -------------------------------- ### Install send via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/send/README.md Install the `send` module using the npm install command. This is the standard installation method for Node.js modules from the npm registry. ```bash $ npm install send ``` -------------------------------- ### Usage example for side-channel Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel/README.md Demonstrates how to use the side-channel API: create a channel, check and assert keys, set and get values, and delete keys. The example uses Node.js's assert module and shows that channel.assert throws a TypeError when the key is not present. ```js const assert = require('assert'); const getSideChannel = require('side-channel'); const channel = getSideChannel(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install ee-first with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ee-first/README.md Install the ee-first package using npm. ```sh $ npm install ee-first ``` -------------------------------- ### Basic Hono app with GET route Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/hono/README.md Creates a Hono app, defines a GET route that returns 'Hono!', and exports the app as the default export. This is the minimal setup for a Hono application. ```TypeScript import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hono!')) export default app ``` -------------------------------- ### Install @hono/node-server with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@hono/node-server/README.md Install the adapter from the npm registry using the npm command. ```sh npm install @hono/node-server ``` -------------------------------- ### Run example Streamable HTTP server Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@modelcontextprotocol/sdk/README.md Run the example Streamable HTTP server from the SDK repo root. This server demonstrates tools, resources, prompts, sampling, elicitation, tasks, and logging. ```bash npx tsx src/examples/server/simpleStreamableHttp.ts ``` -------------------------------- ### Usage example for side-channel-weakmap Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel-weakmap/README.md Demonstrates the full API of the side-channel-weakmap module. It shows how to create a channel, check for keys, set and get values, assert key presence, and delete keys. Note that the implementation leaks memory until you delete the key. ```js const assert = require('assert'); const getSideChannelList = require('side-channel-weakmap'); const channel = getSideChannelList(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install get-proto with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/get-proto/README.md Install the get-proto package using npm. Run this command in your project directory. ```sh npm install --save get-proto ``` -------------------------------- ### Install toidentifier with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/toidentifier/README.md Install the toidentifier module from the npm registry using the npm install command. ```bash $ npm install toidentifier ``` -------------------------------- ### Install ip-address with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ip-address/README.md Install the ip-address library using npm. ```sh npm install ip-address ``` -------------------------------- ### Install Pie Chart Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the PieChart component via npx shadcn CLI. ```bash npx shadcn@latest add @spectrumui/pie-chart ``` -------------------------------- ### Usage example for side-channel-map Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel-map/README.md Demonstrates the API: has, assert, set, get, delete. Note that using an object key will leak memory until deleted. ```js const assert = require('assert'); const getSideChannelMap = require('side-channel-map'); const channel = getSideChannelMap(); const key = {}; assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); channel.set(key, 42); channel.assert(key); // does not throw assert.equal(channel.has(key), true); assert.equal(channel.get(key), 42); channel.delete(key); assert.equal(channel.has(key), false); assert.throws(() => channel.assert(key), TypeError); ``` -------------------------------- ### Install depd via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/depd/Readme.md Install the depd module using npm. This is the standard installation command. ```sh $ npm install depd ``` -------------------------------- ### Install @hono/node-server with yarn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@hono/node-server/README.md Alternative installation using the yarn package manager. ```sh yarn add @hono/node-server ``` -------------------------------- ### Install accepts with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/accepts/README.md Install the accepts module via npm. ```sh $ npm install accepts ``` -------------------------------- ### Install vary with npm install Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/vary/README.md Run this command in the terminal to install the vary module via npm. ```sh $ npm install vary ``` -------------------------------- ### Install path-key with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/path-key/readme.md Install the path-key package using npm. ```bash $ npm install path-key ``` -------------------------------- ### Install path-to-regexp via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/path-to-regexp/Readme.md Install the library using npm with the --save flag. ```bash npm install path-to-regexp --save ``` -------------------------------- ### Accept Negotiation example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/negotiator/README.md Shows how to use the Negotiator constructor and mediaTypes/mediaType methods to negotiate media types based on the Accept header. ```js availableMediaTypes = ['text/html', 'text/plain', 'application/json'] // The negotiator constructor receives a request object negotiator = new Negotiator(request) // Let's say Accept header is 'text/html, application/*;q=0.2, image/jpeg;q=0.8' negotiator.mediaTypes() // -> ['text/html', 'image/jpeg', 'application/*'] negotiator.mediaTypes(availableMediaTypes) // -> ['text/html', 'application/json'] negotiator.mediaType(availableMediaTypes) // -> 'text/html' ``` -------------------------------- ### Install etag with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/etag/README.md Install the etag module from the npm registry. ```sh $ npm install etag ``` -------------------------------- ### Install dunder-proto with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/dunder-proto/README.md Install the package using npm. Run this command in your project directory. ```sh npm install --save dunder-proto ``` -------------------------------- ### Install negotiator with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/negotiator/README.md Install the negotiator package using npm. ```sh $ npm install negotiator ``` -------------------------------- ### Install component with shadcn CLI Source: https://github.com/arihantcodes/spectrum-ui/blob/main/README.md Run this command in a project that already has shadcn/ui set up to add the animated drawer component. It uses the shadcn CLI to install the component directly. ```bash npx shadcn@latest add @spectrumui/animated-drawer ``` -------------------------------- ### Test accepts example with cURL Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/accepts/README.md Test the example server with cURL, sending an Accept header for text/html. ```sh curl -I -H'Accept: text/html' http://localhost:3000/ ``` -------------------------------- ### Install require-from-string with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/require-from-string/readme.md Install the package using npm. Run this command in your project directory. ```bash $ npm install --save require-from-string ``` -------------------------------- ### Install type-is with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/type-is/README.md Install the type-is module from the npm registry using the npm install command. ```sh $ npm install type-is ``` -------------------------------- ### Accept-Charset Negotiation example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/negotiator/README.md Shows how to use the Negotiator constructor and charsets/charset methods to negotiate charsets based on the Accept-Charset header. ```js availableCharsets = ['utf-8', 'iso-8859-1', 'iso-8859-5'] negotiator = new Negotiator(request) // Let's say Accept-Charset header is 'utf-8, iso-8859-1;q=0.8, utf-7;q=0.2' negotiator.charsets() // -> ['utf-8', 'iso-8859-1', 'utf-7'] negotiator.charsets(availableCharsets) // -> ['utf-8', 'iso-8859-1'] negotiator.charset(availableCharsets) // -> 'utf-8' ``` -------------------------------- ### Install mime-types with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/mime-types/README.md Install the mime-types module using the npm install command. ```sh $ npm install mime-types ``` -------------------------------- ### Install side-channel-weakmap with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel-weakmap/README.md Install the package using npm. This is the standard installation command for adding the dependency to a project. ```sh npm install --save side-channel-weakmap ``` -------------------------------- ### Install router Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/router/README.md Install the router package using npm. ```bash $ npm install router ``` -------------------------------- ### Install statuses via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/statuses/README.md Install the statuses module using npm. ```sh $ npm install statuses ``` -------------------------------- ### Install Dodo Payments Next.js package Source: https://github.com/arihantcodes/spectrum-ui/blob/main/docs/DODO.md Install the @dodopayments/nextjs package via npm. ```bash npm install @dodopayments/nextjs ``` -------------------------------- ### Install finalhandler via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/finalhandler/README.md Install the finalhandler module using the npm install command. ```sh $ npm install finalhandler ``` -------------------------------- ### Install content-type package Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/type-is/node_modules/content-type/README.md Install the content-type package using npm. ```sh npm install content-type ``` -------------------------------- ### Install side-channel-list via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel-list/README.md Install the package using npm. The command is `npm install --save side-channel-list`. ```sh npm install --save side-channel-list ``` -------------------------------- ### Accept-Language Negotiation example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/negotiator/README.md Shows how to use the Negotiator constructor and languages/language methods to negotiate languages based on the Accept-Language header. ```js negotiator = new Negotiator(request) availableLanguages = ['en', 'es', 'fr'] // Let's say Accept-Language header is 'en;q=0.8, es, pt' negotiator.languages() // -> ['es', 'pt', 'en'] negotiator.languages(availableLanguages) // -> ['es', 'en'] language = negotiator.language(availableLanguages) // -> 'es' ``` -------------------------------- ### Install content-disposition with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/content-disposition/README.md Install the content-disposition package using npm. This is the standard installation command for adding the package to a Node.js project. ```sh $ npm install content-disposition ``` -------------------------------- ### Install json-schema-traverse via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/json-schema-traverse/README.md Install the package using npm. ```bash npm install json-schema-traverse ``` -------------------------------- ### Run tests with npm install and npm test Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/send/README.md Install dependencies and run the test suite for the send package. ```bash $ npm install $ npm test ``` -------------------------------- ### Install raw-body via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/raw-body/README.md Install the raw-body module using npm. ```sh $ npm install raw-body ``` -------------------------------- ### Install shebang-command Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/shebang-command/readme.md Install the package using npm. ```bash $ npm install shebang-command ``` -------------------------------- ### Install media-typer via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/media-typer/README.md Install the media-typer module using npm. ```sh $ npm install media-typer ``` -------------------------------- ### Install Animated Switch component Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Installs the Spectrum UI Animated Switch component via the shadcn CLI. ```bash npx shadcn@latest add @spectrumui/animated-switch ``` -------------------------------- ### Install range-parser Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/range-parser/README.md Install the range-parser module from the npm registry. ```sh $ npm install range-parser ``` -------------------------------- ### API usage example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/fresh/README.md Check freshness using request and response headers. The first example returns false because the ETag does not match, the second returns true when they match. ```javascript var reqHeaders = { 'if-none-match': '"foo"' } var resHeaders = { etag: '"foo"' } fresh(reqHeaders, resHeaders) // => false var reqHeaders = { 'if-none-match': '"foo"' } var resHeaders = { etag: '"foo"' } fresh(reqHeaders, resHeaders) // => true ``` -------------------------------- ### Install Zod with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/zod/README.md Install the zod package using npm. ```sh npm install zod ``` -------------------------------- ### pathToRegexp function example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/path-to-regexp/Readme.md Returns a regexp and keys array for matching paths. The example shows how to use the regexp to extract parameters from a path. ```javascript const { regexp, keys } = pathToRegexp("/foo/:bar"); regexp.exec("/foo/123"); //=> ["/foo/123", "123"] ``` -------------------------------- ### Install object-assign with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/object-assign/readme.md Install the object-assign package using npm. ```bash $ npm install --save object-assign ``` -------------------------------- ### Install parseurl via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/parseurl/README.md Install the parseurl module using npm. This is the standard installation command for the package. ```sh $ npm install parseurl ``` -------------------------------- ### Install cors via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/cors/README.md Install the cors package using the npm install command. ```sh $ npm install cors ``` -------------------------------- ### Install cookie with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/cookie/README.md Install the cookie module from the npm registry using the npm install command. ```sh $ npm install cookie ``` -------------------------------- ### Install OrderBookLadder with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the OrderBookLadder component using the shadcn CLI. Run this command in your project root to add the @spectrumui/order-book block. ```bash npx shadcn@latest add @spectrumui/order-book ``` -------------------------------- ### mime.extension example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/mime-types/README.md Get the default extension for a content-type. ```js mime.extension('application/octet-stream') // 'bin' ``` -------------------------------- ### Example output of pkceChallenge() Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/pkce-challenge/README.md Shows the structure of the returned object with code_verifier and code_challenge properties. ```javascript { code_verifier: 'u1ta-MQ0e7TcpHjgz33M2DcBnOQu~aMGxuiZt0QMD1C', code_challenge: 'CUZX5qE8Wvye6kS_SasIsa8MMxacJftmWdsIA_iKp3I' } ``` -------------------------------- ### Install Accordion component Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Installs the Spectrum UI Accordion component via the shadcn CLI. ```bash npx shadcn@latest add @spectrumui/accordion ``` -------------------------------- ### Run tests with npm and git submodule Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ajv-formats/README.md Install dependencies, initialize git submodules, and run the test suite. ```bash npm install git submodule update --init npm test ``` -------------------------------- ### Install forwarded via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/forwarded/README.md Install the module using npm. Run this command in your project directory. ```sh $ npm install forwarded ``` -------------------------------- ### Install side-channel with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel/README.md Install the side-channel package using npm. This is the standard installation command for adding the package to your project. ```sh npm install --save side-channel ``` -------------------------------- ### Install Express via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/express/Readme.md Command to install the Express module from the npm registry. Run this in a project directory with a package.json file. ```bash npm install express ``` -------------------------------- ### Install cross-spawn v6 for Node.js 7 and under Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/cross-spawn/README.md Installs cross-spawn version 6 for legacy Node.js environments (Node.js 7 and under). ```bash $ npm install cross-spawn@6 ``` -------------------------------- ### Run local development server Source: https://github.com/arihantcodes/spectrum-ui/blob/main/README.md Clone the repository and start the development server. This is only needed if you want to work on the site itself. After running these commands, the site will be available at localhost:3000. ```bash git clone https://github.com/arihantcodes/spectrum-ui.git cd spectrum-ui yarn install yarn dev ``` -------------------------------- ### Install shebang-regex with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/shebang-regex/readme.md Install the shebang-regex package using npm. ```bash $ npm install shebang-regex ``` -------------------------------- ### Install side-channel-map Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/side-channel-map/README.md Install the package via npm. ```sh npm install --save side-channel-map ``` -------------------------------- ### Install mime-db with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/mime-db/README.md Install the mime-db package using npm. This is the standard installation command for adding mime-db as a dependency. ```bash npm install mime-db ``` -------------------------------- ### Use dunder-proto get and set Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/dunder-proto/README.md Example usage showing how to get and set the prototype of an object using the dunder-proto package. It demonstrates that setting the prototype to null removes inherited properties like 'toString'. ```js const assert = require('assert'); const getDunder = require('dunder-proto/get'); const setDunder = require('dunder-proto/set'); const obj = {}; assert.equal('toString' in obj, true); assert.equal(getDunder(obj), Object.prototype); setDunder(obj, null); assert.equal('toString' in obj, false); assert.equal(getDunder(obj), null); ``` -------------------------------- ### Install Radar Chart Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the RadarChart component via npx shadcn CLI. ```bash npx shadcn@latest add @spectrumui/radar-chart ``` -------------------------------- ### Install content-type with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/content-type/README.md Install the content-type package using npm. ```sh $ npm install content-type ``` -------------------------------- ### Quick Start: Create a new Hono project Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/hono/README.md Command to scaffold a new Hono project using npm. Run this in your terminal to initialize a new Hono application. ```bash npm create hono@latest ``` -------------------------------- ### Install Portfolio Chart with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Command to add the @spectrumui/portfolio-chart component to your project. ```bash npx shadcn@latest add @spectrumui/portfolio-chart ``` -------------------------------- ### Usage: shebangCommand() Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/shebang-command/readme.md Require the module and call shebangCommand with a shebang string to get the command. The examples show output for '#!/usr/bin/env node' and '#!/bin/bash'. ```javascript const shebangCommand = require('shebang-command'); shebangCommand('#!/usr/bin/env node'); //=> 'node' shebangCommand('#!/bin/bash'); //=> 'bash' ``` -------------------------------- ### Install Ajv version 8 with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ajv/README.md Install Ajv version 8 using npm. This command installs the latest version of Ajv. ```bash npm install ajv ``` -------------------------------- ### Install encodeurl via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/encodeurl/README.md Install the encodeurl package using npm. ```sh npm install encodeurl ``` -------------------------------- ### Install json-schema-typed via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/json-schema-typed/README.md Install the package using npm. ```sh npm install json-schema-typed ``` -------------------------------- ### Using raw-body as a promise Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/raw-body/README.md Omit the callback to get a promise. Requires a global Promise. The example creates an HTTP server that responds with the number of bytes submitted or an error message. ```js var getRawBody = require('raw-body') var http = require('http') var server = http.createServer(function (req, res) { getRawBody(req) .then(function (buf) { res.statusCode = 200 res.end(buf.length + ' bytes submitted') }) .catch(function (err) { res.statusCode = 500 res.end(err.message) }) }) server.listen(3000) ``` -------------------------------- ### Install debug with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/debug/README.md Install the debug package using npm. ```bash $ npm install debug ``` -------------------------------- ### Get network address from CIDR Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ipaddr.js/README.md Shows networkAddressFromCIDR() returning the network address for an IPv4 interface and netmask in CIDR notation. Example: "172.0.0.1/24" -> "172.0.0.0". ```javascript ipaddr.IPv4.networkAddressFromCIDR("172.0.0.1/24") == "172.0.0.0" ``` -------------------------------- ### Install Composed Chart Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the ComposedChart component via npx shadcn CLI. ```bash npx shadcn@latest add @spectrumui/composed-chart ``` -------------------------------- ### Install unpipe with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/unpipe/README.md Run this command to install the unpipe package via npm. ```sh $ npm install unpipe ``` -------------------------------- ### compile function examples Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/path-to-regexp/Readme.md Shows how to use compile to generate paths from parameters, including repeated segments and custom encoding. ```javascript const toPath = compile("/user/:id"); toPath({ id: "name" }); //=> "/user/name" toPath({ id: "café" }); //=> "/user/caf%C3%A9" const toPathRepeated = compile("/*segment"); toPathRepeated({ segment: ["foo"] }); //=> "/foo" toPathRepeated({ segment: ["a", "b", "c"] }); //=> "/a/b/c" // When disabling `encode`, you need to make sure inputs are encoded correctly. No arrays are accepted. const toPathRaw = compile("/user/:id", { encode: false }); toPathRaw({ id: "%3A%2F" }); //=> "/user/%3A%2F" ``` -------------------------------- ### Install Spectrum UI Accordion with shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms.txt Initialize shadcn/ui in a React or Next.js project, then add the Spectrum UI Accordion component using the verified command. Components can also be copied manually from their documentation source, installing only the listed dependencies. ```bash npx shadcn@latest init npx shadcn@latest add @spectrumui/accordion ``` -------------------------------- ### Get broadcast address from CIDR Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ipaddr.js/README.md Demonstrates broadcastAddressFromCIDR() returning the broadcast address for an IPv4 interface and netmask in CIDR notation. Example: "172.0.0.1/24" -> "172.0.0.255". ```javascript ipaddr.IPv4.broadcastAddressFromCIDR("172.0.0.1/24") == "172.0.0.255" ``` -------------------------------- ### Install body-parser via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/body-parser/README.md Install the body-parser package using npm. ```sh $ npm install body-parser ``` -------------------------------- ### Get IPv6 zone index with addr.zoneId Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ipaddr.js/README.md Shows how to access the zone index of an IPv6 address using the zoneId property. The example parses an address with a zone identifier and returns the zone string. ```JavaScript var addr = ipaddr.parse("2001:db8::%eth0"); addr.zoneId // => 'eth0' ``` -------------------------------- ### Install eventsource with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/eventsource/README.md Install the eventsource package as a dependency using npm. ```bash npm install --save eventsource ``` -------------------------------- ### Accept-Encoding Negotiation example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/negotiator/README.md Shows how to use the Negotiator constructor and encodings/encoding methods to negotiate encodings based on the Accept-Encoding header. ```js availableEncodings = ['identity', 'gzip'] negotiator = new Negotiator(request) // Let's say Accept-Encoding header is 'gzip, compress;q=0.2, identity;q=0.5' negotiator.encodings() // -> ['gzip', 'identity', 'compress'] negotiator.encodings(availableEncodings) // -> ['gzip', 'identity'] negotiator.encoding(availableEncodings) // -> 'gzip' ``` -------------------------------- ### Install object-inspect with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/object-inspect/readme.markdown Command to install the object-inspect package via npm. ```bash npm install object-inspect ``` -------------------------------- ### Install cross-spawn with npm (Node.js 8 and up) Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/cross-spawn/README.md Installs the latest cross-spawn version for Node.js 8 and higher. ```bash $ npm install cross-spawn ``` -------------------------------- ### Get IPv4 netmask from CIDR prefix length Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ipaddr.js/README.md Shows subnetMaskFromPrefixLength() returning the netmask string for a given prefix length. Examples: 24 -> "255.255.255.0" and 29 -> "255.255.255.248". ```javascript ipaddr.IPv4.subnetMaskFromPrefixLength(24) == "255.255.255.0" ipaddr.IPv4.subnetMaskFromPrefixLength(29) == "255.255.255.248" ``` -------------------------------- ### Install bytes via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/bytes/Readme.md Install the bytes module from the npm registry. ```bash $ npm install bytes ``` -------------------------------- ### npm script example for Windows PowerShell Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/debug/README.md An npm script example that sets the DEBUG environment variable and runs the app using PowerShell. ```js "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", ``` -------------------------------- ### Install PriceChart with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the PriceChart component using the shadcn CLI. Run this command in your project root to add the @spectrumui/price-chart block. ```bash npx shadcn@latest add @spectrumui/price-chart ``` -------------------------------- ### Access Node.js API via c.env with HttpBindings Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@hono/node-server/README.md Use HttpBindings type to access Node.js request/response objects from c.env. The example shows getting the remote address from the incoming socket and returning it as JSON. ```TypeScript import { serve } from '@hono/node-server' import type { HttpBindings } from '@hono/node-server' import { Hono } from 'hono' const app = new Hono<{ Bindings: HttpBindings }>() app.get('/', (c) => { return c.json({ remoteAddress: c.env.incoming.socket.remoteAddress, }) }) serve(app) ``` -------------------------------- ### Use callBound to get a robust intrinsic Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/call-bound/README.md Shows how to use callBound to obtain a robust reference to Array.prototype.slice, even after deleting Function.prototype.call, Function.prototype.bind, and Array.prototype.slice. The example asserts that the bound function still works correctly. ```js const assert = require('assert'); const callBound = require('call-bound'); const slice = callBound('Array.prototype.slice'); delete Function.prototype.call; delete Function.prototype.bind; delete Array.prototype.slice; assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]); ``` -------------------------------- ### Project structure example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@hono/node-server/README.md Shows a typical project structure with `src/index.ts` and `static/index.html`. This is used to illustrate how the `root` path is relative to the project root, not the source file. ```text my-hono-project/ src/ index.ts static/ index.html ``` -------------------------------- ### Install call-bound with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/call-bound/README.md Install the call-bound package as a dependency using npm. ```sh npm install --save call-bound ``` -------------------------------- ### Add handler for all HTTP methods with route.all Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/router/README.md Adds a handler for all HTTP methods to a route. The handler can behave like middleware and call next to continue processing. The example chains .all() and .get() to handle all methods and then GET specifically. ```javascript router.route('/') .all(function (req, res, next) { next() }) .all(checkSomething) .get(function (req, res) { res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Hello World!') }) ``` -------------------------------- ### Install is-promise via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/is-promise/readme.md Install the is-promise package using npm. This command is run in the terminal. ```bash $ npm install is-promise ``` -------------------------------- ### Install @types/node for TypeScript Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/raw-body/README.md Install the Node.js type definitions required for TypeScript projects using raw-body. ```sh $ npm install @types/node ``` -------------------------------- ### mime.contentType examples Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/mime-types/README.md Create a full content-type header. Uses mime.lookup for extensions, adds charset via mime.charset if not present. ```js mime.contentType('markdown') // 'text/x-markdown; charset=utf-8' mime.contentType('file.json') // 'application/json; charset=utf-8' mime.contentType('text/html') // 'text/html; charset=utf-8' mime.contentType('text/html; charset=iso-8859-1') // 'text/html; charset=iso-8859-1' // from a full path mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8' ``` -------------------------------- ### Install Calendar Heatmap chart Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the Calendar Heatmap chart component using the shadcn CLI. Run this command in your project directory. ```bash npx shadcn@latest add @spectrumui/calendar-heatmap ``` -------------------------------- ### Run tests Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/express/Readme.md Runs the test suite after installing dependencies. ```bash npm test ``` -------------------------------- ### Install via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ipaddr.js/README.md Install ipaddr.js using npm package manager. ```bash npm install ipaddr.js ``` -------------------------------- ### Expected output of basic example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/zod-to-json-schema/README.md The JSON Schema output produced by the basic example, showing the schema with a $ref to definitions and the object properties. ```json { "$schema": "http://json-schema.org/draft-07/schema#", "$ref": "#/definitions/mySchema", "definitions": { "mySchema": { "description": "My neat object schema", "type": "object", "properties": { "myString": { "type": "string", "minLength": 5 }, "myUnion": { "type": ["number", "boolean"] } }, "additionalProperties": false, "required": ["myString", "myUnion"] } } } ``` -------------------------------- ### Install TypeScript nightly build Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/typescript/README.md Installs the nightly build of TypeScript using the 'next' tag. ```bash npm install -D typescript@next ``` -------------------------------- ### Serving using express - Simple Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/serve-static/README.md Simple Express example that serves static files from 'public/ftp' with index files 'default.html' and 'default.htm'. ```javascript const express = require('express') const serveStatic = require('serve-static') const app = express() app.use(serveStatic('public/ftp', { index: ['default.html', 'default.htm'] })) app.listen(3000) ``` -------------------------------- ### Install fast-deep-equal via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/fast-deep-equal/README.md Install the package using npm. Requires node.js 8+ and browsers IE9+. ```bash npm install fast-deep-equal ``` -------------------------------- ### Dodo Dashboard Setup Checklist Source: https://github.com/arihantcodes/spectrum-ui/blob/main/docs/DODO.md Checklist for configuring the Dodo dashboard, including creating products, setting environment variables, adding a webhook endpoint, and switching to live mode. Lists product names and prices. ```text [ ] Create a product for each template (one-time, not subscription) → Nova SaaS $59 → Forge CLI $49 → Orbit $79 [ ] Copy each product ID → add to .env as DODO_PRODUCT_* [ ] Add webhook endpoint: URL: https://ui.spectrumhq.in/api/webhook Events: payment.succeeded, payment.failed [ ] Copy webhook signing key → DODO_PAYMENTS_WEBHOOK_KEY [ ] Test in test_mode with a real checkout flow end to end [ ] Switch DODO_PAYMENTS_ENVIRONMENT to live_mode before launch ``` -------------------------------- ### Install IndicatorChart with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the IndicatorChart component using the shadcn CLI. Run this command in your project root to add the @spectrumui/indicator-chart block. ```bash npx shadcn@latest add @spectrumui/indicator-chart ``` -------------------------------- ### Install eventsource-parser with npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/eventsource-parser/README.md Install the eventsource-parser package using npm. This is the first step to use the library in a project. ```bash npm install --save eventsource-parser ``` -------------------------------- ### Install Market Chart block Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the @spectrumui/market-chart block using the shadcn CLI. This block renders a full trading surface with candlesticks, volume pane, crosshair, and optional live tape. ```bash npx shadcn@latest add @spectrumui/market-chart ``` -------------------------------- ### Examples of typeis.match() wildcard matching Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/type-is/README.md Shows how typeis.match() matches expected and actual media types, including wildcard and suffix patterns. ```javascript typeis.match('text/html', 'text/html') // => true typeis.match('*/html', 'text/html') // => true typeis.match('text/*', 'text/html') // => true typeis.match('*/*', 'text/html') // => true typeis.match('*/*+json', 'application/x-custom+json') // => true ``` -------------------------------- ### Install Cohort Retention chart Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the Cohort Retention chart component using the shadcn CLI. Run this command in your project directory. ```bash npx shadcn@latest add @spectrumui/cohort-chart ``` -------------------------------- ### Install @modelcontextprotocol/sdk with zod Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@modelcontextprotocol/sdk/README.md Install the SDK and its required peer dependency zod for schema validation. The SDK internally imports from zod/v4 but maintains backwards compatibility with projects using Zod v3.25 or later. ```bash npm install @modelcontextprotocol/sdk zod ``` -------------------------------- ### Usage example for gopd Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/gopd/README.md Require the gopd module and check if it is supported. If supported, use it like Object.getOwnPropertyDescriptor; otherwise, handle the lack of support. ```javascript var gOPD = require('gopd'); var assert = require('assert'); if (gOPD) { assert.equal(typeof gOPD, 'function', 'descriptors supported'); // use gOPD like Object.getOwnPropertyDescriptor here } else { assert.ok(!gOPD, 'descriptors not supported'); } ``` -------------------------------- ### match function example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/path-to-regexp/Readme.md Creates a matching function for a path pattern. The returned function can be used to match strings against the path. ```javascript const fn = match("/foo/:bar"); ``` -------------------------------- ### Install DepthChart with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the DepthChart component using the shadcn CLI. Run this command in your project root to add the @spectrumui/depth-chart block. ```bash npx shadcn@latest add @spectrumui/depth-chart ``` -------------------------------- ### Install Files Table block Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Install the @spectrumui/files-table block using the shadcn CLI. This block provides a file browser table with folder, document, image, and video glyphs, human-readable sizes, collaborator avatars, and modified dates. ```bash npx shadcn@latest add @spectrumui/files-table ``` -------------------------------- ### Install Line Chart with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Command to add the @spectrumui/line-chart component to your project. ```bash npx shadcn@latest add @spectrumui/line-chart ``` -------------------------------- ### Simple Koa example using getRawBody Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/raw-body/README.md Koa middleware that yields the raw body as this.text, using the same options as the Express example. Requires Koa 1.x generator functions. ```js var contentType = require('content-type') var getRawBody = require('raw-body') var koa = require('koa') var app = koa() app.use(function * (next) { this.text = yield getRawBody(this.req, { length: this.req.headers['content-length'], limit: '1mb', encoding: contentType.parse(this.req).parameters.charset }) yield next }) // now access this.text ``` -------------------------------- ### Import path-to-regexp functions Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/path-to-regexp/Readme.md Import the main functions: match, pathToRegexp, compile, parse, and stringify. ```javascript const { match, pathToRegexp, compile, parse, stringify, } = require("path-to-regexp"); ``` -------------------------------- ### wrappy usage example Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/wrappy/README.md Demonstrates how to use the wrappy function to create a wrapper that ensures a callback is only called once. The example shows that the wrapper retains properties from the original function and that subsequent calls after the first are ignored. ```javascript var wrappy = require("wrappy") // var wrapper = wrappy(wrapperFunction) // make sure a cb is called only once // See also: http://npm.im/once for this specific use case var once = wrappy(function (cb) { var called = false return function () { if (called) return called = true return cb.apply(this, arguments) } }) function printBoo () { console.log('boo') } // has some rando property printBoo.iAmBooPrinter = true var onlyPrintOnce = once(printBoo) onlyPrintOnce() // prints 'boo' onlyPrintOnce() // does nothing // random property is retained! assert.equal(onlyPrintOnce.iAmBooPrinter, true) ``` -------------------------------- ### Install merge-descriptors via npm Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/merge-descriptors/readme.md Run this command in your project directory to add the package dependency. ```sh npm install merge-descriptors ``` -------------------------------- ### Install Bar Chart with npx shadcn Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Command to add the @spectrumui/bar-chart component to your project. ```bash npx shadcn@latest add @spectrumui/bar-chart ``` -------------------------------- ### Install StatCards component Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Command to add the @spectrumui/stat-cards component to a project using shadcn CLI. ```bash npx shadcn@latest add @spectrumui/stat-cards ``` -------------------------------- ### Address6#startAddress Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ip-address/README.md Instance method to get the first address in the subnet range. ```APIDOC ## Address6#startAddress ### Description The first address in the range given by this address' subnet. Often referred to as the Network Address. ### Method INSTANCE ### Signature `startAddress(): Address6` ### Returns - **Address6** - The network address. ``` -------------------------------- ### mime.lookup examples Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/mime-types/README.md Lookup the content-type associated with a file. Returns false for unrecognized extensions. ```js mime.lookup('json') // 'application/json' mime.lookup('.md') // 'text/markdown' mime.lookup('file.html') // 'text/html' mime.lookup('folder/file.js') // 'application/javascript' mime.lookup('folder/.htaccess') // false mime.lookup('cats') // false ``` -------------------------------- ### Install HistogramChart component Source: https://github.com/arihantcodes/spectrum-ui/blob/main/public/llms-full.txt Command to add the @spectrumui/histogram-chart component to a project using shadcn CLI. ```bash npx shadcn@latest add @spectrumui/histogram-chart ``` -------------------------------- ### Basic Ajv usage in JavaScript Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ajv/README.md Shows how to import Ajv, compile a schema, and validate data. The example includes a schema with required properties and additionalProperties set to false, and logs validation errors if validation fails. ```javascript // or ESM/TypeScript import import Ajv from "ajv" // Node.js require: const Ajv = require("ajv") const ajv = new Ajv() // options can be passed, e.g. {allErrors: true} const schema = { type: "object", properties: { foo: {type: "integer"}, bar: {type: "string"}, }, required: ["foo"], additionalProperties: false, } const data = { foo: 1, bar: "abc", } const validate = ajv.compile(schema) const valid = validate(data) if (!valid) console.log(validate.errors) ``` -------------------------------- ### Basic Usage: qs.parse and qs.stringify Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/qs/README.md Shows the basic usage of qs.parse and qs.stringify. Requires the qs module and uses assert for testing. ```javascript var qs = require('qs'); var assert = require('assert'); var obj = qs.parse('a=c'); assert.deepEqual(obj, { a: 'c' }); var str = qs.stringify(obj); assert.equal(str, 'a=c'); ``` -------------------------------- ### Basic Hono server with @hono/node-server Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/@hono/node-server/README.md Imports serve from @hono/node-server and Hono, creates a simple app, and starts the server. The callback logs the listening port, defaulting to 3000. ```ts import { serve } from '@hono/node-server' import { Hono } from 'hono' const app = new Hono() app.get('/', (c) => c.text('Hono meets Node.js')) serve(app, (info) => { console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000 }) ``` -------------------------------- ### Basic router server with middleware and API routes Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/router/README.md Sets up an HTTP server with the router package, using compression and body-parser middleware. Handles GET /message and PATCH /api/set-message, returning 400 for invalid API syntax. Listens on port 8080. ```javascript // import our modules var http = require('http') var Router = require('router') var finalhandler = require('finalhandler') var compression = require('compression') var bodyParser = require('body-parser') // store our message to display var message = 'Hello World!' // initialize the router & server and add a final callback. var router = Router() var server = http.createServer(function onRequest (req, res) { router(req, res, finalhandler(req, res)) }) // use some middleware and compress all outgoing responses router.use(compression()) // handle `GET` requests to `/message` router.get('/message', function (req, res) { res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') }) // create and mount a new router for our API var api = Router() router.use('/api/', api) // add a body parsing middleware to our API api.use(bodyParser.json()) // handle `PATCH` requests to `/api/set-message` api.patch('/set-message', function (req, res) { if (req.body.value) { message = req.body.value res.statusCode = 200 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end(message + '\n') } else { res.statusCode = 400 res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Invalid API Syntax\n') } }) // make our http server listen to connections server.listen(8080) ``` -------------------------------- ### Install via bower Source: https://github.com/arihantcodes/spectrum-ui/blob/main/packages/mcp-server/node_modules/ipaddr.js/README.md Install ipaddr.js using bower package manager. ```bash bower install ipaddr.js ```