loading…
Search for a command to run...
loading…
Zero-boilerplate, lightweight and fast MCP server toolkit. Skip the weight of `@modelcontextprotocol/sdk` and start shipping MCP servers in minutes with minimal
Zero-boilerplate, lightweight and fast MCP server toolkit. Skip the weight of `@modelcontextprotocol/sdk` and start shipping MCP servers in minutes with minimal code.
Zero-boilerplate HTTP MCP server toolkit. Skip the weight of
@modelcontextprotocol/sdkand start shipping MCP tools in minutes.
The official @modelcontextprotocol/sdk ships with significant overhead—both in dependencies and performance—while implementing features most developers never use and missing critical conveniences. Zero MCP takes the opposite approach: minimal dependencies, faster cold starts, and ergonomics that get you shipping in minutes.
What's wrong with the official SDK?
node:httpWhat Zero MCP delivers instead:
zod and zod-to-json-schema; nothing else pollutes your node_modulesnode:http server with zero middleware overhead; ideal for serverless and edge runtimesMcpServer, register tools, call start()—no Express config or transport plumbingChoose the official SDK if you need the full MCP spec (stdio transports, prompts API, auth flows). Choose Zero MCP when you want a fast, lean tool server without the baggage.
npm install zero-mcp zod
zero-mcp re-exports z, but keeping an explicit zod dependency avoids bundler surprises.
import { McpServer, type ToolDefinition, z } from 'zero-mcp';
const server = new McpServer({
name: 'calculator',
version: '1.0.0',
});
server.tool({
name: 'add',
description: 'Simple addition tool.',
schema: z.object({
a: z.number().describe('First addend'),
b: z.number().describe('Second addend'),
}),
handler: async ({ a, b }) => {
return [
{
type: 'text',
text: `The sum of ${a} and ${b} is ${a + b}.`,
},
];
},
});
await server.start({
host: '127.0.0.1',
port: 3000,
path: '/mcp',
});
console.log('Ready on http://127.0.0.1:3000/mcp');
// Later: await server.stop();
The server spins up a native HTTP listener and responds to MCP JSON-RPC calls at /mcp.
Zero MCP validates the Origin header and emits CORS headers recommended by the MCP HTTP transport guidance. By default, allowedOrigins is set to '*', which is convenient for local tooling. For production, pass an explicit allow-list:
await server.start({
allowedOrigins: ['https://my-mcp-console.example'],
});
Instrument behaviour by providing hooks either at construction time or when starting the server:
const server = new McpServer({
name: 'instrumented',
version: '1.2.0',
hooks: {
onClientConnected(name, version, protocolVersion) {
console.log(`[connect] ${name}@${version} via ${protocolVersion}`);
},
onToolRegistered(toolName) {
console.log(`[register] ${toolName}`);
},
onToolCallStarted(toolName, input) {
console.log(`[call:start] ${toolName}`, input);
},
onToolCallFinished(toolName, input, result, elapsedMs) {
console.log(`[call:finish] ${toolName} in ${elapsedMs.toFixed(1)}ms`);
},
onToolCallError(toolName, input, error) {
console.error(`[call:error] ${toolName}`, error);
},
onToolsListRequested() {
console.log('[tools] list requested');
},
onServerError(error) {
console.error('[server:error]', error);
},
},
});
A runnable weather server lives in example/. Run it locally with:
npm run example
This builds the library, compiles the example, and starts listening on http://localhost:3005/mcp.
MIT © Sergii Vashchyshchuk
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"zero-mcp": {
"command": "npx",
"args": [
"-y",
"zero-mcp"
]
}
}
}