Remote MCP Server on Cloudflare
@chjtxwd
Overview
What is Remote MCP Server on Cloudflare?
The Remote MCP Server on Cloudflare is a sample implementation of a Model Context Protocol (MCP) server that runs on Cloudflare Workers and includes OAuth login authentication. It is designed for developers who want to deploy a secure, remote MCP endpoint accessible over the internet.
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. 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 with the MCP Inspector or Claude Desktop by pointing to the server’s SSE endpoint.
Key features of Remote MCP Server on Cloudflare
- Deployable on Cloudflare Workers for global accessibility
- OAuth login authentication for secure access
- Supports SSE transport for remote MCP clients
- Works with MCP Inspector and Claude Desktop
- Includes local development and debugging commands
- Simple deployment with Wrangler CLI
Use cases of Remote MCP Server on Cloudflare
- Run a remote MCP server with user authentication for tool calling
- Connect Claude Desktop to a cloud-hosted MCP server for remote tool access
- Prototype and test MCP tools locally before deploying to production
- Provide a secure MCP endpoint for language models via Cloudflare’s global network
FAQ from Remote MCP Server on Cloudflare
How is this different from a local MCP server?
The remote server runs on Cloudflare Workers with OAuth authentication, making it accessible over the internet. A local server runs on your machine without authentication. The README shows both local development and remote deployment configurations.
What dependencies or runtime are required?
You need Node.js, npm, a Cloudflare account, and the Wrangler CLI (npx wrangler). The project uses an MCP remote proxy (npx mcp-remote) to connect clients like Claude Desktop.
Where does data (e.g., OAuth tokens) live?
OAuth session data is stored in a Cloudflare KV namespace (OAUTH_KV) defined during deployment.
What transport protocol does this server use?
The server uses Server-Sent Events (SSE) via an endpoint at /sse. Clients must specify SSE transport and the full URL (e.g., http://localhost:8787/sse).
How does authentication work?
The server includes OAuth login. When connecting a client (e.g., MCP Inspector or Claude Desktop), a browser window opens for user/password login. The README notes a mock login screen for local development.