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. It includes instructions for local development, connecting to the MCP Inspector, and integrating with Claude Desktop. The guide also covers deployment to Cloudflare and provides troubleshooting tips. By following the steps outlined, users can create a remote MCP server that supports OAuth login and can be accessed from various platforms. The guide emphasizes the use of Cloudflare Workers for deployment, ensuring scalability and reliability. Additionally, it provides configuration details for connecting Claude Desktop to both local and remote MCP servers, enabling seamless interaction with the server's tools.

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.
  • Claude Desktop Integration: Configuration details for connecting Claude Desktop to the MCP server.
  • Cloudflare Deployment: Guide to deploying the MCP server on Cloudflare Workers with OAuth support.
  • Debugging Tips: Suggestions for troubleshooting common issues during setup and deployment.

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 MCP Inspector

bash
npx @modelcontextprotocol/inspector

Connect Claude Desktop Locally


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

Deploy to Cloudflare

bash
npx wrangler kv namespace create OAUTH_KV
npm run deploy

Connect Claude Desktop Remotely


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