home / mcp / cloudflare mcp server

Cloudflare MCP Server

Provides a remote MCP server on Cloudflare Workers with local and remote access capabilities for MCP clients.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "irdvl-crate-digger-mcp": {
      "url": "http://localhost:8787/sse"
    }
  }
}

Deploy and run a remote MCP Server that you can connect to from local or remote MCP clients. This setup enables local development, integration with Claude Desktop, and deployment to Cloudflare Workers for remote access, with an interop path using an MCP inspector for exploration.

How to use

You run a local MCP server and connect MCP clients (including Claude Desktop) to it. Start locally, test with the MCP Inspector, then optionally deploy to Cloudflare for remote access. You can also connect a remote client to your deployed server by pointing it at your Workers.dev URL.

How to install

Prerequisites you need on your machine: Node.js installed and a package manager. You will use npm, npx, and optionally pnpm for local development; install dependencies and run the server as shown.

Step by step commands to get a local MCP server running and to connect clients.

# clone the project
# Note: use the exact commands shown here when following along
git clone https://github.com/cloudflare/ai.git

# install dependencies
cd ai
# Use npm for the install step
npm install

# run locally
npx nx dev remote-mcp-server

# You should be able to open http://localhost:8787/ in your browser

Additional sections

Configure and use the server across local and remote workflows. The local server runs on port 8787 and exposes an SSE endpoint at /sse for MCP clients to connect.

Local configuration for Claude Desktop is provided by a small JSON block that tells Claude how to reach the local server via a proxy. You place this in the Claude configuration file used by the application.

{
  "mcpServers": {
    "math": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8787/sse"
      ]
    }
  }
}

Deploying to Cloudflare provides remote access via a Worker. Create an OAuth KV namespace, update the deployment configuration, and run the deployment command to publish your MCP server to the cloud.

npx wrangler kv namespace create OAUTH_KV
# Follow the guidance to add the kv namespace ID to wrangler.jsonc
npm run deploy

Troubleshooting and notes

If you need to restart the client or verify connectivity, you can try connecting to the local MCP server directly from a tooling container or CLI. You might also clear any local authentication artifacts if you run into authentication issues.

npx mcp-remote http://localhost:8787/sse
rm -rf ~/.mcp-auth

Available tools

inspector

MCP Inspector tool to explore the MCP API over SSE, login via mock user credentials, and browse tools and endpoints.

mcp_remote

Command line tool to connect to an MCP server using the mcp-remote wrapper and an SSE URL.