mcp-starter-kit
A production-ready foundation for building secure, observable MCP servers with built-in authentication, rate limiting, and reference tools like database-query and semantic-search.
README
Production-Ready MCP Server Boilerplate
Ship reliable MCP servers in minutes, not days. A production-ready foundation for building Model Context Protocol servers with built-in security, authentication, and observability.
[!NOTE] This is a starter template — not a finished product. You are responsible for reviewing and securing any code before production use.
Don't build from scratch. This kit solves the "boring" parts of MCP server development—transport management, error handling, and security boundaries—so you can focus on your tool's logic.
Works with Claude Code, Cursor, Windsurf, and any MCP-compatible client.
🚀 Why this boilerplate?
Most MCP tutorials show you a "toy" server. This repo gives you a production-grade foundation.
🛡️ Secure by Design
- SSRF Protection: Blocks requests to private/internal networks (IPv4 + IPv6), including cloud metadata endpoints (
169.254.169.254). DNS resolution is checked to prevent rebinding. - JWT Security: Algorithm validation rejects
alg:none, HS384, and RS256 downgrade attacks. Expiry and tampering are verified with constant-time comparison. - HMAC-SHA256 Webhook Signatures: Outbound webhooks are signed with
X-Webhook-Signaturewhen a secret is configured. - DNS Rebinding Protection: HTTP transport validates
Hostheader against an allowlist. - Sandboxed File Access: Prevents AI from reading/writing outside allowed directories, with symlink escape detection.
- Strict Input Validation: All tool inputs are validated with Zod schemas.
- Injection Protection: SQLite queries use strict parameter binding.
- Security tested: 30+ security-focused test cases covering OWASP top threats (SSRF, injection, path traversal, auth bypass).
🔌 Built for Real Projects
- Authentication: Built-in strategies for API Key and JWT (configurable per env).
- Rate Limiting: Token bucket algorithm to prevent abuse.
- Observability: Structured JSON logging (via
pino) ready for CloudWatch/Datadog.
⚡ Developer Experience (DX)
- Type-Safe:
strict: trueTypeScript configuration, ESM, fully typed. - Testing: 228 tests (unit, integration, and E2E) with Vitest, including 30+ security-focused cases.
- Dockerized: Multi-stage Dockerfile for immediate deployment.
📦 What's Included
| Feature | This Boilerplate | Basic Tutorials |
|---|---|---|
| Transport | HTTP (SSE) + Stdio | Stdio only |
| Validation | Zod Schemas | Manual / None |
| Logging | Structured JSON | console.log |
| Error Handling | Graceful + MCP Codes | Process crash |
| CI/CD | GitHub Actions | None |
Reference Implementations
Includes 6 fully-typed tools to copy-paste patterns from:
database-query: Secure SQLite operations.api-connector: Fetch data from external REST APIs.file-manager: Safe file system operations (5 sub-tools).cache-store: TTL-based key-value cache with namespaces (5 sub-tools).semantic-search: Local RAG with embeddings (3 tools + 2 resources + 1 prompt).webhook-notifier: Async webhook delivery with task tracking (4 tools + 2 resources + 1 prompt).
🏁 Quick Start
Prerequisites
- Node.js 22+
WSL2 users: Use Node.js installed inside WSL, not Windows. See Troubleshooting.
- npm 9+
1. Setup
git clone <your-repo-url> my-mcp-server
cd my-mcp-server
npm install
2. Configure Environment
cp .env.example .env
# Edit .env if needed — defaults work out of the box
3. Seed Sample Database
npm run db:seed # Populates local SQLite for testing
Note: If the server is already running, restart it after seeding to pick up the new database.
4. Build
npm run build # Compiles TypeScript to dist/
5. Run Development Server
npm run dev
# Starts server in hot-reload mode
6. Verify with Inspector
npm run inspector
# Opens interactive debugger in your browser (uses dist/index.js)
🔧 Connecting to Clients
Claude Code
Copy the example config to your project root:
cp .mcp.json.example .mcp.json
# Edit paths in .mcp.json to match your setup
Or add manually to your .mcp.json:
{
"mcpServers": {
"mcp-starter-kit": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"LOG_LEVEL": "info",
"DB_PATH": "./data/sample.db",
"SANDBOX_ROOT": "./data/sandbox"
}
}
}
}
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"my-production-server": {
"command": "node",
"args": ["/absolute/path/to/my-mcp-server/dist/index.js"]
}
}
}
Cursor, Windsurf, & Others
See docs/SETUP.md for detailed connection guides.
📂 Project Architecture
Designed for scalability:
mcp-starter-kit/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # Central MCP registry
│ ├── config/env.ts # Environment variable validation (Zod)
│ ├── tools/
│ │ ├── database-query/ # SQLite CRUD tool
│ │ ├── api-connector/ # REST API tool
│ │ ├── file-manager/ # Sandboxed file operations tool
│ │ ├── cache-store/ # TTL-based key-value cache
│ │ ├── semantic-search/ # Local RAG with embeddings
│ │ └── webhook-notifier/ # Async webhook delivery
│ ├── lib/ # Shared utilities (Logger, Guardrails)
│ ├── middleware/ # Auth & rate limiting
│ └── transport/ # stdio and HTTP transports
├── tests/ # Integration tests & helpers
├── scripts/ # CLI tools (db:seed, create-tool)
├── docs/ # Detailed documentation
├── docker/ # Dockerfile & docker-compose
└── data/ # Sample DB & sandbox directory
📜 Documentation
| Document | Description |
|---|---|
| SETUP.md | Detailed setup, environment variables, client configuration |
| CUSTOMIZATION.md | Step-by-step guide to creating new tools |
| DEPLOYMENT.md | Deploy via npm, Docker, or cloud services |
| ARCHITECTURE.md | Design decisions, security model, and data flow |
| TROUBLESHOOTING.md | Common errors and solutions |
| TESTING.md | Test suite organization, writing tests, security checklist |
| SECURITY.md | Security policy, vulnerability reporting, feature inventory |
🛠️ Scripts
| Command | Description |
|---|---|
npm run dev |
Start with hot-reload (tsx watch) |
npm run build |
Build to dist/ (tsup) |
npm start |
Run built server (stdio) |
npm run start:http |
Run built server (HTTP) |
npm test |
Run all tests |
npm run lint |
Lint with ESLint |
npm run typecheck |
Type-check with tsc |
npm run inspector |
Open MCP Inspector |
npm run db:seed |
Seed sample SQLite database |
npm run create-tool |
Scaffold a new tool |
npm run test:coverage |
Run tests with coverage report |
License
MIT © 2026 Edge Craft Studio
Not affiliated with, endorsed by, or certified by Anthropic or the Agentic AI Foundation.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。