MCP Server in Node.js
@lucianoayres
About MCP Server in Node.js
MCP Server implemented in JavaScript using Node.js that demonstrates how to build an MCP server with a custom prompt and custom tools, including one that loads an environment variable from a configuration file, to integrate seamlessly with AI-assisted environments like Cursor IDE
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"mcp-server-node": {
"command": "npx",
"args": [
"@modelcontextprotocol/inspector",
"node",
"./mcp-server.js"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is MCP Server in Node.js?
MCP Server in Node.js is a demonstration project that implements a Model Context Protocol (MCP) server using JavaScript and Node.js. It exposes two tools—add and getApiKey—plus a predefined add_numbers prompt, allowing LLM-based IDEs like Cursor AI to call these tools on demand.
How to use MCP Server in Node.js?
Clone the repository, install dependencies with npm install, then test via the MCP Inspector using npm run inspector or npx @modelcontextprotocol/inspector node ./mcp-server.js. To integrate with Cursor IDE, add the server configuration in Cursor’s Settings → Tools & Integrations using the sample JSON provided in the README.
Key features of MCP Server in Node.js
- MCP Integration exposes tool functionality to LLM-based IDEs.
- Addition Tool accepts two numeric parameters and returns their sum.
- MCP Prompt (“add_numbers”) helps AI models infer tool usage.
- Environment variable retrieval via the
getApiKeytool. - Input validation uses Zod for schema checking.
- Standard I/O transport via
StdioServerTransport.
Use cases of MCP Server in Node.js
- Testing an MCP server interactively with MCP Inspector.
- Integrating custom tools into Cursor AI for code generation.
- Performing arithmetic operations through natural language prompts.
- Retrieving environment variables (e.g., API keys) on demand.
- Learning how to structure an MCP server with prompts and tools.
FAQ from MCP Server in Node.js
What is the MCP framework?
MCP (Model Context Protocol) is a framework that allows you to integrate custom tools into AI-assisted development environments such as Cursor AI, enabling LLMs to call these tools on demand.
What tools are defined in this server?
Two tools are defined: add (takes two numbers a and b and returns their sum) and getApiKey (retrieves the value of the API_KEY environment variable).
How can I test the server before integrating with an IDE?
Use the MCP Inspector by running npm run inspector or npx @modelcontextprotocol/inspector node ./mcp-server.js, then open http://localhost:6274/ in your browser to test tools, resources, and prompts.
What are the runtime requirements?
Node.js version 20 or higher is required.
How do I integrate this server with Cursor AI?
In Cursor IDE, go to Settings → Tools & Integrations → Add Custom MCP Server and add the JSON configuration specifying command ("node" or full path), args (absolute path to the server file), and optional env (e.g., "API_KEY").
Frequently asked questions
What is the MCP framework?
MCP (Model Context Protocol) is a framework that allows you to integrate custom tools into AI-assisted development environments such as Cursor AI, enabling LLMs to call these tools on demand.
What tools are defined in this server?
Two tools are defined: **add** (takes two numbers `a` and `b` and returns their sum) and **getApiKey** (retrieves the value of the `API_KEY` environment variable).
How can I test the server before integrating with an IDE?
Use the MCP Inspector by running `npm run inspector` or `npx @modelcontextprotocol/inspector node ./mcp-server.js`, then open `http://localhost:6274/` in your browser to test tools, resources, and prompts.
What are the runtime requirements?
Node.js version 20 or higher is required.
How do I integrate this server with Cursor AI?
In Cursor IDE, go to Settings → Tools & Integrations → Add Custom MCP Server and add the JSON configuration specifying `command` (`"node"` or full path), `args` (absolute path to the server file), and optional `env` (e.g., `"API_KEY"`).
Basic information
More Developer Tools MCP servers
OpenSumi
opensumiA framework helps you quickly build AI Native IDE products. MCP Client, supports Model Context Protocol (MCP) tools via MCP server.

Air Pipe
airpipeBuild, validate, deploy — HTTP APIs, cron jobs, webhooks and MCP tools — from your AI client.
Grafana MCP server
grafanaMCP server for Grafana
MCP Unity Editor (Game Engine)
CoderGamesterModel Context Protocol (MCP) plugin to connect with Unity Editor — designed for Cursor, Claude Code, Codex, Windsurf and other IDEs
DevDocs by CyberAGI 🚀
cyberagiincCompletely free, private, UI based Tech Documentation MCP server. Designed for coders and software developers in mind. Easily integrate into Cursor, Windsurf, Cline, Roo Code, Claude Desktop App
Comments