Remote MCP Server on Cloudflare
@jalenzz
Overview
What is Remote MCP Server on Cloudflare?
A template to quickly set up a remote MCP (Model Context Protocol) server on Cloudflare Workers, complete with OAuth login. It is intended for developers who want to expose MCP tools over the internet and connect them to clients like Claude Desktop.
How to use Remote MCP Server on Cloudflare?
Clone the repository, install dependencies with pnpm install, and run locally with npx nx dev remote-mcp-server. Connect via the MCP Inspector (SSE transport) or configure Claude Desktop using the mcp-remote proxy pointing to your local or deployed workers.dev URL.
Key features of Remote MCP Server on Cloudflare
- Local development with live reload via
nx dev - OAuth login flow for secure access
- SSE (Server-Sent Events) transport
- Deploy to Cloudflare Workers with
npm run deploy - Connect Claude Desktop via a local proxy
- Debugging with
npx mcp-remoteand auth file cleanup
Use cases of Remote MCP Server on Cloudflare
- Deploy a remote MCP server for testing with the MCP Inspector
- Connect Claude Desktop to a math‑tool MCP server running on Cloudflare
- Securely expose custom MCP tools behind OAuth authentication
FAQ from Remote MCP Server on Cloudflare
How do I develop the server locally?
Clone the repo, run pnpm install, then npx nx dev remote-mcp-server and open http://localhost:8787/ in your browser.
How do I connect the MCP Inspector to my server?
Start the Inspector with npx @modelcontextprotocol/inspector, set Transport Type to SSE, enter http://localhost:8787/sse (or your deployed URL), click Connect, and log in with any email/password on the mock login screen.
How do I connect Claude Desktop to the server?
Edit Claude Desktop’s configuration file to add an MCP server entry using npx mcp-remote with the SSE URL (local http://localhost:8787/sse or remote https://worker-name.account-name.workers.dev/sse). A browser window will open for OAuth login.
How do I deploy the server to Cloudflare?
Run npx wrangler kv namespace create OAUTH_KV, add the KV namespace ID to wrangler.jsonc, then run npm run deploy. Use the resulting workers.dev URL as the MCP server endpoint.
What should I do if something goes wrong?
Restart Claude, try connecting directly via npx mcp-remote http://localhost:8787/sse, or clear auth files with rm -rf ~/.mcp-auth.