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

The Remote MCP Server on Cloudflare guide is designed to help users set up and deploy a Model Context Protocol server using Cloudflare Workers. The guide covers local development, connecting to the MCP Inspector for API exploration, and integrating with Claude Desktop for enhanced functionality. It also includes instructions for deploying the server to Cloudflare and connecting to it from a remote MCP client. The document provides detailed steps for setting up OAuth login, configuring the server, and troubleshooting common issues. By following this guide, users can effectively manage and utilize MCP servers for various applications, leveraging the power of Cloudflare's infrastructure.

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: Guide to configuring Claude Desktop to connect with the local and remote MCP server.
  • Cloudflare Deployment: Instructions for deploying the MCP server to Cloudflare Workers with OAuth login.
  • Debugging Tips: Provides troubleshooting steps for common issues encountered during setup and deployment.

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

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
# Follow the guidance to add the kv namespace ID to `wrangler.jsonc`
npm run deploy

claude_desktop_remote


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