Set up and deploy remote MCP servers on Cloudflare with OAuth integration for seamless AI tool access
The Remote MCP Server hosted on Cloudflare provides developers and AI application creators with a standardized framework to connect various tools, data sources, and other services through the Model Context Protocol (MCP). This server serves as a bridge, enabling communication between different AI applications like Claude Desktop, Continue, Cursor, and many more. By leveraging MCP, these applications can interact with diverse APIs and tools in a consistent manner, enhancing functionality and flexibility.
The Remote MCP Server on Cloudflare offers several core features that make it an essential tool for AI application integration:
graph TB
A[AI Application] -->|MCP Client| B[MCP Server]
B --> C[WebSocket/Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
The architecture of the Remote MCP Server on Cloudflare is designed to be modular and scalable. It consists of several components that work together:
graph TB
A[Database] --> B[Tokens & Auth Info]
B --> C[OAuth 2.0 Flow]
C --> D[MCP Server]
style A fill:#f8b195
To get started, 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.
Claude Desktop is an AI application that can interact with different tools and data sources. By integrating the Remote MCP Server, Claude can seamlessly perform complex math calculations.
Technical Implementation:
Cursor is another AI application that requires data analysis capabilities. The Remote MCP Server can be used to connect Cursor to various data sources and tools.
Technical Implementation:
To connect an MCP client like Claude Desktop or Continue, follow these steps:
Local Setup:
npx wrangler kv namespace create OAUTH_KV
npm run deploy
MCP Client Configuration:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
npx @modelcontextprotocol/inspector@latest
For remote connections, enter the workers.dev
URL in the MCP inspector:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]", "https://worker-name.account-name.workers.dev/sse"]
}
}
}
MCP Client | Resources | Tools | Prompts |
---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ |
Continue | ✅ | ✅ | ✅ |
Cursor | ❌ | ✅ | ❌ |
rm -rf ~/.mcp-auth
npx wrangler kv namespace create OAUTH_KV
wrangler.jsonc
.npm run deploy
A: Use OAuth 2.0 for authentication, which is supported by the Remote MCP Server.
A: Yes, the server is designed to handle multiple connections from different clients.
A: Check your OAuth credentials and ensure they have been correctly configured on both the client and server sides.
A: Optimize data transfer protocols and consider using efficient serialization formats like Protocol Buffers or Avro.
A: The server supports a wide range of tools, but compatibility may vary depending on the tool's implementation and API design.
The Remote MCP Server is an open-source project. Contributions are welcome! Here’s how you can contribute:
This comprehensive guide should help developers understand and utilize the Remote MCP Server effectively. By leveraging its features, you can enhance your AI applications' capabilities and ensure seamless integration with various tools and data sources through MCP.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration