Remote MCP Server on Cloudflare
@wertpoiu
Overview
What is Remote MCP Server on Cloudflare?
Remote MCP Server on Cloudflare is a reference implementation for deploying a Model Context Protocol (MCP) server on Cloudflare Workers with OAuth login. It enables developers to run a remote MCP server that supports SSE transport and can be connected to MCP clients like Claude Desktop.
How to use Remote MCP Server on Cloudflare?
Clone the repository, install dependencies with npm install, and run locally with npx nx dev remote-mcp-server. Deploy by setting up a KV namespace via npx wrangler kv namespace create OAUTH_KV, adding its ID to wrangler.jsonc, and running npm run deploy. Connect MCP clients using the MCP Inspector or by configuring Claude Desktop with the mcp-remote proxy pointing to your server’s /sse endpoint.
Key features of Remote MCP Server on Cloudflare
- Runs on Cloudflare Workers with OAuth login
- Supports SSE (Server-Sent Events) transport
- Includes a local development server at
localhost:8787 - Connects to the MCP Inspector for testing
- Integrates with Claude Desktop via a remote proxy
- Deployable with a single command after KV setup
Use cases of Remote MCP Server on Cloudflare
- Deploy an MCP server on Cloudflare for remote access
- Test MCP tool calls locally using the MCP Inspector
- Connect Claude Desktop to a cloud‑hosted MCP server
- Enable OAuth‑protected MCP endpoints for production use
- Prototype and iterate on MCP tool definitions rapidly
FAQ from Remote MCP Server on Cloudflare
What is the purpose of this project?
It provides a ready‑to‑deploy remote MCP server on Cloudflare Workers with built‑in OAuth, allowing you to experiment with and use MCP tools from remote clients.
What are the dependencies and runtime requirements?
You need Node.js, npm, a Cloudflare account, and the Wrangler CLI. The server runs on Cloudflare Workers and uses a KV namespace for OAuth state.
How do I connect Claude Desktop to the server?
Update your Claude Desktop config with the mcp-remote command, pointing to your server’s /sse URL (e.g., https://worker-name.account-name.workers.dev/sse). A browser login window will open on startup.
How can I debug connection issues?
Restart Claude Desktop or test the server directly with npx mcp-remote http://localhost:8787/sse. In rare cases, clear ~/.mcp-auth with rm -rf ~/.mcp-auth.
Where does OAuth data live?
OAuth state is stored in the Cloudflare KV namespace you create during deployment (named OAUTH_KV). No user data is persisted on the local machine beyond cached auth tokens in ~/.mcp-auth.