- Home
- MCP servers
- Remote MCP Server on Cloudflare
Remote MCP Server on Cloudflare
- typescript
0
GitHub Stars
typescript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can run a remote MCP (Model Context Protocol) server on Cloudflare, develop it locally, connect inspecting tools, and deploy it so clients like Claude can access your MCP-powered tools. This guide gives you practical steps to develop, test, deploy, and debug your MCP server end-to-end.
How to use
Connect your MCP client to either your local development server or your deployed Cloudflare worker. Locally, the MCP server serves at http://localhost:8787/sse, and you can explore its tools using the MCP Inspector. For Claude Desktop, point it to the local proxy so Claude can call the MCP endpoints through an HTTP proxy. When you deploy, you’ll connect clients to the remote worker’s SSE URL and Claude will call tools through that remote endpoint.
How to install
Prerequisites: ensure you have Node.js and a package manager installed on your machine. You will clone the project, install dependencies, and start the local development server.
# clone the repository
git clone https://github.com/cloudflare/ai.git
# Or if using ssh:
# git clone git@github.com:cloudflare/ai.git
# install dependencies
cd ai
# Note: using pnpm instead of just "npm"
pnpm install
# run locally
npx nx dev remote-mcp-server
Deploy to Cloudflare
Prepare Cloudflare for hosting your MCP server by creating an OAUTH KV namespace, then deploy the server to a Cloudflare Worker. The steps below show the high-level actions you’ll perform.
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
To connect from a remote MCP client, start the MCP Inspector and point it to the remote SSE URL of your deployed worker. You will use the remote worker’s SSE endpoint to list and call tools.
npx @modelcontextprotocol/inspector@latest
Connect Claude Desktop to your remote MCP server
Configure Claude Desktop to route through your MCP server by editing the MPC configuration. Use the remote SSE URL your worker exposes.
{
"mcpServers": {
"math": {
"command": "npx",
"args": [
"mcp-remote",
"https://worker-name.account-name.workers.dev/sse"
]
}
}
}
Debugging
If something goes wrong, restart Claude, or try connecting directly to your MCP server from the command line to verify the SSE endpoint is reachable.
npx mcp-remote http://localhost:8787/sse
rm -rf ~/.mcp-auth
Available tools
MCP Inspector
A debugging and exploration tool to connect to an MCP server via SSE, list available tools, and invoke them.
Claude Desktop integration
Configuration workflow to connect Claude Desktop to a local or remote MCP server through a proxy, enabling tool execution from Claude prompts.