Remote MCP Server on Cloudflare
@BrainSAIT-LTD
Overview
What is Remote MCP Server on Cloudflare?
It is a template for deploying a remote MCP (Model Context Protocol) server on Cloudflare Workers, complete with OAuth login. It is intended for developers who want to run MCP tools hosted remotely and connect them to clients like the MCP Inspector or Claude Desktop.
How to use Remote MCP Server on Cloudflare?
Clone the repository, install dependencies with npm install, and run locally with npx nx dev remote-mcp-server. Deploy to Cloudflare by creating an KV namespace with npx wrangler kv namespace create OAUTH_KV, adding the namespace ID to wrangler.jsonc, and running npm run deploy. Connect clients by pointing them to the server’s /sse endpoint.
Key features of Remote MCP Server on Cloudflare
- Deploy MCP tools as a Cloudflare Worker
- OAuth-based login for secure access
- Uses SSE (Server-Sent Events) transport
- Works with MCP Inspector for testing
- Connects to Claude Desktop via a local proxy
- Supports both local development and remote deployment
Use cases of Remote MCP Server on Cloudflare
- Run MCP tools remotely without local infrastructure
- Securely expose MCP tools to Claude Desktop over the internet
- Prototype and test MCP APIs locally with the MCP Inspector
- Deploy production-grade MCP endpoints on Cloudflare’s edge network
FAQ from Remote MCP Server on Cloudflare
How do I debug connection issues?
Restart Claude, or try connecting directly to your MCP server using npx mcp-remote http://localhost:8787/sse. Clearing cached auth files with rm -rf ~/.mcp-auth may also help.
How do I connect the MCP Inspector?
Set the transport type to SSE and enter http://localhost:8787/sse (or your deployed Workers URL) as the server URL, then click “Connect”. You will be prompted to log in.
How do I connect Claude Desktop to the remote server?
Update the Claude configuration file to use npx mcp-remote with your Workers URL (e.g., https://worker-name.account-name.workers.dev/sse) as an argument, then restart Claude.
What are the deployment prerequisites?
You need a Cloudflare account and must create a KV namespace with npx wrangler kv namespace create OAUTH_KV, then add the namespace ID to wrangler.jsonc before deploying with npm run deploy.
Does the server support authentication?
Yes, it includes OAuth login. When connecting from MCP Inspector or Claude Desktop, a browser window opens for user authentication.