Deploy a no-auth remote MCP server on Cloudflare Workers with tool integration and easy connection options
This example guides you through deploying a remote MCP server that doesn't require authentication on Cloudflare Workers.
A Remote MCP Server enables AI applications to connect to specific data sources and tools using the Model Context Protocol (MCP). This standardized protocol allows seamless integration of various tools within an AI application, much like how USB-C facilitates hardware connections. The provided example ensures that you can host your own remote MCP server on Cloudflare Workers without authentication requirements.
The deployed Remote MCP Server supports Server-Sent Events (SSE) for real-time communication between the AI application and the data sources/tools it integrates. This means that the events generated by tools can be instantly relayed to the AI application, enhancing responsiveness and efficiency.
One of the key features of this server is its lack of required authentication. This makes it easier to set up and test without any added complexity, offering a streamlined experience for developers eager to deploy their MCP servers quickly.
The Remote MCP Server utilizes Cloudflare Workers to host the MCP infrastructure. It leverages a simple yet powerful template that includes the necessary code snippets to initialize an MCP server and define tools using this.server.tool()
.
To customize your MCP server, you can edit the init()
method in src/index.ts
by adding or modifying tools with specific functionalities.
// Example of adding a tool
this.server.tool('calculator', (context) => {
// Implement calculation logic here
});
You can deploy your Remote MCP Server directly from GitHub by clicking the following button:
This will generate a unique URL for your MCP server, such as remote-mcp-server-authless.<your-account>.workers.dev/sse
.
Alternatively, you can deploy the server locally using the following command:
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
Then run the npm script to start the server.
Imagine an AI financial analyst tool that retrieves real-time stock prices and performs complex trading strategies. By integrating this tool with a remote MCP server, you can deploy it on Cloudflare Workers for quick access from various clients such as Claude Desktop.
A remote sensor network sending real-time environmental data (e.g., temperature, humidity) to an AI application that requires this data for predictive modeling. This scenario showcases the importance of real-time communication and efficient tool integration through MCP.
You can connect your MCP server to the Cloudflare AI Playground, a remote MCP client:
remote-mcp-server-authless.<your-account>.workers.dev/sse
)To connect your remote MCP server from Claude Desktop, follow these steps:
{
"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, limited prompt functionality. |
Continue | ✅ | ✅ | ✕ | Full Support, limited prompt functionality. |
Cursor | ❌ | ✅ | ❚ | Limited support for certain tools and features only. |
To configure the Remote MCP Server with additional settings, you can edit the src/index.ts
file by defining environment variables or modifying the server configuration. For example:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Ensure that any API keys or other sensitive information are securely managed and not exposed in public repositories. Additionally, consider encrypting data transmitted between the MCP client and server.
A1: While this example demonstrates an authenticated-free setup, you can modify the existing code to integrate your own authentication mechanism if needed. Please refer to the official documentation on how to extend the server functionalities.
A2: In a production environment, consider implementing a multi-tenant architecture where each tenant has its own instance of the Remote MCP Server running with unique settings and configurations. This ensures that tenants can operate independently while maintaining security.
A3: Absolutely! By leveraging the this.server.tool()
method, you can define any number of custom tools within your Remote MCP Server to enhance its capabilities further.
A4: The Remote MCP Server includes basic logging features that allow you to trace events and errors. For more detailed diagnostics, consider implementing centralized logging solutions like ELK or Splunk.
A5: Ensure you comply with relevant data protection regulations by anonymizing sensitive information where possible and using encrypted channels for communication between the MCP client, server, and external tools. Regularly audit and update your security practices to stay compliant.
If you find bugs or have new ideas to improve the Remote MCP Server, please submit issues or pull requests on the GitHub repository. Contributions are highly appreciated!
For more information about MCP and related tools, visit:
We encourage developers to explore the MCP ecosystem and contribute to its growth.
By following these guidelines, you can effectively deploy a Remote MCP Server on Cloudflare Workers for seamless integration with various AI applications.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Python MCP client for testing servers avoid message limits and customize with API key
Explore community contributions to MCP including clients, servers, and projects for seamless integration
Powerful GitLab MCP Server enables AI integration for project management, issues, files, and collaboration automation
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
SingleStore MCP Server for database querying schema description ER diagram generation SSL support and TypeScript safety