MCP Server Boilerplate
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server Boilerplateadd 3 and 5"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server in Node.js
Overview
MCP (Model Context Protocol) is a framework that allows you to integrate custom tools into AI-assisted development environments—such as Cursor AI. MCP servers expose functionality (like data retrieval or code analysis) so that an LLM-based IDE can call these tools on demand. Learn more about MCP in the Model Context Protocol Introduction.
This project demonstrates an MCP server built in Node.js that provides two basic tools. One tool, add, accepts two numbers and returns their sum, while the other, getApiKey, retrieves the API key from the environment (via the API_KEY variable).
Related MCP server: MCP Boilerplate
Requirements
Node.js: Version 20 or higher is required.
Features
MCP Integration: Exposes tool functionality to LLM-based IDEs.
Addition Tool: Accepts two numeric parameters and returns their sum.
Env Var Retrieval: Demonstrates how to load an example environment variable from the configuration file.
Input Validation: Uses Zod for schema validation.
Standard I/O Transport: Connects via
StdioServerTransportfor integration with development environments.
Installation
Clone the Repository
git clone <repository_url> cd <repository_directory>Install Dependencies
You can install the project dependencies in one of two ways:
Option 1: Install using the existing
package.jsonSimply run:
npm installOption 2: Install dependencies manually
If you prefer, delete the existing
package.jsonand install the required packages manually:npm install @modelcontextprotocol/sdk @coinpaprika/api-nodejs-client zodThen, update the newly generated
package.jsonfile to include the following line, which enables ES Modules:"type": "module"
Integrating with Cursor AI
This project includes a ./cursor subdirectory that contains an mcp.json file for configuring the MCP server. Cursor AI uses this file to automatically discover and launch your MCP server. Open the file and update the fields as follows:
The ./cursor/mcp.json Structure
Below is the full JSON structure of the configuration file:
{
"mcpServers": {
"MCP Server Boilerplate": {
"command": "/path/to/node",
"args": ["/path/to/mcp-server.js"],
"env": {
"API_KEY": "abc-1234567890"
}
}
}
}mcpServers:
An object mapping server names to their configuration.MCP Server Boilerplate:
This is the key for your server configuration. You can name it as you like.command:
Specifies the absolute path to your Node.js executable. For example:/home/john/.nvm/versions/node/v20.13.1/bin/nodeargs:
An array containing the absolute path to your MCP server file. For example:["/home/john/mcp-server-node/index.js"]env: (Optional)
Defines environment variables for your MCP server process. In this example, theAPI_KEYis set to"abc-1234567890". Adjust this value as needed for your environment.
You can verify the absolute path to your Node.js executable by running which node in your terminal.
Optional: Configuration Automation Scripts
Easily configure your local environment by automatically updating the mcp.json file with the correct absolute paths. To apply your local settings, run the following commands from your project root:
chmod +x ./scripts/update_config.sh
./scripts/update_config.shThis script replaces the placeholder paths in mcp.json with your machine’s absolute paths for Python and the server script, ensuring your configuration settings are always accurate.
Optional: Global Cursor settings
You can also move the mcp.json file to your global Cursor AI configuration directory located at ~/.cursor to make the configuration available globally.
Using the MCP Tool in Cursor Composer (Agent Mode)
With the MCP server integrated into Cursor AI and with Agent mode enabled in Cursor Composer, simply use a natural language prompt like:
add 3 and 5or
what is my API key?The AI agent will infer the available add or getApiKey tool from your MCP server and execute it accordingly.
Code Overview
The project comprises the following key parts:
MCP Server Initialization:
The MCP server is instantiated usingMcpServerfrom the MCP SDK and connected viaStdioServerTransport.Tool Definitions:
add:
Defined with a Zod schema that accepts two numbers (aandb) and returns their sum as text.getApiKey:
Retrieves the API key from the environment variableAPI_KEYand returns it as text.
What is MCP?
Model Context Protocol (MCP) provides a standardized approach to integrate custom tools into AI-assisted development environments. With MCP, you can define tools that perform specific tasks—such as retrieving external data, validating code, or enforcing coding standards—and the AI assistant in your IDE can call these tools automatically based on context. This helps improve developer productivity, ensures consistent quality, and streamlines workflows.
References & Resources
License
This project is licensed under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceA simple and extendable MCP server that currently provides basic addition functionality and can be easily extended by defining new tools with docstrings.4
- Alicense-qualityDmaintenanceA minimal, production-ready MCP server with a simple addition calculator tool that demonstrates integration with the Model Context Protocol.81MIT
- Alicense-qualityDmaintenanceA template/boilerplate MCP server for building custom tools and integrations that enable seamless connections between AI applications and external data sources.270MIT
- AlicenseBqualityDmaintenanceA learning-focused MCP server that demonstrates how to build arithmetic tools for AI assistants, currently featuring addition functionality with structured input/output.16MIT
Related MCP Connectors
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
A basic MCP server to operate on the Postman API.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Potato-29/trello-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server