home / mcp / remote mcp server

Remote MCP Server

Provides a remote MCP server that runs on Cloudflare Workers, exposes an SSE API, supports OAuth login, and connects to Claude Desktop.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "benjamitm-remote-mcp-server-prod": {
      "url": "http://localhost:8787/sse"
    }
  }
}

You can run a remote MCP server on Cloudflare Workers with OAuth login, connect to it from local and remote clients, and wire Claude Desktop to interact with your MCP tools. This guide gives practical steps to develop locally, test with the MCP Inspector, connect Claude Desktop, and deploy to Cloudflare so you can access your MCP server from anywhere.

How to use

You start by running the MCP server locally to expose an SSE endpoint for clients to connect. Open the local server in your browser at http://localhost:8787/ and use an MCP client to explore the available tools. You can connect the MCP Inspector to your local server to test the API and confirm that tools are accessible and callable.

How to install

Prerequisites you need before installation are Node.js and a package manager. You will install dependencies, run the local server, and then connect clients.

# clone the project
git clone https://github.com/cloudflare/ai.git
# Or if using ssh:
# git clone [email protected]:cloudflare/ai.git

# install dependencies
cd ai
# Note: using pnpm instead of just "npm"
pnpm install

# run locally
npx nx dev remote-mcp-server

Additional setup and deployment

To deploy the remote MCP server to Cloudflare, you need to create an OAuth KV namespace, configure it, and deploy the Worker.

1. `npx wrangler kv namespace create OAUTH_KV`
2. Follow the guidance to add the kv namespace ID to `wrangler.jsonc`
3. `npm run deploy

Connecting to Claude Desktop locally and remotely

You can bridge Claude Desktop to your local MCP server via a local proxy. Create a Claude configuration that points to your local SSE endpoint. Then you can login and access tools from Claude.

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

Connecting Claude Desktop to your remote MCP server

To connect Claude Desktop to the deployed remote MCP server, update the Claude configuration to point to the Worker URL and start Claude. You will see the available tools and can prompt Claude to call them.

{
  "mcpServers": {
    "math": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://worker-name.account-name.workers.dev/sse"
      ]
    }
  }
}

Debugging

If something goes wrong, restart Claude or test connecting directly from the command line to the MCP server. You can also clear local authentication data if needed.

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

Additional notes

When you work with the local server, the following URLs are commonly used for testing and integration: the local SSE endpoint http://localhost:8787/sse and the local login flow that appears in the MCP Inspector. For remote access, the Worker URL begins with https://, and you connect via the /sse path.

Available tools

mcp_inspector

A utility to inspect and test MCP endpoints over SSE, login flow, and tool discovery; used to explore available tools and endpoints.

claude_desktop_integration

Guides integration of Claude Desktop with the MCP server via a local proxy or remote Worker URL, enabling tool calls from Claude prompts.