logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

distributed-mcp-host

Establish a remote Model Context Protocol (MCP) endpoint hosted on Cloudflare Workers, featuring secure OAuth authentication. This setup facilitates safeguarded HTTP access to a suite of resources and tools, enabling interaction via the MCP Inspector for both local and remote clients.

Author

distributed-mcp-host logo

Omarzipan

No License

Quick Info

GitHub GitHub Stars 0
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

cloudflarecloudomarzipanserver cloudflareservices omarzipancloudflare workers

Deployable MCP Backend on Cloudflare Workers

Let's initiate a distributed MCP server instance using Cloudflare Workers, incorporating robust OAuth credential verification!

Local Development Setup

# Obtain the source repository
git clone git@github.com:cloudflare/ai.git

# Navigate and install prerequisites
cd ai
npm install

# Initiate local development server
npx nx dev remote-mcp-server

You should now be able to access the service at http://localhost:8787/ via a web browser.

Integrating the MCP Inspector Client

To visually examine your newly established MCP interface, utilize the MCP Inspector.

  • Launch it using the command: npx @modelcontextprotocol/inspector
  • Within the Inspector interface (typically accessible at http://localhost:5173), configure the Transport Type to SSE and input http://localhost:8787/sse as the target URL for the MCP service, then activate "Connect".
  • A simulated authentication prompt will appear. Enter arbitrary credentials (email/password) to proceed.
  • Upon successful authentication, you will return to the Inspector, ready to enumerate and invoke any registered functionalities!

Linking Claude Desktop to Your On-Premises MCP Instance

While the Inspector is useful, the primary goal is integration with Claude. Adhere to Anthropic's Quickstart Guide. In the Claude Desktop application, navigate to Settings > Developer > Edit Config to locate and open your configuration manifest.

Modify the file content to incorporate the following JSON structure:

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

This configuration establishes a localized intermediary proxy, enabling Claude to communicate with your MCP backend over HTTP.

When Claude initializes, a browser window should prompt you for login. Subsequently, the available tools will appear in the bottom-right panel. Given an appropriate user input, Claude should request invocation of the specified tool.

Production Deployment on Cloudflare

  1. Provision the required key-value store: npx wrangler kv namespace create OAUTH_KV
  2. Update wrangler.jsonc to reference the generated KV namespace ID as instructed.
  3. Execute the deployment routine: npm run deploy

Accessing Your Deployed Remote MCP Service from Another Client

Repeat the procedure used in the "Local Development Setup" section for the MCP Inspector:

npx @modelcontextprotocol/inspector@latest

Then, in the Inspector, substitute the URL of the Worker (e.g., worker-name.account-name.workers.dev/sse) as the MCP server endpoint and initiate the connection.

You have successfully linked a distant MCP client to your newly deployed service.

Connecting Claude Desktop to the Hosted MCP Endpoint

Update the configuration file used for Claude Desktop to point to your deployed workers.dev address (e.g., worker-name.account-name.workers.dev/sse) and restart the Claude application:

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

Troubleshooting

If operational issues arise, an initial step is to terminate and relaunch Claude. Alternatively, direct command-line verification against the local server is recommended:

npx mcp-remote http://localhost:8787/sse

In seldom instances, purging the cached authentication artifacts located in ~/.mcp-auth might resolve connectivity problems:

rm -rf ~/.mcp-auth

See Also

`