mcp-kit: Universal MCP Toolkit
Universal MCP (Model Context Protocol) toolkit for building servers across all JavaScript runtimes — Node.js, Bun, Cloudflare Workers, and edge platforms.
The Problem
Building Model Context Protocol (MCP) servers today means choosing a runtime and getting locked in. Node.js servers don’t run on edge. Edge workers can’t do filesystem operations. Developers end up maintaining separate codebases for different deployment targets.
The Solution
mcp-kit provides a single codebase that runs across all JavaScript runtimes — Node.js, Bun, Cloudflare Workers, Vercel Edge, and Netlify Edge. Built on the ultra-fast Hono framework with automatic runtime detection and conditional feature loading.
Benchmark: Native Cold Start
| Platform | Deployment | Cold Start (Native) |
|---|---|---|
| Node.js | Local (M1 Pro) | 83ms |
| Bun | Local (M1 Pro) | 111ms |
mcp-kit leverages Hono’s lightweight middleware architecture. By unifying the tool handler logic, the kit maintains incredibly fast startup times regardless of whether it’s executing in Node’s CommonJS ecosystem or Bun’s native web server, making it portable across all architectures without performance penalties.
Reproduction: To verify the baseline startup latency of these runtimes on your own machine:
- Clone the Benchmark:
git clone https://gist.github.com/omar391/da94c3ea15f5dc31e136cb33dca51b4a mcp-bench cd mcp-bench - Execute the Script:
chmod +x mcp_bench.sh && ./mcp_bench.sh
Universal Runtime Abstraction
The core of mcp-kit is a runtime abstraction layer that detects the environment and swaps implementations for platform-specific capabilities (like fs vs. KV).
// Universal tool handler with runtime-aware capability detection
export const filesystemTool = defineTool({
name: "read_file",
handler: async (args, { runtime }) => {
if (runtime.hasFilesystem) {
return await runtime.fs.readFile(args.path);
}
// Transparently fall back to KV or S3 on edge
return await runtime.storage.get(args.path);
},
});
Key Features
- Universal Runtime Support: Single codebase for Node.js, Bun, Cloudflare Workers, Vercel Edge, Netlify Edge
- Hono Framework: Lightweight HTTP framework chosen for fast startup and cross-runtime portability
- Cross-Runtime Compatibility: Automatic runtime detection and conditional feature loading
- Type-Safe Tool Handlers: Strongly typed MCP tool definitions with validation
- Multi-Target Builds: Separate optimized builds for different runtime environments
- Multi-Instance Coordination: Version-aware upgrade flow for production deployments
Architecture
The toolkit separates universal features (available everywhere) from local features (Node.js/Bun only), ensuring that edge deployments never bundle unnecessary code while local deployments get full filesystem and process management capabilities.