Skip to main content
Glama

在 Cloudflare 上构建远程 MCP 服务器(无需认证)

此示例允许你在 Cloudflare Workers 上部署一个不要求认证的无状态远程 MCP 服务器。它实现了 MCP 2026-07-28 规范,同时与旧客户端兼容,可进行普通工具调用。

快速开始:

Deploy to Workers

这会将你的 MCP 服务器部署到类似这样的 URL:remote-mcp-server-authless.<your-account>.workers.dev/mcp

或者,你也可以使用下面的命令行在本地机器上创建远程 MCP 服务器:

npm create cloudflare@latest -- my-mcp-server --template=cloudflare/ai/demos/remote-mcp-authless

Related MCP server: remote-mcp-server-authless

自定义你的 MCP 服务器

要向 MCP 服务器添加你自己的工具,请使用 server.registerTool(...) 在 src/index.ts 中的 createServer() 函数中创建的 McpServer 上注册每个工具。

连接到 Cloudflare AI Playground

你可以从 Cloudflare AI Playground(一个远程 MCP 客户端)连接到你的 MCP 服务器:

  1. 前往 https://playground.ai.cloudflare.com/

  2. 输入你部署的 MCP 服务器 URL(remote-mcp-serverless.authless.<your-account>.workers.dev/mcp)

  3. 现在你就可以直接在 playground 中使用你的 MCP 工具了!

将 Claude Desktop 连接到你的 MCP 服务器

你也可以通过使用 mcp-remote 代理 从本地 MCP 客户端连接到你的远程 MCP 服务器。

要从 Claude Desktop 连接到你的 MCP 服务器,请按照 Anthropic 的快速入门 操作,并在 Claude Desktop 中前往“设置 > 开发者 > 编辑配置”。

使用以下配置进行更新:

{
	"mcpServers": {
		"calculator": {
			"command": "npx",
			"args": [
				"mcp-remote",
				"http://localhost:8787/mcp" // or remote-mcp-server-authless.your-account.workers.dev/mcp
			]
		}
	}
}

重启 Claude,你应该会看到这些工具变为可用。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Deploys a stateless remote MCP server on Cloudflare Workers without authentication, enabling users to connect custom MCP tools to clients such as Cloudflare AI Playground and Claude Desktop.
      -