home / mcp / remote mcp server

Remote MCP Server

Provides a remote MCP server that runs behind Cloudflare Workers, enabling OAuth login and remote tool invocation via MCP clients.

Installation
Add the following to your MCP client configuration file.

Configuration

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

You can run a remote MCP server on Cloudflare Workers, develop locally, connect to it with the MCP Inspector, and integrate with Claude Desktop. This setup enables secure remote hosting, local testing, and simple client configuration to expose MCP tools via SSE.

How to use

Run and test your MCP server locally, connect with the MCP Inspector to explore available tools, and then configure Claude Desktop to leverage the server through a proxy or direct SSE URL. When deployed to Cloudflare, you can call your remote MCP server from any MCP client by pointing it to the Worker’s SSE endpoint.

Workflow highlights include developing locally with a built-in server, inspecting tools through the MCP Inspector, integrating with Claude Desktop, deploying to Cloudflare, and connecting from a remote MCP client or Claude to your deployed server.

How to install

Prerequisites you need installed on your machine before you begin:

- Node.js and npm (Node 14+ recommended). Ensure npm is on the path and accessible from your terminal.

- Git for cloning repositories.

# clone the repository
git clone [email protected]:cloudflare/ai.git

# install dependencies
cd ai
npm install

# run locally
npx nx dev remote-mcp-server

Deploy to Cloudflare

Prepare and deploy your remote MCP server to Cloudflare Workers. This enables a remote endpoint that MCP clients can connect to via SSE.

npx wrangler kv namespace create OAUTH_KV
```

Follow the guidance to add the kv namespace ID to `wrangler.jsonc`.

```bash
npm run deploy

Call your newly deployed remote MCP server from a remote MCP client

To use the remote server from an MCP client, first start the MCP Inspector, then connect to the Worker’s SSE endpoint.

npx @modelcontextprotocol/inspector@latest
```

Enter the Worker SSE URL in the inspector (for example: https://worker-name.account-name.workers.dev/sse) and click Connect. You will be prompted to login and then you can list and call tools exposed by your MCP server.

Connect Claude Desktop to your remote MCP server

Update Claude Desktop to point to your deployed MCP server’s SSE URL. Claude can then login and present the available tools.

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