stefanoauciello/mcp-server
3.2
If you are the rightful owner of mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This project is a minimal Model Context Protocol (MCP) server implemented in Node.js, designed to serve as a foundation for developing custom MCP tools.
Tools
1
Resources
0
Prompts
0
MCP Server (demo-node-server)
- What this project does
- This is a minimal MCP (Model Context Protocol) server written in Node.js.
- It exposes a tool called "add_numbers" that sums two numbers and returns:
- Text output: "Result:
" - Structured output (JSON):
{ "result": number }
- Text output: "Result:
- It is intended as a starting point for developing and registering custom MCP tools using
@modelcontextprotocol/sdkwith validation viazod.
- How to use
Requirements
- Node.js 18 or newer
- npm (or pnpm/yarn if you prefer)
Installation
npm install
Run locally (STDIO)
# option 1
npm run server
# option 2
node server.js
If startup succeeds, you will see logs (stderr) like:
[demo-node-server] Starting, registering tools...
[demo-node-server] Ready (stdio connected)
Integrate with an MCP client (e.g., Claude Desktop)
- Add a new MCP server in the client settings with the following parameters:
- command:
node - args:
["server.js"] - cwd: path to this project folder (e.g.,
C:/Users/step1/Desktop/github/mcp-serveron Windows)
- command:
- Restart or reload your MCP client to apply the configuration.
Available tools
add_numbers- Input:
{ a: number, b: number } - Structured output:
{ result: number } - Text output:
Result: <sum>
- Input:
Example call (conceptual) Request:
{ "tool": "add_numbers", "params": { "a": 2, "b": 3 } }
Response (structured content):
{ "result": 5 }
Main project structure
server.js: defines the MCP server, registers theadd_numberstool, and handles the STDIO transport.package.json: npm scripts (npm run server) and dependencies (@modelcontextprotocol/sdk,zod).launch.json: launch configuration (optional, for IDE/editor).
Troubleshooting
- Make sure you use Node 18+.
- If your MCP client doesn’t detect the server:
- Verify that
node server.jsworks from the terminal in the project folder. - Check that the client configuration
cwdpoints to the correct folder. - Inspect stderr logs (prefixed with
[demo-node-server]).
- Verify that