Cloudflare 无认证AI服务器
一个基于 Cloudflare Workers 的模型上下文协议服务器,可以无需身份验证要求进行部署,允许用户创建从 Cloudflare AI Playground 或 Claude Desktop 可访问的自定义 AI 工具。
服务介绍
在 Cloudflare 上构建无需认证的远程 MCP 服务器
此示例允许你在 Cloudflare Workers 上部署一个不需要认证的远程 MCP 服务器。
开始使用:
这将把你的 MCP 服务器部署到类似这样的 URL:remote-mcp-server-authless.<your-account>.workers.dev/sse
或者,你可以使用以下命令行在本地机器上创建远程 MCP 服务器:
bash
npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless
自定义你的 MCP 服务器
要向 MCP 服务器添加你自己的 工具,请在 src/index.ts 的 init() 方法中使用 this.server.tool(...) 定义每个工具。
连接到 Cloudflare AI Playground
你可以从 Cloudflare AI Playground(这是一个远程 MCP 客户端)连接到你的 MCP 服务器:
- 前往 https://playground.ai.cloudflare.com/
- 输入你已部署的 MCP 服务器 URL (
remote-mcp-server-authless.<your-account>.workers.dev/sse) - 现在你可以直接从 playground 使用你的 MCP 工具了!
将 Claude Desktop 连接到你的 MCP 服务器
你还可以通过使用 mcp-remote 代理 从本地 MCP 客户端连接到你的远程 MCP 服务器。
要从 Claude Desktop 连接到你的 MCP 服务器,请遵循 Anthropic 的快速入门指南,并在 Claude Desktop 中进入设置 > 开发者 > 编辑配置。
更新为以下配置:
json
{
"mcpServers": {
"calculator": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse" // 或 remote-mcp-server-authless.your-account.workers.dev/sse
]
}
}
}
重启 Claude 后,你应该能看到工具已经可用。