home / mcp / mcp boilerplate server
NodeJS MCP Server Boilerplate
Configuration
View docs{
"mcpServers": {
"cds-id-mcp-server-boilerplate": {
"url": "http://localhost:3000/mcp",
"headers": {
"PORT": "3000 or port from .env",
"NODE_ENV": "development or production",
"OAUTH_SETTINGS": "YOUR_OAUTH_CONFIG"
}
}
}
}You set up a Model Context Protocol (MCP) server to provide context and actions for language models in a standardized way. This server supports HTTP transport and a local stdio mode, making it suitable for both networked clients and command-line tool integrations. It comes with sample resources, tools, prompts, and a TypeScript-based Express implementation to help you get started quickly.
You interact with the MCP server through a client that speaks the MCP protocol. Use the HTTP endpoint to access the server from applications over the network, or run in stdio mode to connect directly from command-line tools. With the provided resources, tools, and prompts, you can expose static information, generate dynamic greetings, perform calculations, and analyze data. Your client will request resources, invoke tools, and run prompts to compose context for LLM interactions.
Prerequisites: ensure you have Node.js 18 or later and npm or yarn installed.
# Install dependencies for the MCP server
npm install
# Build the TypeScript source (if you use the HTTP server path)
npm run build
# Start the HTTP MCP server (default http transport)
npm startHTTP server mode uses the standard web-based MCP transport. The server will be reachable at the configured port and path.
Stdio mode lets you run MCP commands and resources directly from the command line without an HTTP layer.
Environment variables influence how the server runs. Common variables include the port, environment, and optional OAuth settings. Create a local environment file to customize these values for your deployment.
Use HTTP mode when your applications are networked or when you want to expose MCP endpoints to other services. Use stdio mode when you want tight integration with CLI tools or automated scripts that interact directly with MCP endpoints without exposing a network interface.
Calculator tool that performs add, subtract, multiply, and divide operations with inputs a and b and an operation type
Tool that returns the current timestamp in various formats