Deploy a no-auth remote MCP server on Cloudflare Workers with tools integration and connection options
Remote MCPS (Model Context Protocol Server) enhances AI applications by providing standardized connectivity to external tools and data sources through a protocol layer, akin to USB-C for electronic devices. This example demonstrates deploying an MCP server that runs on Cloudflare Workers without requiring authentication, making it an ideal solution for developers looking to integrate with various AI tooling ecosystems.
The remote MCP server utilizes real-time bidirectional communication via Server-Sent Events (SSE), ensuring seamless and efficient data transfer between the client and server. This connection allows clients like Claude Desktop, Continue, Cursor, and others to execute tools seamlessly by sending commands and receiving responses over a secure channel.
By leveraging Cloudflare Workers, our MCP server operates without the need for authentication, making it easy and quick to set up and deploy. This feature is particularly beneficial in scenarios where authentication overhead can be cumbersome or impractical.
The init()
method in the src/index.ts
file allows users to define their own tools. By calling this.server.tool(...)
, developers can add custom functionalities that comply with the MCP protocol, enabling them to extend the capabilities of any supported AI application seamlessly.
The following Mermaid diagram illustrates the flow of communication between an AI application, the MCP client, and the MCP server. This diagram provides a visual understanding of how data is exchanged and processed throughout the protocol stack.
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
The remote MCP server utilizes Cloudflare Workers to host the server infrastructure. This setup ensures that data is processed and sent in real-time, enhancing the responsiveness of AI applications that interact with external tools.
You can get started by either deploying your MCP server directly through the Cloudflare Workers platform or setting it up locally using the following commands:
This will deploy your MCP server to a URL like: remote-mcp-server-authless.<your-account>.workers.dev/sse
Alternatively, you can use the command line:
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
An investment firm uses an MCP server to integrate with real-time financial data sources. This setup allows their AI-driven analytics tools to perform market analysis, risk assessment, and predictive modeling using up-to-date information.
A research organization deploys an MCP server to connect with various environmental sensors scattered across different locations. This enables researchers to gather and analyze real-time data on air quality, temperature, humidity, and other critical parameters, facilitating informed decision-making processes.
You can connect your custom-built MCP server to the Cloudflare AI Playground, a comprehensive remote MCP client:
remote-mcp-server-authless.<your-account>.workers.dev/sse
)To integrate with local MCP clients, such as Claude Desktop, you can use the mcp-remote
proxy:
{
"mcpServers": {
"calculator": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8787/sse" ] // or remote-mcp-server-authless.your-account.workers.dev/sse
}
}
}
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
For enhanced security, you can configure your MCP server using environment variables. This example demonstrates setting an API key:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Q: Can I use the Remote MCP Server with local applications?
Q: How do I integrate external tools into my AI application using this MVC Server?
this.server.tool(...)
method in your custom code to define new tools compatible with the MCP protocol.Q: Is there a way to monitor the performance of data exchange between clients and servers?
Q: Can I run multiple MCP servers using this deployment model?
Q: What are some best practices for deploying an MCP server?
Contributions to this project are welcome. If you'd like to contribute, please adhere to our contribution guidelines available in the repository under CONTRIBUTING.md
. Additionally, feel free to follow best practices for writing clean, modular code and robust documentation.
Join the broader MCP community by exploring related repositories and resources:
Stay updated with the latest in MCP development by following our official blog and participating in discussions on relevant forums.
By deploying this Remote MCP Server, you can significantly enhance your AI application’s capabilities, making it more versatile and powerful.
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