316 查看 · 2026-07-07 更新
在 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 后,你应该能看到工具已经可用。
来源
- 来源:github
- 链接:https://github.com/narayanmishra1873/zaubacorp-mcp