The Node.js runtime adapter is experimental. APIs may change between releases.
Manual setup
Install dependencies
Install
@phake/mcp along with its peer dependencies for the Node.js runtime:- npm
- bun
Define your tools
Use Tool definitions are runtime-agnostic — the same
defineTool from @phake/mcp to create type-safe tools with Zod schemas:src/tools/greet.ts
defineTool call works on both Cloudflare Workers and Node.js.Configure environment variables
Create a For production, add your auth strategy variables and
.env file in your project root for local development:.env
RS_TOKENS_ENC_KEY. See the environment variables reference for the full list.Node.js runtime exports
The@phake/mcp/runtime/node package exports the following for use in Node.js projects:
| Export | Description |
|---|---|
buildServer(options) | Creates an McpServer instance from the MCP SDK |
FileTokenStore | File-backed token store (experimental) |
SqliteSessionStore | SQLite-backed session store via Drizzle ORM (experimental) |
The
node-hono scaffold template wires up the Hono HTTP layer, auth middleware, MCP transport, and tool registration automatically. It is the recommended starting point for Node.js deployments.