local -tutorial
ローカルMCPサーバー(stdio)を作成するためのチュートリアルです。
claude mcp add --transport stdio 7nohe-local-mcp-server-tutorial node dist/index.js \ --env NODE_ENV="production"
How to use
This MCP server demonstrates a local example with multiple capabilities implemented in a single server. It exposes two static Hello resources and a dynamic resource list, a translation prompt, and a BMI calculator tool. Specifically, you’ll find a Greeting resource that returns a simple Hello, world! message, and a dynamic Greeting with name resource that can list and greet multiple names. There is a Japanese translation prompt that acts as a translation helper by sending user text to a chat prompt, and a calculate-bmi tool that computes BMI from provided weight and height. To use it locally, build the project to produce dist/index.js, then run the server (for example, node dist/index.js) and connect your MCP client (like Claude Desktop) to the server as configured in Claude’s mcpServers config. The project also includes an Inspector-based debugging flow to inspect Resources and Tools responses at http://127.0.0.1:6274 when running with the inspector.
Usage highlights:
- Resources: Greeting and Greeting with name endpoints provide text responses based on the requested URI. The dynamic template supports listing multiple resources via a ResourceTemplate and then returning a personalized greeting.
- Prompts: Japanese Translation showcases a translation prompt that reformulates user-supplied English text into Japanese.
- Tools: The calculate-bmi tool accepts weightKg and heightM inputs and returns a textual BMI result.
- Debugging: Use the Inspector to view defined Resources and Tools responses and verify behavior during development.
- Claude Desktop integration: Configure Claude to point to the built server executable (dist/index.js) so you can browse Resources/Tools and Attach Resources or Prompts directly from MCP definitions.
How to install
Prerequisites:
- Node.js v22 or compatible environment
- npm (comes with Node.js)
- Claude Desktop or another MCP client for testing
Step-by-step installation:
-
Create the project folder and install dependencies
- npx giget@latest gh:7nohe/local-mcp-server-tutorial my-mcp-server
- cd my-mcp-server
- npm install
-
Build the TypeScript code
- npm run build
- This outputs a dist/index.js file that can be executed with Node.js
-
Install required runtime dependencies for MCP server features
- npm install @modelcontextprotocol/sdk zod
-
Run the MCP server locally
- node dist/index.js
- The server will start and can be connected by an MCP client (e.g., Claude Desktop) using a config that points to dist/index.js
-
Optional: debug with inspector
- npx @modelcontextprotocol/inspector ./dist/index.js
- Open http://127.0.0.1:6274 to inspect Resources and Tools
-
(Optional) Configure Claude Desktop
- Settings -> Developer -> Edit Config, point to the server at the path to dist/index.js as shown in the README examples
Notes:
- You can enable automatic rebuilding during development with npm run watch if provided by the project setup.
- The package.json bin and files fields are recommended for publishing as an MCP CLI package, as shown in the README.
Additional notes
Tips and common issues:
- Ensure dist/index.js exists before starting the server; run npm run build to generate it.
- If you modify TypeScript source, re-run the build to update dist/index.js before restarting the server.
- When integrating with Claude Desktop, use an absolute path to dist/index.js in claude_desktop_config.json to avoid path resolution issues.
- If the inspector cannot connect, verify that the server is running and not blocked by a firewall; access the inspector URL at http://127.0.0.1:6274.
- For publishing on npm, consider using a scoped name like @username/my-mcp-server and set the bin field to point to dist/index.js, and ensure files only include dist to publish the build artifacts.
Related MCP Servers
zen
Selfhosted notes app. Single golang binary, notes stored as markdown within SQLite, full-text search, very low resource usage
MCP -Deepseek_R1
A Model Context Protocol (MCP) server implementation connecting Claude Desktop with DeepSeek's language models (R1/V3)
mcp-fhir
A Model Context Protocol implementation for FHIR
mcp
Inkdrop Model Context Protocol Server
mcp-appium-gestures
This is a Model Context Protocol (MCP) server providing resources and tools for Appium mobile gestures using Actions API..
dubco -npm
The (Unofficial) dubco-mcp-server enables AI assistants to manage Dub.co short links via the Model Context Protocol. It provides three MCP tools: create_link for generating new short URLs, update_link for modifying existing links, and delete_link for removing short links.