Enterprise MCP Server Template
A production-ready TypeScript template for building Model Context Protocol (MCP) servers with Zod validation, structured logging, and seamless integration with AI agents like Claude Desktop and Cursor.
README
Enterprise MCP Server Template 🚀
A production-ready, enterprise-grade template for building Model Context Protocol (MCP) servers in TypeScript and Node.js. Designed for scalability, type safety, and seamless integration with AI agents like Claude Desktop and Cursor.
📖 About
The Model Context Protocol (MCP) standardizes how AI models interact with local and remote resources. This template provides a robust foundation for building your own custom MCP servers, eliminating boilerplate and enforcing best practices.
Key Features
- Strict TypeScript: Modern ECMAScript targets with rigorous type safety.
- Zod Validation: Runtime schema validation for tool inputs and environment variables, ensuring your server never crashes from malformed AI payloads.
- Fast Bundling (esbuild): Compiles the entire server into a single, optimized executable (
dist/index.js), eliminating the need to deploynode_modules. - Safe Structured Logging: Pre-configured
pinologger writing safely tostderr, preserving the integrity of thestdoutJSON-RPC transport required by MCP. - Modular Architecture: Clean separation of Tools, Resources, Prompts, and Services.
- Vitest Integration: Blazing fast unit testing out of the box.
🚀 Getting Started
1. Installation
Clone the repository and install dependencies:
git clone https://github.com/qmmughal/mcp-server-template.git
cd mcp-server-template
npm install
2. Configuration
Copy the example environment file and configure your variables:
cp .env.example .env
3. Development Workflow
Start the server in watch mode for local development:
npm run dev
Run the test suite:
npm test
Verify typings:
npm run typecheck
4. Production Build
Bundle the server into a single, optimized executable:
npm run build
The output will be generated at dist/index.js.
🔌 Connecting to an MCP Client
Claude Desktop
To connect this server to the Claude Desktop app, edit your Claude configuration file (usually found at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on Mac):
{
"mcpServers": {
"enterprise-template-server": {
"command": "node",
"args": ["/absolute/path/to/mcp-server-template/dist/index.js"],
"env": {
"LOG_LEVEL": "info",
"EXAMPLE_API_KEY": "your_api_key_here"
}
}
}
}
Cursor
In Cursor, navigate to Settings -> Features -> MCP and add a new MCP server:
- Type:
command - Command:
node /absolute/path/to/mcp-server-template/dist/index.js
🏗️ Architecture Overview
src/index.ts: Application entrypoint, capability registration, and stdio connection setup.src/tools/: Definitions and JSON schemas for MCP Tools (actions the AI can take).src/resources/: Dynamic resources via URI templating (data the AI can read).src/prompts/: Reusable agent prompt templates.src/services/: Core business logic, keeping protocol handlers thin and testable.src/utils/errors.ts: Standardized error handling aligned with MCP error codes.
📦 Publishing & Registry
package.json is publish-ready (scoped name @qmmughal/mcp-server-template, license, repository, keywords), and server.json + .github/workflows/publish-mcp.yml are wired up to publish to both npm and the MCP Registry automatically whenever a v* tag is pushed:
git tag v1.0.0
git push origin v1.0.0
The workflow needs one repo secret before it can run: NPM_TOKEN (an npm automation token with publish rights to the @qmmughal scope). MCP Registry auth uses GitHub OIDC, so no extra secret is needed there.
🤝 Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
📝 License
This project is MIT licensed.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。