Remote MCP Server on Cloudflare
@irvinebroque
Overview
What is Remote MCP Server on Cloudflare?
A guide and starter code to deploy a remote MCP (Model Context Protocol) server on Cloudflare Workers with OAuth login, enabling secure connections from AI clients like Claude Desktop over HTTP/SSE.
How to use Remote MCP Server on Cloudflare?
Clone the repository, run npm install and npm run dev to start a local server on localhost:8787. For production, create a KV namespace with npx wrangler@latest kv namespace create, add the ID to wrangler.jsonc, then run npm run deploy. Connect MCP clients (Inspector, Claude Desktop) using the /sse endpoint of your local or deployed URL.
Key features of Remote MCP Server on Cloudflare
- Deploy MCP server on Cloudflare Workers
- OAuth-based authentication for access
- Local development with hot‑reload (npm run dev)
- Connect via MCP Inspector or Claude Desktop
- Remote accessibility via workers.dev URL
Use cases of Remote MCP Server on Cloudflare
- Host custom MCP tools for remote AI assistants
- Enable Claude Desktop to call private APIs with login
- Build, test, and deploy MCP servers with OAuth
FAQ from Remote MCP Server on Cloudflare
What is the difference between local and remote setup?
Local runs on localhost:8787 during development; remote deploys to a workers.dev URL accessible over the internet.
What dependencies or runtime are needed?
Node.js and npm for local development. For deployment, a Cloudflare account and the Wrangler CLI.
Where does authentication data live?
OAuth state is stored in a Cloudflare KV namespace you create with npx wrangler@latest kv namespace create.
What transport protocol does this server use?
SSE (Server‑Sent Events) over HTTP, configured via the /sse endpoint of the server.
How can I debug connection problems?
Restart Claude or test directly with npx mcp-remote http://localhost:8787/sse. Clearing ~/.mcp-auth may also help in rare cases.