Remote MCP Server on Cloudflare
@admin-amaravati-io
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 lets you run a remote MCP server that clients like Claude Desktop or the MCP Inspector can connect to over SSE.
How to use Remote MCP Server on Cloudflare?
Clone the repository, install dependencies, and run locally with npx nx dev remote-mcp-server. To deploy, create a KV namespace with 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.
Key features of Remote MCP Server on Cloudflare
- Runs on Cloudflare Workers with OAuth authentication
- Supports local development with hot-reload via Nx
- Deployable to a public workers.dev URL
- Uses SSE (Server-Sent Events) transport for MCP
- Works with MCP Inspector and Claude Desktop
Use cases of Remote MCP Server on Cloudflare
- Run your own remote MCP server on Cloudflare’s edge network
- Connect Claude Desktop to a remotely hosted MCP server with OAuth login
- Test and debug MCP tools locally before deploying
- Provide a secure, authenticated MCP endpoint for other clients
FAQ from Remote MCP Server on Cloudflare
What do I need to run the server locally?
You need Node.js and npm installed. Clone the repository, run npm install, then npx nx dev remote-mcp-server. The server will be available at http://localhost:8787/.
How do I deploy to Cloudflare?
First create a KV namespace: npx wrangler kv namespace create OAUTH_KV. Add the returned namespace ID to wrangler.jsonc. Then run npm run deploy. Your server will be live at <worker-name>.<account>.workers.dev/sse.
How do I connect Claude Desktop to a remote MCP server?
Edit Claude Desktop’s config file (Settings > Developer > Edit Config) and add an entry using mcp-remote pointing to your server’s SSE URL, e.g., "command": "npx", "args": ["mcp-remote", "https://worker-name.account.workers.dev/sse"]. Restart Claude Desktop and log in when prompted.
What transport and authentication does the server use?
The server uses SSE (Server-Sent Events) for MCP transport and OAuth for authentication. Clients connect to the /sse endpoint and are redirected to a login screen.
How can I debug connection issues?
Try connecting directly with npx mcp-remote http://localhost:8787/sse (local) or the workers.dev URL. If persistent issues occur, clear the local auth cache with rm -rf ~/.mcp-auth and restart Claude.