Remote MCP Server on Cloudflare
@shannon-morahan
Overview
What is Remote MCP Server on Cloudflare?
Remote MCP Server on Cloudflare is a template for deploying a Model Context Protocol (MCP) server on Cloudflare Workers with OAuth login. It enables developers to quickly set up a remote MCP server that can be accessed by MCP clients like Claude Desktop or the MCP Inspector.
How to use Remote MCP Server on Cloudflare?
Clone the repository (git clone [email protected]:cloudflare/ai.git), install dependencies (npm install), and run locally (npx nx dev remote-mcp-server). Deploy to Cloudflare by creating a KV namespace (npx wrangler kv namespace create OAUTH_KV), adding its ID to wrangler.jsonc, then running npm run deploy. Connect via the MCP Inspector using SSE at http://localhost:8787/sse (or your deployed workers.dev URL) or configure Claude Desktop with npx mcp-remote as a proxy.
Key features of Remote MCP Server on Cloudflare
- Runs on Cloudflare Workers with OAuth login
- Supports local development and deployment
- Connects to MCP Inspector via SSE transport
- Works with Claude Desktop through a remote proxy
- Includes a mock login screen for local testing
Use cases of Remote MCP Server on Cloudflare
- Deploy a remote MCP server for AI assistants like Claude
- Test and debug MCP tools locally with the MCP Inspector
- Host a production-ready MCP server on Cloudflare’s edge network
- Integrate OAuth‑protected MCP endpoints into custom workflows
FAQ from Remote MCP Server on Cloudflare
What dependencies are required to run this server?
Node.js, npm, and npx are needed for local development. Deployment requires a Cloudflare Workers account and the Wrangler CLI (npx wrangler).
How do I connect to the server using the MCP Inspector?
Run npx @modelcontextprotocol/inspector, switch Transport Type to SSE, enter your server’s SSE endpoint (e.g., http://localhost:8787/sse locally or your workers.dev URL), and click Connect. You will be prompted to log in.
How do I connect Claude Desktop to the server?
Edit your Claude Desktop config (Settings > Developer > Edit Config) and add an mcpServers entry with "command": "npx" and "args": ["mcp-remote", "http://localhost:8787/sse"] (or your deployed URL). Restart Claude to see the tools.
Where does authentication data (OAuth tokens) live?
OAuth tokens are stored in a Cloudflare KV namespace called OAUTH_KV, which is created during deployment (npx wrangler kv namespace create OAUTH_KV).
What transport protocol does this server use?
The server uses Server‑Sent Events (SSE) as its transport protocol.