Remote MCP Server on Cloudflare
@drdeeks
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, complete with OAuth login. It is designed for developers who want to run MCP tools remotely 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 npm install, then run locally with npx nx dev remote-mcp-server. To connect a client, use the SSE endpoint (e.g., http://localhost:8787/sse). Deploy to Cloudflare by creating a KV namespace (npx wrangler kv namespace create OAUTH_KV), adding its ID to wrangler.jsonc, and running npm run deploy. Configure Claude Desktop with the mcp-remote command and your deployed Worker’s /sse URL.
Key features of Remote MCP Server on Cloudflare
- Hosts MCP servers on Cloudflare Workers.
- Includes OAuth authentication for secure access.
- Uses SSE (Server‑Sent Events) transport.
- Supports local development with MCP Inspector.
- Integrates directly with Claude Desktop via
mcp-remote. - Deployable with a single command using Wrangler.
Use cases of Remote MCP Server on Cloudflare
- Running MCP tools as a remote, serverless endpoint.
- Connecting Claude Desktop to a cloud‑hosted MCP server.
- Testing and debugging MCP servers locally with the Inspector.
- Demonstrating OAuth‑protected MCP server deployment on Cloudflare.
FAQ from Remote MCP Server on Cloudflare
How do I deploy the server to Cloudflare?
Create a KV namespace (npx wrangler kv namespace create OAUTH_KV), add its ID to wrangler.jsonc, then run npm run deploy.
How can I connect Claude Desktop to my remote MCP server?
Update Claude’s config file to include a server entry with the mcp-remote command and your Worker’s https://worker-name.account-name.workers.dev/sse URL.
What transport does the MCP server use?
The server uses Server‑Sent Events (SSE). Clients connect via the /sse endpoint.
How do I debug connection issues?
Restart Claude, or test the connection directly with npx mcp-remote http://localhost:8787/sse. In rare cases, clear cached auth files with rm -rf ~/.mcp-auth.
What authentication does the server use?
The server uses OAuth login, backed by a Cloudflare KV namespace (named OAUTH_KV).