Set up and connect remote MCP servers on Cloudflare Workers with OAuth, Claude integration, and seamless deployment
The Remote MCP Server on Cloudflare is a deployable solution that enables AI applications such as Claude Desktop, Continue, and Cursor to integrate with specific data sources and tools using the Model Context Protocol (MCP). This server acts as a bridge, providing standardized API endpoints for various AI clients. The goal is to streamline and standardize interactions between AI tools and backend services, making it easier for developers to leverage diverse functionalities through familiar interfaces.
The Remote MCP Server supports the core features defined by Model Context Protocol, ensuring seamless communication between AI applications and external data sources or tools. Key capabilities include:
This server leverages Cloudflare's robust infrastructure to ensure high availability and performance, making it suitable for a wide range of AI applications. The protocol flow diagram illustrates the interaction between the MCP client, the MCP server, and external data sources/tools.
The architecture is designed with a focus on extensibility and flexibility. The protocol involves:
The protocol flow diagram depicts this interaction, showing how MCP clients initiate a connection, authenticate themselves, and send commands to the server, which then routes the command to the relevant tool or data source:
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 set up the Remote MCP Server, follow these steps:
# Clone the repository
git clone [email protected]:cloudflare/ai.git
# Install dependencies
cd ai
npm install
# Run locally
npx nx dev remote-mcp-server
You should be able to open http://localhost:8787/
in your browser.
Create a KV Namespace for OAUTH:
npx wrangler kv namespace create OAUTH_KV
Add the namespace ID to wrangler.jsonc.
Deploy the server:
npm run deploy
Imagine an AI application requiring real-time financial data analysis. Using Remote MCP Server, we can integrate with a financial API to fetch and process market updates.
{
"mcpServers": {
"finance": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse"
]
}
}
}
In a medical context, AI applications can use the Remote MCP Server to interface with specialized image analysis tools. This integration allows for seamless deployment and testing of models without manual intervention.
The server is compatible with popular MCP clients such as Claude Desktop, Continue, and Cursor. The following table provides an overview:
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
This configuration ensures that Claude Desktop can send commands to the server, which then handles the request and relays it to a tool or data source.
The Remote MCP Server is designed for high performance and compatibility across various environments. It supports both local development and remote cloud deployment, ensuring robust and reliable service.
Environment | Local Dev | Cloudflare Workers |
---|---|---|
Response Time | <100ms | <300ms |
Load Balancing | Yes | Yes |
SSL Certificates | Yes | Yes |
Common issues can be resolved by:
~/.mcp-auth
).rm -rf ~/.mcp-auth
For persistent problems, direct command-line interaction with the MCP server can provide insights:
npx mcp-remote http://localhost:8787/sse
Ensure environment variables are properly set for secure deployment:
{
"env": {
"API_KEY": "your-api-key",
"SECURE_TOKEN": "secret-token"
}
}
How does the OAuth authentication work?
Can I use this server with any MCP client?
What are the typical response times for integration requests?
How do I update the configuration file?
mcpServers
section as needed.What tools/services does this server support out of the box?
Contributions are welcome! To get started:
git checkout -b feature-branch
).git push origin feature-branch
).Explore more about Model Context Protocol and its ecosystem by visiting:
For further support, join the community on Discord.
This comprehensive documentation showcases the functionality, configuration, and integration possibilities of the Remote MCP Server. It serves as a valuable reference for developers looking to enhance their AI applications through standardization and flexibility provided by Model Context 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