Skip to main content
@phake/mcp is a TypeScript library for building Model Context Protocol (MCP) servers. MCP lets AI clients like Claude, Cursor, and VS Code discover and call tools exposed by your server. @phake/mcp handles the protocol, authentication, and runtime wiring so you can focus on defining tools. The library runs on both Cloudflare Workers and Node.js, and ships with built-in OAuth 2.1, Bearer, API key, and custom auth strategies — along with encrypted token storage backed by Cloudflare KV or SQLite.

Key features

Type-safe tools

Define tools with Zod schemas for inputs and outputs. The library validates requests automatically and infers TypeScript types for your handlers.

Multiple runtimes

Deploy to Cloudflare Workers or run on Node.js with Hono. A single tool definition works across both runtimes without changes.

Auth strategies

Choose from OAuth 2.1 PKCE, Bearer token, API key, custom headers, or no auth. Strategy is auto-inferred from the environment variables you set.

Storage backends

Store tokens and sessions in Cloudflare KV (with AES-256-GCM encryption), in-memory with LRU eviction, or SQLite via Drizzle ORM.

Supported runtimes

RuntimePackage exportStatus
Cloudflare Workers@phake/mcp/runtime/workerStable
Node.js (Hono)@phake/mcp/runtime/nodeExperimental

Next steps

Quick start

Scaffold a project with one command or follow the manual setup path.

Installation

Install the package and review peer dependency requirements.