JakePartusch_remote-mcp-server-2

JakePartusch_remote-mcp-server-2

3.3

This document provides a guide to setting up a remote Model Context Protocol (MCP) server on Cloudflare Workers, including local development, connection to MCP Inspector, and integration with Claude Desktop.

The Remote MCP Server on Cloudflare guide details the process of setting up a Model Context Protocol server using Cloudflare Workers. It includes instructions for local development, connecting to the MCP Inspector for API exploration, and integrating with Claude Desktop for enhanced functionality. The guide also covers deployment to Cloudflare and provides troubleshooting tips for common issues. By following this guide, users can effectively manage and utilize MCP servers for various applications, leveraging the power of Cloudflare's infrastructure and the flexibility of MCP technology.

Features

  • Local Development: Instructions for setting up and running the MCP server locally using Node.js and npm.
  • MCP Inspector Integration: Steps to connect the MCP Inspector to the server for API exploration and tool invocation.
  • Claude Desktop Integration: Guide to configuring Claude Desktop to interact with the MCP server for enhanced tool usage.
  • Cloudflare Deployment: Instructions for deploying the MCP server to Cloudflare Workers for remote access.
  • Debugging Tips: Provides solutions for common issues encountered during setup and operation.

Usage with Different Platforms

Develop locally

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

# install dependencies
cd ai
npm install

# run locally
npx nx dev remote-mcp-server

Connect Claude Desktop


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

Deploy to Cloudflare

bash
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

Connect Claude Desktop to remote server


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

Debugging

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

rm -rf ~/.mcp-auth