Set up and connect remote MCP servers on Cloudflare Workers with OAuth support and seamless Claude integration
The Remote MCP Server allows developers to create and deploy custom model context protocols (MCP) infrastructure, enabling seamless integration between various AI applications such as Claude Desktop, Continue, Cursor, and others. This server acts as a bridge, connecting these clients to specific data sources or tools through a standardized protocol. Similar to how USB-C enables devices to communicate efficiently with multiple types of hardware and software, the Remote MCP Server streamlines interactions between AI applications and diverse backend services.
The core features of the Remote MCP Server include:
The architecture of the Remote MCP Server is centered around the Model Context Protocol (MCP), ensuring compatibility with a range of AI applications. The protocol implementation involves several key steps:
The following Mermaid diagram illustrates the protocol flow between an AI application (MCP client), the MCP Server, and a backend data source or tool:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
To develop the Remote MCP Server locally, follow these steps:
# Clone the repository
git clone [email protected]:cloudflare/ai.git
# Install dependencies
cd ai
npm install
# Run the server locally
npx nx dev remote-mcp-server
This setup will allow you to access the server via http://localhost:8787
. The server can then be explored using the MCP Inspector, which provides a user-friendly interface for interacting with tools.
To deploy the server as a global service on Cloudflare Workers:
npx wrangler kv namespace create OAUTH_KV
wrangler.jsonc
.npm run deploy
Imagine an investor who needs real-time financial data analysis. The Remote MCP Server could be deployed to provide access to stock market APIs, enabling tools for analyzing financial trends and providing insights.
Researchers working on medical studies can use the server to interact with various databases and tools for analyzing patient data and conducting research. This integration streamlines their workflow by providing a unified interface.
The Remote MCP Server supports compatibility with a variety of AI applications:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
Here is an example configuration for connecting tools in the claude-desktop
file:
{
"mcpServers": {
"math": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
}
}
}
The server is compatible with various AI applications and tools, ensuring broad support across the MCP ecosystem.
To debug issues or test the server locally:
npx mcp-remote http://localhost:8787/sse
Clearing authentication files can also be helpful:
rm -rf ~/.mcp-auth
Q: How do I troubleshoot connection issues?
A: Restart your MCP client and try reconnecting to the server. Clear any cached credentials with rm -rf ~/.mcp-auth
.
Q: Can I use this with multiple AI applications? A: Yes, the Remote MCP Server supports compatibility with various MCP clients such as Claude Desktop, Continue, and Cursor.
Q: How do I ensure secure API keys? A: Use OAuth for authentication to avoid exposing sensitive information. Follow best practices when handling API keys.
Q: What are common issues when deploying on Cloudflare Workers?
A: Ensure you have created the required KV namespaces and updated wrangler.jsonc
with your namespace ID before deployment.
Q: How can I integrate custom tools into my MCP server?
A: Define tools within the server configuration, using the mcp-remote
command to proxy requests to custom backend services.
Contributions are welcome! To contribute to this project, follow these steps:
For more information about Model Context Protocol (MCP) and related resources, visit:
By leveraging the Remote MCP Server, developers can significantly enhance their AI application's capabilities by integrating diverse tools and data sources through a standardized protocol.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Build a local personal knowledge base with Markdown files for seamless AI conversations and organized information.
Integrate AI with GitHub using MCP Server for profiles repos and issue creation
Python MCP client for testing servers avoid message limits and customize with API key
Explore MCP servers for weather data and DigitalOcean management with easy setup and API tools