One command to create a production-ready MCP Server ⚡
MCP (Model Context Protocol) is the standard for connecting AI assistants like Claude to external tools and data sources. This package provides:
- CLI - Scaffold a complete MCP Server project in seconds
- SDK - Ergonomic TypeScript API for building servers
# Create a new MCP server project
npx create-mcp-server my-server
# Or start from an example
npx create-mcp-server my-server --example calculator
cd my-server
npm install
npm run devThat's it! You now have a working MCP Server with:
- ✅ TypeScript setup
- ✅ Tool, resource, and prompt examples
- ✅ Build configuration
- ✅ Claude Desktop integration guide
npx create-mcp-server <project-name> [options]
Options:
--example <name> Start with an example (calculator, filesystem, weather, github, database)
-h, --help Show help
-v, --version Show version| Example | Description |
|---|---|
calculator |
Math operations (add, subtract, multiply, divide, power, sqrt) |
filesystem |
File operations (read, write, list, info, create, delete) |
weather |
Weather data via wttr.in (current, forecast) |
github |
GitHub API (repo info, issues, user data) |
database |
Database operations (query, insert, create table) |
The generated project uses @modelcontextprotocol/sdk directly. Here's the pattern:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({
name: "my-server",
version: "1.0.0",
});
// Register a tool
server.tool(
"greet",
"Greet someone by name",
{ name: z.string().describe("Name to greet") },
async ({ name }) => ({
content: [{ type: "text", text: `Hello, ${name}!` }],
})
);
// Register a resource
server.resource(
"config",
"config://app",
{ description: "Application config" },
async (uri) => ({
contents: [{ uri: uri.href, text: JSON.stringify({ version: "1.0.0" }) }],
})
);
// Register a prompt
server.prompt(
"help",
{ description: "Get help" },
async () => ({
messages: [{ role: "user", content: { type: "text", text: "How can I help?" } }],
})
);
// Start the server
const transport = new StdioServerTransport();
await server.connect(transport);Add your server to Claude Desktop's config:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/path/to/my-server/dist/index.js"]
}
}
}Restart Claude Desktop and your tools will be available!
my-server/
├── src/
│ └── index.ts # Server entry point
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
Tools let AI models invoke actions on your server:
server.tool(
"tool-name", // Unique identifier
"Description", // Human-readable description
{ // Input schema (Zod)
param: z.string(),
},
async (args) => { // Handler
return {
content: [{ type: "text", text: "result" }],
};
}
);Resources expose read-only data:
server.resource(
"resource-name",
"resource://uri", // URI pattern
{ description: "..." },
async (uri) => ({
contents: [{ uri: uri.href, text: "data" }],
})
);Prompts are reusable templates:
server.prompt(
"prompt-name",
{ description: "..." },
async () => ({
messages: [
{ role: "user", content: { type: "text", text: "..." } },
],
})
);- Zero config - Works out of the box
- Type-safe - Full TypeScript support with Zod schemas
- Production-ready - Proper build setup, error handling, docs
- Examples - Real-world examples to learn from
- Minimal deps - Only
@modelcontextprotocol/sdkandzod
| Feature | create-mcp-server | Manual Setup |
|---|---|---|
| Time to first tool | ~30 seconds | ~30 minutes |
| TypeScript config | ✅ Included | Manual |
| Build setup | ✅ Included | Manual |
| Examples | ✅ 5 examples | None |
| Claude Desktop guide | ✅ Included | Find yourself |
Contributions welcome! See GitHub.
MIT © Mike Wang