Deploy a serverless MCP on Cloudflare Workers for remote AI tool integration without authentication
This example demonstrates how to deploy a remote Model Context Protocol (MCP) server that does not require authentication on Cloudflare Workers. The server is designed to integrate seamlessly with various AI applications, providing a robust platform for executing tools and connecting data sources.
The Remote MCP Server enables developers to build custom APIs or adapt existing ones into the Model Context Protocol, allowing seamless integration with AI applications like Claude Desktop, Continue, Cursor, and more. By deploying this server on Cloudflare Workers, it can be quickly made available over the web without any authentication required.
The Remote MCP Server supports a wide range of tools through the Model Context Protocol (MCP). These include arithmetic operations, language processing tasks, system information retrieval, and more. Each tool is defined within the init()
method of src/index.ts
using this.server.tool(...)
to ensure compatibility with different AI clients.
The architecture of the Remote MCP Server is built on top of Cloudflare Workers, leveraging its edge computing capabilities to provide fast and reliable operations. The protocol implementation strictly adheres to the MCP standard, ensuring interoperability across multiple platforms and applications. The server components are designed to handle tool invocations, data transmission, and client responses efficiently.
To get started quickly, you can use one of the following methods:
Deploy the Remote MCP Server directly via a button link provided below:
This will deploy your server to a URL like: remote-mcp-server-authless.<your-account>.workers.dev/sse
.
Alternatively, you can set up the server on your local machine using the command line:
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
This script will scaffold a basic Remote MCP Server configuration ready for customization.
Real-time Arithmetic Calculations: A user can send arithmetic operations via the Remote MCP Server, which then processes and returns results securely.
Implementing this: Define an 'add' tool within src/index.ts
using:
this.server.tool('add', (input) => input.a + input.b);
Prompt Analysis for Continual Learning Models: The server can process text prompts and feed them into a language model, providing insights or responses.
Implementing this: Create an 'analyze-prompt' tool:
this.server.tool('analyze-prompt', (prompt) => model.analyze(prompt));
The Remote MCP Server is fully compatible with the following MCP clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ❌ | Full Support |
Continue | ✅ | ✅ | ❌ | Full Support |
Cursor | ❌ | ✅ | ❌ | Limited Support |
For instance, connecting your Remote MCP Server to Claude Desktop involves adding the server URL as an MCP server resource in the configuration.
The performance of the Remote MCP Server has been benchmarked under various use cases. The following table outlines its compatibility and potential performance bottlenecks:
Tool Type | Maximum Invocation Rate | Data Transfer Speed (MB/s) | Latency (ms) |
---|---|---|---|
Arithmetic | 10,000 req/sec | 25 MB/s | <10 |
Text Processing | 3,000 req/sec | 8 MB/s | <20 |
Configure the Remote MCP Server by updating the index.ts
file to include your own tools and settings. For example:
{
"mcpServers": {
"server1": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse" // or remote-mcp-server-authless.your-account.workers.dev/sse
],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Secure your server by setting environment variables and enabling rate limiting to prevent unauthorized access.
Q: Can I deploy the Remote MCP Server on other cloud providers? A: Yes, while Cloudflare Workers is used in this example for convenience, you can adapt the code to run on any server environment that supports Node.js, such as AWS Lambda or Google Functions.
Q: How do I secure my Remote MCP Server from potential security threats? A: Secure your server by setting up proper authentication and authorization mechanisms, using encrypted connections (HTTPS), and implementing rate limiting.
Q: Can I add more tools to the Remote MCP Server beyond those included in this example?
A: Absolutely! You can define additional tools within src/index.ts
as per your needs.
Q: Is there any specific tool required for deploying the Remote MCP Server locally or on Cloudflare Workers? A: You need to have Node.js and npm installed on your machine, along with the necessary dependencies like Cloudflare Worker SDK and Model Context Protocol tools.
Q: How do I ensure compatibility between my Remote MCP Server and different AI clients? A: Ensure you follow the Model Context Protocol documentation and guidelines for tool implementation to maintain compatibility across various AI platforms.
Contribute to the development of the Remote MCP Server by following these steps:
Explore more resources about the Model Context Protocol (MCP) and its applications:
By utilizing this Remote MCP Server, developers can enhance the capabilities of their AI applications through seamless integration with diverse tools and data sources.
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
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
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions
AI Vision MCP Server offers AI-powered visual analysis, screenshots, and report generation for MCP-compatible AI assistants
Analyze search intent with MCP API for SEO insights and keyword categorization