MCP Server Starter Kit
A production-ready boilerplate for building MCP servers, featuring TypeScript, Zod validation, rate limiting, and example tools like echo and fetch_url, enabling quick setup of custom MCP servers.
README
š MCP Server Starter Kit
Production-ready Model Context Protocol (MCP) server boilerplate.
Ship your first MCP server in minutes, not days.
š Premium edition with Python (FastMCP) version, Railway/Render deploy configs, auth patterns, and 1-on-1 setup support ā Get it on Gumroad ā
What's included
| Feature | Status |
|---|---|
| TypeScript with strict mode | ā |
| Proper stderr logging (won't break MCP stdio) | ā |
| Token-bucket rate limiter | ā |
| Environment variable validation (Zod) | ā |
| Centralized error handling | ā |
| 2 example tools (echo + fetch_url) | ā |
| Docker + docker-compose | ā |
| Claude Desktop auto-config script | ā |
| Unit test setup (Vitest) | ā |
| Python/FastMCP version | š Premium |
| Railway one-click deploy | š Premium |
| API key auth middleware | š Premium |
| OAuth 2.0 integration pattern | š Premium |
| Webhook receiver tool | š Premium |
| Database connection pattern | š Premium |
Why this starter kit?
Every MCP server tutorial shows you a 30-line "hello world." Then you try to build something real and discover:
- Logging to stdout breaks MCP ā the protocol uses stdout for communication; your
console.logcorrupts it - No rate limiting ā a runaway AI agent can hammer your APIs
- No input validation ā AI can send malformed arguments and crash your server
- No error handling ā unhandled exceptions crash the whole server
- No deploy story ā how do you actually run this in production?
This starter kit solves all of that from day one.
Quick start
Option 1: Use as a template
# Clone and rename
git clone https://github.com/srmcguirt/mcp-server-starter-kit my-mcp-server
cd my-mcp-server
# Install dependencies
npm install
# Copy env file and fill in your values
cp .env.example .env
# Start in dev mode (hot reload)
npm run dev
Option 2: Scaffold with npx
npx @wireforge/mcp-server-starter init my-server-name
cd my-server-name
npm install && npm run dev
Option 3: Install as a library
npm install @wireforge/mcp-server-starter
Add your first tool
Open src/tools/ and create a new file:
// src/tools/my-tool.ts
import { z } from 'zod';
import { toolResult } from '../lib/error-handler.js';
import type { MCPTool } from '../types.js';
const MyInputSchema = z.object({
query: z.string().min(1).max(500),
limit: z.number().int().positive().max(100).default(10),
});
export const myTool: MCPTool = {
name: 'my_tool',
description: 'Search for something and return results. Be specific about what this does ā the AI reads this description.',
inputSchema: {
type: 'object',
properties: {
query: { type: 'string', description: 'The search query' },
limit: { type: 'number', description: 'Max results to return', default: 10 },
},
required: ['query'],
},
async execute(args) {
const { query, limit } = MyInputSchema.parse(args);
// Your implementation here
const results = await myApi.search(query, { limit });
return toolResult(JSON.stringify(results, null, 2));
},
};
Then register it in src/tools/index.ts:
import { myTool } from './my-tool.js';
export const tools: MCPTool[] = [
echoTool,
fetchUrlTool,
myTool, // š Add here
];
Connect to Claude Desktop
# Build and add to Claude Desktop config automatically
chmod +x scripts/add-to-claude.sh
./scripts/add-to-claude.sh my-server-name
# Then restart Claude Desktop
Or manually add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"my-server-name": {
"command": "node",
"args": ["/absolute/path/to/my-mcp-server/dist/index.js"],
"env": {
"MY_API_KEY": "your-key-here"
}
}
}
}
Connect to Cursor / Cline / Windsurf
Add to your editor's MCP settings:
{
"mcp": {
"servers": {
"my-server-name": {
"command": "node",
"args": ["/absolute/path/to/my-mcp-server/dist/index.js"]
}
}
}
}
Deploy with Docker
# Build and run with docker-compose
cd docker && docker-compose up --build
# Or build manually
docker build -f docker/Dockerfile -t my-mcp-server .
docker run -it --env-file .env my-mcp-server
Project structure
mcp-server-starter/
āāā src/
ā āāā index.ts # Server entry point ā wire everything together here
ā āāā types.ts # MCPTool interface and shared types
ā āāā lib/
ā ā āāā logger.ts # Winston logger ā always logs to stderr
ā ā āāā rate-limiter.ts # Token-bucket rate limiter
ā ā āāā env.ts # Environment variable validation (Zod)
ā ā āāā error-handler.ts # Centralized error handling + toolResult helpers
ā āāā tools/
ā āāā index.ts # Tool registry ā add your tools here
ā āāā echo.ts # Example: simple string echo
ā āāā fetch-url.ts # Example: HTTP fetch with timeout + size limit
āāā docker/
ā āāā Dockerfile # Multi-stage production build
ā āāā docker-compose.yml # Local development + production compose
āāā scripts/
ā āāā add-to-claude.sh # Auto-add to Claude Desktop config
āāā .env.example # Required environment variables
āāā tsconfig.json # Strict TypeScript config
āāā package.json
Key patterns
ā Always log to stderr
// ā WRONG ā corrupts MCP protocol
console.log('something happened');
// ā
CORRECT ā logs to stderr, leaves stdout clean
logger.info('something happened');
ā Validate all input with Zod
// ā WRONG ā trusting AI-provided args
const { query } = args as { query: string };
// ā
CORRECT ā parse and validate
const { query } = MySchema.parse(args); // throws McpError on invalid input
ā Use withErrorHandling for every tool
// ā WRONG ā unhandled exceptions crash the server
async execute(args) {
return await riskyOperation(args);
}
// ā
CORRECT ā errors logged + safe message returned to AI
return withErrorHandling('my_tool', () => riskyOperation(args));
š Premium Edition ā $49
The open source version is a solid foundation. The Gumroad premium download adds:
- ā Python/FastMCP version (same patterns, same quality)
- ā API key authentication middleware
- ā OAuth 2.0 integration pattern (GitHub, Google, etc.)
- ā Railway + Render one-click deploy configs
- ā Database connection patterns (Postgres, SQLite, Redis)
- ā Webhook receiver tool template
- ā Streaming responses pattern
- ā MCP resources and prompts examples
- ā 30-min video walkthrough: building a real production MCP server
- ā 6 real-world example servers (GitHub, Notion, Slack, Postgres, filesystem, web search)
- ā Commercial license (use in client work and products)
FAQ
Q: Why TypeScript and not JavaScript?
A: MCP tool schemas need to match your implementation exactly. TypeScript catches mismatches at build time, not at 2am when an AI passes unexpected input.
Q: Why log to stderr?
A: MCP uses stdio transport ā stdout carries the JSON-RPC protocol. Anything you write to stdout that isn't valid MCP JSON will corrupt the connection. The logger in this kit always writes to stderr.
Q: Can I use this with Python?
A: The Python/FastMCP version is in the premium edition. The patterns are identical ā just in Python.
Q: Is this compatible with all MCP clients?
A: Yes. Uses the official @modelcontextprotocol/sdk. Tested with Claude Desktop, Cursor, Cline, and Windsurf.
Contributing
PRs welcome. See CONTRIBUTING.md.
License
MIT ā free for personal and open source use.
Commercial license (client work, products, resale) included in the Premium Edition on Gumroad.
š¬ Stay Updated
Get a free sample prompt + updates when new tools ship:
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.