remote-mcp-server

remote-mcp-server

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, integration with Claude Desktop, and deployment.

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, integrating with Claude Desktop, and deploying the server to Cloudflare. The guide also covers debugging tips and provides configuration scripts for connecting Claude Desktop to both local and remote MCP servers. The MCP server facilitates communication between different platforms and tools, allowing for seamless integration and tool invocation through a standardized protocol.

Features

  • Local Development: Instructions for setting up and running the MCP server locally using Node.js and npm.
  • MCP Inspector Connection: Steps to connect the MCP Inspector to the server for API exploration and tool invocation.
  • Claude Desktop Integration: Configuration guidance for connecting Claude Desktop to the MCP server for tool usage.
  • Cloudflare Deployment: Steps to deploy the MCP server to Cloudflare Workers, including KV namespace creation.
  • Debugging Tips: Suggestions for troubleshooting common issues, including command-line connection and authentication file management.

Usage with Different Platforms

local_development

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

mcp_inspector_connection

bash
npx @modelcontextprotocol/inspector

claude_desktop_local


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

cloudflare_deployment

bash
npx wrangler kv namespace create OAUTH_KV
npm run deploy

claude_desktop_remote


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