Remote MCP Server on Cloudflare
@MarcoLuw
Overview
What is Remote MCP Server on Cloudflare?
A guide and starter project for deploying a remote MCP (Model Context Protocol) server on Cloudflare Workers with OAuth login. It is for developers who want to expose MCP tools over the internet and connect them to clients like Claude Desktop or the MCP Inspector.
How to use Remote MCP Server on Cloudflare?
Clone the repository, install dependencies with pnpm install, then run locally with npx nx dev remote-mcp-server. Deploy to Cloudflare using npx wrangler kv namespace create OAUTH_KV, add the namespace ID to wrangler.jsonc, and run npm run deploy. Connect clients by pointing them to the server’s SSE endpoint (e.g., http://localhost:8787/sse locally or your workers.dev URL).
Key features of Remote MCP Server on Cloudflare
- Local development with
npx nx dev remote-mcp-server - SSE transport for MCP communication
- OAuth login integration
- Deploy to Cloudflare Workers
- Connect to MCP Inspector for exploration
- Connect Claude Desktop using a remote proxy
Use cases of Remote MCP Server on Cloudflare
- Deploy a remote MCP server accessible from anywhere
- Integrate custom MCP tools with Claude Desktop
- Test and debug MCP tools using the MCP Inspector
- Expose a math tool or other custom tools over HTTPS
- Enable OAuth-protected access to MCP tools
FAQ from Remote MCP Server on Cloudflare
What transport does the server use?
The server uses SSE (Server-Sent Events) as the transport. In the MCP Inspector, set Transport Type to SSE and connect to an endpoint like http://localhost:8787/sse.
What are the dependencies to run the server locally?
You need Node.js and pnpm (not npm) installed. The repository is part of the cloudflare/ai monorepo, so you clone that and install dependencies with pnpm install.
How do I deploy the server to Cloudflare?
Create a KV namespace for OAuth with npx wrangler kv namespace create OAUTH_KV, add the resulting ID to your wrangler.jsonc file, then run npm run deploy. Your server will be available at a workers.dev URL.
How do I connect Claude Desktop to the remote server?
Edit the Claude Desktop configuration file and add an MCP server entry with command: "npx", args: ["mcp-remote", "https://your-worker-url/sse"]. Restart Claude; a browser window will open for OAuth login.
What authentication does the server use?
The server includes OAuth login. During development a mock login screen appears; when deployed, real OAuth flows through Cloudflare Workers. You must create an OAUTH_KV namespace to store session data.