mcp-template
A comprehensive Model Context Protocol (MCP) server template for Node.js with TypeScript, supporting both stdio and SSE transports
claude mcp add --transport stdio pshaddel-mcp-template node --env-file=/path/to/your/project/.env /path/to/your/project/build/main.js
How to use
The MCP Template server provides a Node.js-based implementation of the Model Context Protocol with TypeScript support. It supports multiple transport modes including stdio, SSE (Server-Sent Events), and HTTP streams, enabling flexible integration with desktop clients, automation tools, and web services. The template includes an authentication mechanism and a sample weather tool to illustrate how tools are implemented, validated, and exposed through the MCP interface. To get started, configure your environment with a .env file, install dependencies, and run the server in your preferred transport mode. You can then use tools like the MCP Inspector to test tool schemas, or integrate with Claude Desktop or n8n via the provided integration guides in the README.
How to install
Prerequisites:
- Node.js 18+ installed on your system
- npm or pnpm for package management
Installation steps:
-
Clone the repository: git clone https://github.com/pshaddel/mcp-template.git cd mcp-template
-
Install dependencies: npm install
or
pnpm install
-
Build the project (TypeScript to JavaScript): npm run build
-
Create and configure a .env file based on the sample provided in the repository (cp .sample.env .env)
-
Run the server in your chosen transport mode (examples):
- STDIO (default for Claude Desktop): npm run start:stdio or npm start
- SSE: MODE=sse npm run start
- HTTP streams: MODE=http-streams API_KEYS=your_key APP_PORT=3000 npm run start
-
Optional: Run the MCP Inspector to test tools during development: npx @modelcontextprotocol/inspector
Note: Ensure that your environment variables (MODE, API_KEYS, APP_PORT) are set correctly for your target mode before starting the server.
Additional notes
Tips and notes:
- The server supports multiple transport modes; choose stdio for local development, SSE for server-sent events over HTTP, or HTTP streams for full stream-based MCP communication.
- In HTTP streams mode, use the x-api-key header for authentication and manage sessions with mcp-session-id as documented in the README.
- The provided Claude Desktop and n8n integration sections in the README show example configurations; adapt paths and URLs to your environment.
- If you modify TypeScript source, ensure you rebuild with npm run build before running the server.
- The MCP Inspector is a useful debugging tool to visually inspect tool schemas and test interactions during development.
Related MCP Servers
ls
List MCP Server configurations in your system used by AI applications like Cursor, Claude Desktop, VS Code and others
deploystack
Open source MCP hosting - deploy MCP servers to HTTP endpoints for n8n, Dify, Voiceflow, and any MCP client.
dx-toolkit
Open-source toolkit enabling developers to integrate You.com's AI capabilities into their workflows
mcp-install-instructions-generator
Generate MCP Server Installation Instructions for Cursor, Visual Studio Code, Claude Code, Claude Desktop, Windsurf, ChatGPT, Gemini CLI and more
mongo
MCP server that provide tools to LLMs such as claude in cursor to interact with MongoDB
mcp-privilege-cloud
A production-ready Model Context Protocol (MCP) server for CyberArk Privilege Cloud integration. Enables AI assistants and MCP clients to securely interact with privileged account management, safe operations, and platform configurations through 8 comprehensive tools.