123hi123/remote-mcp-server-authless
If you are the rightful owner of remote-mcp-server-authless and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This document provides a comprehensive overview of setting up a remote Model Context Protocol (MCP) server on Cloudflare without authentication.
Building a Remote MCP Server on Cloudflare (With API Key Authentication)
This example allows you to deploy a remote MCP server with API key authentication on Cloudflare Workers. The server now requires a valid API key to access the MCP tools, providing better security for your deployment.
Get started:
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 below to get the remote MCP Server created on your local machine:
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
API Key Authentication
The MCP server now includes API key authentication. By default, the API key is set to "password"
, but you can customize this by:
- Environment Variable: Set
MCP_API_KEY
in your Cloudflare Worker's environment variables - Wrangler Config: Modify the
vars.MCP_API_KEY
value inwrangler.jsonc
Setting a Custom API Key
To set a custom API key, update the wrangler.jsonc
file:
{
"vars": {
"MCP_API_KEY": "your-secure-api-key-here"
}
}
Authentication Methods
The server accepts API keys via multiple methods:
- Authorization Header:
Authorization: Bearer your-api-key
- X-API-Key Header:
X-API-Key: your-api-key
- Query Parameter:
?api_key=your-api-key
Customizing your MCP Server
To add your own tools to the MCP server, define each tool inside the init()
method of src/index.ts
using this.server.tool(...)
.
Connect to Cloudflare AI Playground
You can connect to your MCP server from the Cloudflare AI Playground, which is a remote MCP client:
- Go to https://playground.ai.cloudflare.com/
- Enter your deployed MCP server URL (
remote-mcp-server-authless.<your-account>.workers.dev/sse
) - Provide your API key when prompted
- You can now use your MCP tools directly from the playground!
Connect Claude Desktop to your MCP server
You can also connect to your remote MCP server from local MCP clients, by using the mcp-remote proxy.
To connect to your MCP server from Claude Desktop, follow Anthropic's Quickstart and within Claude Desktop go to Settings > Developer > Edit Config.
Update with this configuration:
{
"mcpServers": {
"calculator": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse", // or remote-mcp-server-authless.your-account.workers.dev/sse
"password" // Replace with your actual API key
]
}
}
}
Note: The third argument in the args
array is your API key. Make sure to replace "password"
with your actual API key.
Restart Claude and you should see the tools become available after authentication.
Health Check
You can check if your server is running by visiting the root endpoint:
GET /
orGET /health
- Returns server status (no authentication required)
Security Features
- All MCP endpoints (
/sse
,/mcp
) now require valid API key authentication - Multiple authentication methods supported for flexibility
- Configurable API keys via environment variables
- Health check endpoint remains publicly accessible