Skip to main content
@phake/mcp is a TypeScript library for building Model Context Protocol (MCP) servers. It runs on Cloudflare Workers and Node.js, and gives you type-safe tool definitions, OAuth 2.1 authentication, and encrypted token storage out of the box.

Quick Start

Scaffold and deploy your first MCP server in minutes.

Define Tools

Create type-safe tools with Zod schemas and handler functions.

Authentication

Add OAuth, Bearer, API Key, or custom auth to your server.

API Reference

Full reference for createMCPServer, defineTool, and more.

Get started in 3 steps

1

Install the package

Add @phake/mcp to your project or scaffold a new one with a single command.
2

Define your tools

Use defineTool to create typed, validated tools backed by Zod schemas.
3

Create and export your server

Wrap your tools in createMCPServer and export the result as your Worker default.
Use the scaffold CLI to get a working project with your chosen template in seconds: bun create @phake/mcp my-app --template cloudflare-workers --install