### Full Server Example with Middleware and API Routing Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/router/README.md A comprehensive example demonstrating the setup of an HTTP server with a router, including middleware like compression and body-parser, and nested API routing. ```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) ``` -------------------------------- ### Basic Router Setup and GET Route Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/router/README.md Set up a basic HTTP server using the router module and define a GET route for the root path. ```javascript var finalhandler = require('finalhandler') var http = require('http') var Router = require('router') var router = Router() router.get('/', function (req, res) { res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Hello World!') }) var server = http.createServer(function (req, res) { router(req, res, finalhandler(req, res)) }) server.listen(3000) ``` -------------------------------- ### Low-Level MCP Server Setup Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@modelcontextprotocol/sdk/README.md Demonstrates how to instantiate and configure a low-level MCP server, including defining request handlers for specific capabilities like listing and getting prompts. ```typescript import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { ListPromptsRequestSchema, GetPromptRequestSchema } from "@modelcontextprotocol/sdk/types.js"; const server = new Server( { name: "example-server", version: "1.0.0" }, { capabilities: { prompts: {} } } ); server.setRequestHandler(ListPromptsRequestSchema, async () => { return { prompts: [{ name: "example-prompt", description: "An example prompt template", arguments: [{ name: "arg1", description: "Example argument", required: true }] }] }; }); server.setRequestHandler(GetPromptRequestSchema, async (request) => { if (request.params.name !== "example-prompt") { throw new Error("Unknown prompt"); } return { description: "Example prompt", messages: [{ role: "user", content: { type: "text", text: "Example prompt text" } }] }; }); const transport = new StdioServerTransport(); await server.connect(transport); ``` -------------------------------- ### Run an Express Example Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/express/Readme.md Executes a specific example script from the cloned Express repository. Replace 'content-negotiation' with the desired example name. ```bash node examples/content-negotiation ``` -------------------------------- ### Basic Express.js Server Setup Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/express/Readme.md A minimal Express.js application that listens on port 3000 and responds with 'Hello World' to root requests. Requires Node.js and Express.js installed. ```javascript import express from 'express' const app = express() app.get('/', (req, res) => { res.send('Hello World') }) app.listen(3000) ``` -------------------------------- ### Basic Usage Example Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/side-channel-list/README.md Demonstrates the basic usage of side-channel-list, including setting, getting, asserting, and deleting keys. This example requires the 'assert' module. ```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 Zod via npm Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/zod/README.md Install Zod using your preferred package manager. Examples for npm, deno, yarn, bun, and pnpm are provided. ```sh npm install zod # npm den o add npm:zod # deno yarn add zod # yarn bun add zod # bun pnpm add zod # pnpm ``` ```sh npm install zod@canary # npm den o add npm:zod@canary # deno yarn add zod@canary # yarn bun add zod@canary # bun pnpm add zod@canary # pnpm ``` -------------------------------- ### Install serve-static Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/serve-static/README.md Install the serve-static module using npm. ```sh npm install serve-static ``` -------------------------------- ### Basic GET Request Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/axios/README.md Demonstrates how to make a GET request to fetch data, with examples using both query parameters and a params object. ```APIDOC ## GET /user ### Description Fetches user data based on an ID. ### Method GET ### Endpoint /user ### Parameters #### Query Parameters - **ID** (number) - Required - The ID of the user to fetch. ### Request Example ```javascript axios.get('/user?ID=12345') .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); // Alternative using params object axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); ``` ### Response #### Success Response (200) - **response** (object) - Contains the data returned from the server. ``` -------------------------------- ### Installation Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/path-to-regexp/Readme.md Install the path-to-regexp library using npm. ```APIDOC ## Installation ``` npm install path-to-regexp --save ``` ``` -------------------------------- ### Install with Custom Source Map Retrieval Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@cspotcode/source-map-support/README.md Provide alternate source map loading behavior through a callback. This example shows caching source maps in memory. ```javascript require('@cspotcode/source-map-support').install({ retrieveSourceMap: function(source) { if (source === 'compiled.js') { return { url: 'original.js', map: fs.readFileSync('compiled.js.map', 'utf8') }; } return null; } }); ``` -------------------------------- ### Install binary-extensions Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/binary-extensions/readme.md Install the package using npm. ```sh npm install binary-extensions ``` -------------------------------- ### Install on-finished Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/on-finished/README.md Install the on-finished module using npm. ```sh $ npm install on-finished ``` -------------------------------- ### Install ee-first Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/ee-first/README.md Install the ee-first module using npm. ```sh $ npm install ee-first ``` -------------------------------- ### Install eventsource-parser Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/eventsource-parser/README.md Install the library using npm. ```bash npm install --save eventsource-parser ``` -------------------------------- ### Install pkce-challenge Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/pkce-challenge/README.md Install the pkce-challenge package using npm. ```bash npm install pkce-challenge ``` -------------------------------- ### Install get-proto Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/get-proto/README.md Install the get-proto package using npm. ```sh npm install --save get-proto ``` -------------------------------- ### Install is-binary-path Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/is-binary-path/readme.md Install the package using npm. ```bash $ npm install is-binary-path ``` -------------------------------- ### Install path-to-regexp Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/path-to-regexp/Readme.md Install the path-to-regexp package using npm. ```bash npm install path-to-regexp --save ``` -------------------------------- ### Install supports-color Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/supports-color/readme.md Install the supports-color module using npm. ```bash $ npm install supports-color ``` -------------------------------- ### Install node-touch Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/touch/README.md Install the node-touch package using npm. ```bash npm install touch ``` -------------------------------- ### Install simple-update-notifier Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/simple-update-notifier/README.md Install the package using npm or yarn. ```bash npm install simple-update-notifier OR yarn add simple-update-notifier ``` -------------------------------- ### Install v8-compile-cache-lib Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/v8-compile-cache-lib/README.md Install the v8-compile-cache-lib package using npm. ```sh $ npm install --save v8-compile-cache-lib ``` -------------------------------- ### Install path-key Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/path-key/readme.md Install the path-key package using npm. ```bash $ npm install path-key ``` -------------------------------- ### Install fetch-blob Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/fetch-blob/README.md Install the fetch-blob package using npm. ```sh npm install fetch-blob ``` -------------------------------- ### Install Verb and Build Docs Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/braces/README.md Install the necessary tools globally to generate the README documentation from its template. Then, run the verb command to build the documentation. ```sh $ npm install -g verbose/verb#dev verb-generate-readme && verb ``` -------------------------------- ### Define a GET Route Handler Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/router/README.md Example of defining a handler for a GET request to the root path. ```javascript // handle a `GET` request router.get('/', function (req, res) { res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Hello World!') }) ``` -------------------------------- ### Install Negotiator Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/negotiator/README.md Install the Negotiator module using npm. ```sh $ npm install negotiator ``` -------------------------------- ### Install pstree.remy Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/pstree.remy/README.md Install the pstree.remy package using npm. ```shell npm install pstree.remy ``` -------------------------------- ### Install ignore-by-default Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/ignore-by-default/README.md Install the ignore-by-default package using npm. ```bash npm install --save ignore-by-default ``` -------------------------------- ### Install raw-body Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/raw-body/README.md Install the raw-body module using npm. ```sh npm install raw-body ``` -------------------------------- ### Install proxy-addr Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/proxy-addr/README.md Install the proxy-addr module using npm. ```sh npm install proxy-addr ``` -------------------------------- ### Router Initialization and Basic Usage Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/router/README.md Demonstrates how to initialize a router instance and set up a basic GET route for the root path, then integrate it with an HTTP server. ```APIDOC ## Router() ### Description Initializes a new router instance. Options can be provided to configure routing behavior. ### Parameters #### Options - **strict** (boolean) - Optional - When `false` trailing slashes are optional (default: `false`). - **caseSensitive** (boolean) - Optional - When `true` the routing will be case sensitive (default: `false`). - **mergeParams** (boolean) - Optional - When `true` any `req.params` passed to the router will be merged into the router's `req.params` (default: `false`). ### Returns A function with the signature `router(req, res, callback)` where `callback([err])` must be provided to handle errors and fall-through from not handling requests. ### Example ```js var finalhandler = require('finalhandler') var http = require('http') var Router = require('router') var router = Router() router.get('/', function (req, res) { res.setHeader('Content-Type', 'text/plain; charset=utf-8') res.end('Hello World!') }) var server = http.createServer(function (req, res) { router(req, res, finalhandler(req, res)) }) server.listen(3000) ``` ``` -------------------------------- ### Start the Express Development Server Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/express/Readme.md Starts the Express development server, typically after installing dependencies. The application will be accessible at http://localhost:3000. ```bash npm start ``` -------------------------------- ### Curl Command to Get Message Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/router/README.md Example command to fetch the message from the server using curl. This demonstrates how to interact with the GET /message endpoint. ```bash curl http://127.0.0.1:8080 ``` -------------------------------- ### Install EventSource Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/eventsource/README.md Install the EventSource module using npm. ```bash npm install --save eventsource ``` -------------------------------- ### Create an Echo Server with Resources, Tools, and Prompts Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@modelcontextprotocol/sdk/README.md A basic server example demonstrating how to define a resource, a tool, and a prompt. The resource provides echoed content based on a URI, the tool echoes a message, and the prompt echoes a message for processing. ```typescript import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; const server = new McpServer({ name: "Echo", version: "1.0.0" }); server.resource( "echo", new ResourceTemplate("echo://{message}", { list: undefined }), async (uri, { message }) => ({ contents: [{ uri: uri.href, text: `Resource echo: ${message}` }] }) ); server.tool( "echo", { message: z.string() }, async ({ message }) => ({ content: [{ type: "text", text: `Tool echo: ${message}` }] }) ); server.prompt( "echo", { message: z.string() }, ({ message }) => ({ messages: [{ role: "user", content: { type: "text", text: `Please process this message: ${message}` } }] }) ); ``` -------------------------------- ### Install dunder-proto Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/dunder-proto/README.md Install the dunder-proto package using npm. ```sh npm install --save dunder-proto ``` -------------------------------- ### Install media-typer Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/media-typer/README.md Install the media-typer module using npm. ```sh npm install media-typer ``` -------------------------------- ### Clone Express Repository and Install Dependencies Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/express/Readme.md Clones the Express.js GitHub repository and installs its development dependencies. This is useful for exploring examples or contributing to Express. ```bash git clone https://github.com/expressjs/express.git --depth 1 && cd express ``` ```bash npm install ``` -------------------------------- ### Run Development Server and Build Project Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/README.md Start the development server for active development or build the project for production. ```bash # 개발 서버 실행 npm run dev # 빌드 npm run build ``` -------------------------------- ### Install content-disposition Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/content-disposition/README.md Install the content-disposition module using npm. ```sh npm install content-disposition ``` -------------------------------- ### Install and Run Tests Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/send/README.md Standard commands to install dependencies and run tests for the project. ```bash $ npm install $ npm test ``` -------------------------------- ### Chokidar Watcher with All Configuration Options Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/chokidar/README.md Provides an example of initializing Chokidar with a comprehensive set of options, illustrating various settings for ignoring files, handling initial events, following symlinks, and more. ```javascript chokidar.watch('file', { persistent: true, ignored: '*.txt', ignoreInitial: false, followSymlinks: true, cwd: '.', disableGlobbing: false, usePolling: false, interval: 100, binaryInterval: 300, alwaysStat: false, depth: 99, awaitWriteFinish: { stabilityThreshold: 2000, pollInterval: 100 }, ignorePermissionErrors: false, atomic: true // or a custom 'atomicity delay', in milliseconds (default 100) }); ``` -------------------------------- ### Usage Example Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/call-bound/README.md Demonstrates how to use callBound to get a bound version of Array.prototype.slice and use it after the original method has been deleted. ```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]); ``` -------------------------------- ### Nodemon Configuration File Example Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/nodemon/README.md Example of a nodemon.json configuration file. It demonstrates setting verbose mode, ignoring specific files, and mapping file extensions to executables. ```json { "verbose": true, "ignore": ["*.test.js", "**/fixtures/**"], "execMap": { "rb": "ruby", "pde": "processing --sketch={{pwd}} --run" } } ``` -------------------------------- ### Basic Object Inspection Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/object-inspect/readme.markdown A fundamental example of using the object-inspect function to get a string representation of an object. This is the most basic usage of the library. ```js var inspect = require('object-inspect') ``` -------------------------------- ### Get PATH environment variable key Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/path-key/readme.md Retrieve the cross-platform PATH environment variable key and its value. This example demonstrates the default usage. ```javascript const pathKey = require('path-key'); const key = pathKey(); //=> 'PATH' const PATH = process.env[key]; //=> '/usr/local/bin:/usr/bin:/bin' ``` -------------------------------- ### Install AsyncKit Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/asynckit/README.md Install the asynckit package using npm. ```sh $ npm install --save asynckit ``` -------------------------------- ### Get Range of First Brace Pair Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/balanced-match/README.md Finds the first non-nested pair of '{' and '}' characters in a string, returning an array with the start and end indices. ```javascript var balanced = require('balanced-match'); console.log(balanced.range('{', '}', 'pre{in{nested}}post')); console.log(balanced.range('{', '}', 'pre{first}between{second}post')); console.log(balanced.range(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); ``` -------------------------------- ### Install Fresh Module Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/fresh/README.md Install the Fresh module using npm. ```bash npm install fresh ``` -------------------------------- ### Combine streams without pausing Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/combined-stream/Readme.md This example shows how to configure combined-stream to not pause source streams, which can be useful if you want them to start emitting data immediately. ```javascript var CombinedStream = require('combined-stream'); var fs = require('fs'); var combinedStream = CombinedStream.create({pauseStreams: false}); combinedStream.append(fs.createReadStream('file1.txt')); combinedStream.append(fs.createReadStream('file2.txt')); combinedStream.pipe(fs.createWriteStream('combined.txt')); ``` -------------------------------- ### Usage Example for side-channel-weakmap Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/side-channel-weakmap/README.md Demonstrates how to use the side-channel-weakmap to set, get, assert, and delete key-value pairs. It shows the expected behavior for existing and non-existing keys. ```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 Dependencies and Run Tests Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/braces/README.md Use this command to install project dependencies and execute the unit tests. Running tests is a good way to familiarize yourself with the library's API. ```sh $ npm install && npm test ``` -------------------------------- ### Express Route-Specific Body Parser Setup Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/body-parser/README.md This example demonstrates applying body parsers to specific routes that require them, which is the recommended approach for Express applications. It shows how to create and use separate parsers for JSON and URL-encoded data. ```javascript const express = require('express') const bodyParser = require('body-parser') const app = express() // create application/json parser const jsonParser = bodyParser.json() // create application/x-www-form-urlencoded parser const urlencodedParser = bodyParser.urlencoded() // POST /login gets urlencoded bodies app.post('/login', urlencodedParser, function (req, res) { if (!req.body || !req.body.username) res.sendStatus(400) res.send('welcome, ' + req.body.username) }) // POST /api/users gets JSON bodies app.post('/api/users', jsonParser, function (req, res) { if (!req.body) res.sendStatus(400) // create user in req.body }) ``` -------------------------------- ### Cloning and Installing iconv-lite Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/iconv-lite/README.md Steps to clone the iconv-lite repository, install its dependencies, and run the test suite. ```bash git clone git@github.com:ashtuchkin/iconv-lite.git cd iconv-lite npm install npm test ``` -------------------------------- ### Nodemon Passing Arguments to Script via Config Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/nodemon/doc/cli/help.txt Starts nodemon and passes arguments to the script, using '--' to separate nodemon's arguments from the script's arguments. This example also shows passing a config file. ```bash nodemon app.js -- --config ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/cors/CONTRIBUTING.md Install project dependencies and run the test suite using npm. ```bash npm install npm test ``` -------------------------------- ### Install parseurl with npm Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/parseurl/README.md Install the parseurl module using the npm install command. ```sh $ npm install parseurl ``` -------------------------------- ### Installing and Installing dotenv-expand Git Hook Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/dotenv/README.md Installs the dotenvx CLI tool using Homebrew and then installs the git pre-commit hook to prevent accidental commits of .env files. ```bash brew install dotenvx/brew/dotenvx dotenvx precommit --install ``` -------------------------------- ### Install toidentifier using npm Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/toidentifier/README.md Install the toidentifier package locally using the npm install command. ```bash npm install toidentifier ``` -------------------------------- ### Install is-promise Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/is-promise/readme.md Install the is-promise package using npm. This command is used for both server and client-side installations. ```bash $ npm install is-promise ``` -------------------------------- ### CLI Usage Example Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/which/README.md Illustrates the command-line interface usage for the 'which' utility. ```bash usage: which [-as] program ... ``` -------------------------------- ### Serve All Files from a Directory Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/send/README.md This example serves all files from a specified directory as the root. Requests for files will be mapped to the directory. ```javascript var http = require('http') var parseUrl = require('parseurl') var send = require('send') var server = http.createServer(function onRequest (req, res) { send(req, parseUrl(req).pathname, { root: '/www/public' }) .pipe(res) }) ``` -------------------------------- ### Install dotenv with npm Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/dotenv/README.md Install dotenv locally in your project using npm. This is the recommended installation method. ```bash # install locally (recommended) npm install dotenv --save ``` -------------------------------- ### Install the vary module Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/vary/README.md Install the vary module using npm. This command installs the package locally in your project. ```sh npm install vary ``` -------------------------------- ### Install Dev Dependencies and Run Benchmarks Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/braces/README.md Command to install development dependencies and run benchmarks for the 'braces' library. ```bash npm i -d && npm benchmark ``` -------------------------------- ### Install Send Library Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/send/README.md Install the 'send' library using npm. This command installs the package locally in your Node.js project. ```bash npm install send ``` -------------------------------- ### Serving from Root with Custom Error and Headers Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/send/README.md This example shows serving files from a root directory with custom logic for error handling, directory redirection, and setting Content-Disposition headers for downloads. ```javascript var http = require('http') var parseUrl = require('parseurl') var send = require('send') var server = http.createServer(function onRequest (req, res) { // your custom error-handling logic: function error (err) { res.statusCode = err.status || 500 res.end(err.message) } // your custom headers function headers (res, path, stat) { // serve all files for download res.setHeader('Content-Disposition', 'attachment') } // your custom directory handling logic: function redirect () { res.statusCode = 301 res.setHeader('Location', req.url + '/') res.end('Redirecting to ' + req.url + '/') } // transfer arbitrary files from within // /www/example.com/public/* send(req, parseUrl(req).pathname, { root: '/www/public' }) .on('error', error) .on('directory', redirect) .on('headers', headers) .pipe(res) }) ``` -------------------------------- ### Default GET Request Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/axios/README.md Illustrates making a GET request using the shorthand `axios(url)` which defaults the method to GET. ```javascript // Send a GET request (default method) axios('/user/12345'); ``` -------------------------------- ### Clone Repository and Install Dependencies Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/README.md Clone the project repository, navigate into the directory, and install the necessary npm dependencies. ```bash # 저장소 클론 git clone https://github.com/tenacl/koreandict-mcp-server.git cd koreandict-mcp-server # 의존성 설치 npm install ``` -------------------------------- ### Install shebang-regex Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/shebang-regex/readme.md Install the package using npm. ```bash $ npm install shebang-regex ``` -------------------------------- ### Serve a Specific File Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/send/README.md This example demonstrates how to serve a single, specific HTML file for all incoming requests. ```javascript var http = require('http') var send = require('send') var server = http.createServer(function onRequest (req, res) { send(req, '/path/to/index.html') .pipe(res) }) server.listen(3000) ``` -------------------------------- ### Create Basic MCP Server with Tool and Resource Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@modelcontextprotocol/sdk/README.md Sets up a basic MCP server exposing an addition tool and a dynamic greeting resource. It then connects to stdio for communication. ```typescript import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; // Create an MCP server const server = new McpServer({ name: "Demo", version: "1.0.0" }); // Add an addition tool server.tool( "add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({ content: [{ type: "text", text: String(a + b) }] }) ); // Add a dynamic greeting resource server.resource( "greeting", new ResourceTemplate("greeting://{name}", { list: undefined }), async (uri, { name }) => ({ contents: [{ uri: uri.href, text: `Hello, ${name}!` }] }) ); // Start receiving messages on stdin and sending messages on stdout const transport = new StdioServerTransport(); await server.connect(transport); ``` -------------------------------- ### Install and Run CoffeeScript Demo Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@cspotcode/source-map-support/README.md Demonstrates how to install the source-map-support and coffeescript packages, compile a CoffeeScript file with source maps, and run the resulting JavaScript file to see source-mapped error output. ```sh $ npm install @cspotcode/source-map-support coffeescript $ node_modules/.bin/coffee --map --compile demo.coffee $ node demo.js ``` -------------------------------- ### Creating an Axios Instance Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/axios/README.md Demonstrates how to create a custom Axios instance with a default configuration. ```APIDOC ## axios.create([config]) ### Description Creates a new Axios instance with a custom configuration, allowing for default settings like baseURL and headers. ### Method `axios.create` ### Parameters #### Config Options - **baseURL** (string) - The base URL to resolve all requests made with this instance. - **timeout** (number) - Allows setting a request timeout in milliseconds. - **headers** (object) - An object containing default headers for requests. ### Request Example ```javascript const instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, headers: {'X-Custom-Header': 'foobar'} }); ``` ``` -------------------------------- ### Install accepts.js Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/accepts/README.md Install the accepts.js module using npm. ```sh npm install accepts ``` -------------------------------- ### Install @jridgewell/trace-mapping Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@jridgewell/trace-mapping/README.md Install the package using npm. ```sh npm install @jridgewell/trace-mapping ``` -------------------------------- ### Basic Brace Expansion Examples Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/brace-expansion/README.md Demonstrates various ways to use the expand function with different brace expansion patterns. ```javascript var expand = require('brace-expansion'); expand('file-{a,b,c}.jpg') // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] ``` ```javascript expand('-v{,,}') // => ['-v', '-v', '-v'] ``` ```javascript expand('file{0..2}.jpg') // => ['file0.jpg', 'file1.jpg', 'file2.jpg'] ``` ```javascript expand('file-{a..c}.jpg') // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] ``` ```javascript expand('file{2..0}.jpg') // => ['file2.jpg', 'file1.jpg', 'file0.jpg'] ``` ```javascript expand('file{0..4..2}.jpg') // => ['file0.jpg', 'file2.jpg', 'file4.jpg'] ``` ```javascript expand('file-{a..e..2}.jpg') // => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] ``` ```javascript expand('file{00..10..5}.jpg') // => ['file00.jpg', 'file05.jpg', 'file10.jpg'] ``` ```javascript expand('{{A..C},{a..c}}') // => ['A', 'B', 'C', 'a', 'b', 'c'] ``` ```javascript expand('ppp{,config,oe{,conf}}') // => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] ``` -------------------------------- ### Install @jridgewell/resolve-uri Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/@jridgewell/resolve-uri/README.md Install the package using npm. ```sh npm install @jridgewell/resolve-uri ``` -------------------------------- ### Install Axios using bun Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/axios/README.md Install Axios using the bun package manager. ```bash $ bun add axios ``` -------------------------------- ### Install Express.js via npm Source: https://github.com/tenacl/koreandict-mcp-server/blob/main/node_modules/express/Readme.md Command to install the Express.js package from the npm registry. Ensure Node.js and npm are installed and a package.json file exists. ```bash npm install express ```