MCP-JS
A simple boilerplate for building Model Context Protocol (MCP) servers in Node.js
claude mcp add --transport stdio helmi97-mcp-js-server node src/server.js \ --env DEBUG="Enable verbose logging (e.g., set to 1)" \ --env MCP_API_KEY="Optional API key for authentication"
How to use
This MCP server provides an HTTP MCP transport with an auto-generated JSON schema for tools via a single tools.config.js file. Tools are registered in the registry and exposed under the /tools endpoint, which lists available tools and their schemas. The server exposes an MCP JSON-RPC interface at /mcp, allowing clients to call registered tools using the standard JSON-RPC format. An optional API key can be enforced via the MCP_API_KEY environment variable, and all requests can be logged and error-handled centrally by the server's middleware. To add functionality, you edit src/tools.config.js to define new tools; the tool loader will generate the appropriate JSON schemas from Zod shapes and expose them automatically on startup.
How to install
Prerequisites:
- Node.js and npm installed
- Git installed
Step-by-step:
-
Clone the repository git clone https://github.com/Helmi97/MCP-JS-Server.git cd mcp-js-server
-
Install dependencies npm install
-
Configure optional authentication (recommended)
- Create a .env or set the environment variable MCP_API_KEY in your deployment to enable API key protection.
-
Start the server npm start
-
Verify endpoints
- Tools list: http://localhost:3000/tools
- MCP endpoint: http://localhost:3000/mcp
If you modify tools.config.js, restart the server to register new tools.
Additional notes
Tips and common considerations:
- Tools are defined in src/tools.config.js; after adding or updating a tool, restart the server to reload the registry.
- The server auto-generates JSON schemas from Zod shapes, ensuring consistent validation for tool inputs.
- If MCP_API_KEY is set, all requests to /mcp must include the x-api-key header with the matching value.
- Debug logging can be enabled by setting DEBUG=1 in the environment.
- The /tools endpoint provides both tool metadata and schemas; use this to build client integrations or test tools before wiring them into applications.
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.