Remote MCP Server on Cloudflare
A remote MCP server deployable on Cloudflare Workers with OAuth login support, designed for both local development and cloud deployment.
Remote MCP Server on Cloudflare
Let's get a remote MCP server up-and-running on Cloudflare Workers complete with OAuth login!
Develop locally
# clone the repository
git clone [email protected]:cloudflare/ai.git
# install dependencies
cd ai
npm install
# run locally
npx nx dev remote-mcp-server
You should be able to open http://localhost:8787/ in your browser
Connect the MCP inspector to your server
To explore your new MCP api, you can use the MCP Inspector.
- Start it with
npx @modelcontextprotocol/inspector - Within the inspector, switch the Transport Type to
SSEand enterxas the URL of the MCP server to connect to, and click "Connect" - You will navigate to a (mock) user/password login screen. Input any email and pass to login.
- You should be redirected back to the MCP Inspector and you can now list and call any defined tools!
Connect Claude Desktop to your local MCP server
The MCP inspector is great, but we really want to connect this to Claude! Follow Anthropic's Quickstart and within Claude Desktop go to Settings > Developer > Edit Config to find your configuration file.
Open the file in your text editor and replace it with this configuration:
{
"mcpServers": {
"math": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
}
}
}
This will run a local proxy and let Claude talk to your MCP server over HTTP
When you open Claude a browser window should open and allow you to login. You should see the tools available in the bottom right. Given the right prompt Claude should ask to call the tool.
Deploy to Cloudflare
npx wrangler kv namespace create OAUTH_KV- Follow the guidance to add the kv namespace ID to
wrangler.jsonc npm run deploy
Call your newly deployed remote MCP server from a remote MCP client
Just like you did above in "Develop locally", run the MCP inspector:
npx @modelcontextprotocol/inspector@latest
Then enter the workers.dev URL (ex: worker-name.account-name.workers.dev/sse) of your Worker in the inspector as the URL of the MCP server to connect to, and click "Connect".
You've now connected to your MCP server from a remote MCP client.
Connect Claude Desktop to your remote MCP server
Update the Claude configuration file to point to your workers.dev URL (ex: worker-name.account-name.workers.dev/sse) and restart Claude
{
"mcpServers": {
"math": {
"command": "npx",
"args": [
"mcp-remote",
"https://worker-name.account-name.workers.dev/sse"
]
}
}
}
Debugging
Should anything go wrong it can be helpful to restart Claude, or to try connecting directly to your MCP server on the command line with the following command.
npx mcp-remote http://localhost:8787/sse
In some rare cases it may help to clear the files added to ~/.mcp-auth
rm -rf ~/.mcp-auth
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Game Asset Generator
Generate 2D and 3D game assets using AI models hosted on Hugging Face Spaces.
Unified.to MCP Server
Unified MCP Server is a remote MCP connector for AI agents and vertical AI products that provides access to 22,000+ authorized SaaS tools across 400+ integrations and 24 categories directly inside LLMs.
Design System Server
An MCP server for accessing and managing design system documentation from a GitHub repository.
Liana-MCP
A natural language interface for cell-cell communication analysis using the Liana framework.
Hashnet MCP (Hashgraph Online Registry Broker)
MCP server for agent discovery, registration, and chat via the Hashgraph Online Registry Broker.
claude-session-continuity-mcp
Zero-config session continuity for Claude Code. Auto-captures context via Claude Hooks, provides 24 tools for memory, tasks, solutions, and knowledge graph. Multilingual semantic search (94+ languages).
VibeCoding System
A conversation-driven development framework for rapid MVP and POC creation.
Unified MCP Client Library
An open-source library to connect any LLM to any MCP server, enabling the creation of custom agents with tool access.
OpenAPI MCP Server
Explore and analyze OpenAPI specifications from local files or remote URLs.
Deno Gemini Grounding MCP Server
A Model Context Protocol server that provides access to the connpass users API v2, utilizing Gemini for grounding.