Remote MCP Server on Cloudflare
@kentwalters
Overview
What is Remote MCP Server on Cloudflare?
A starter project to deploy a remote Model Context Protocol (MCP) server on Cloudflare Workers with OAuth login. It enables AI clients like Claude Desktop to securely invoke tools over HTTP/SSE.
How to use Remote MCP Server on Cloudflare?
Clone the repository, install dependencies with npm install, run locally using npx nx dev remote-mcp-server, then configure the MCP Inspector or Claude Desktop to connect to http://localhost:8787/sse. Deploy with npm run deploy after creating a KV namespace.
Key features of Remote MCP Server on Cloudflare
- Runs as a Cloudflare Worker with OAuth authentication
- Supports local development and remote deployment
- Connects to MCP Inspector and Claude Desktop via SSE
- Uses a KV store for OAuth state management
- Includes a mock login for local testing
Use cases of Remote MCP Server on Cloudflare
- Building and testing a remote MCP server locally before deploying
- Connecting Claude Desktop to custom tools hosted on Cloudflare Workers
- Providing OAuth-protected tool access for AI assistants
FAQ from Remote MCP Server on Cloudflare
What dependencies are required?
Node.js and npm are needed for local development. The Cloudflare Workers runtime handles deployment; no additional server infrastructure is required.
How does authentication work?
The server includes OAuth login. Locally a mock login screen accepts any email/password. In production, OAuth flows are handled by Cloudflare Workers and the KV store.
Can I use this with the MCP Inspector?
Yes. Set transport type to SSE and enter the server’s SSE URL (e.g., http://localhost:8787/sse locally, or the workers.dev URL after deployment).
How do I connect Claude Desktop?
Edit the Claude Desktop config file to use npx mcp-remote <url>/sse as the command and args. A browser window will open for authentication.
Where is OAuth state stored?
In a Cloudflare Workers KV namespace named OAUTH_KV that you create with npx wrangler kv namespace create OAUTH_KV.