Remote MCP Server with Bearer Auth
Cloudflare 上的远程 MCP 服务器
让我们在 Cloudflare Workers 上启动并运行一个远程 MCP 服务器,并完成 OAuth 登录!
本地开发
# clone the repository
git clone git@github.com:cloudflare/ai.git
# install dependencies
cd ai
npm install
# run locally
npx nx dev remote-mcp-server-bearer-auth您应该能够在浏览器中打开http://localhost:8787/
Related MCP server: Remote MCP Server on Cloudflare
将 MCP 检查器连接到您的服务器
要探索新的 MCP api,您可以使用MCP 检查器。
使用
npx @modelcontextprotocol/inspector启动在检查器中,将传输类型切换为
SSE,并输入http://localhost:8787/sse作为要连接的 MCP 服务器的 URL。添加承载令牌并点击“连接”
点击“列出工具”
运行“getToken”工具,它应该返回您在检查器中设置的授权标头
将 Claude Desktop 连接到您的本地 MCP 服务器
"remote-example": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:8787/sse",
"--header",
"Authorization: Bearer {token}"
]
}部署到 Cloudflare
npm run deploy
从远程 MCP 客户端调用新部署的远程 MCP 服务器
就像上面在“本地开发”中所做的那样,运行 MCP 检查器:
npx @modelcontextprotocol/inspector@latest
然后在检查器中输入您的 Worker 的workers.dev URL(例如: worker-name.account-name.workers.dev/sse )作为要连接的 MCP 服务器的 URL,然后点击“连接”。
现在,您已从远程 MCP 客户端连接到 MCP 服务器。您可以像上面提到的那样传入一个 bearer token
将 Claude Desktop 连接到远程 MCP 服务器
TODO:我们需要支持mcp-remote代理的任意标头
调试
如果出现任何问题,重新启动 Claude 或尝试使用以下命令在命令行上直接连接到 MCP 服务器会有所帮助。
npx mcp-remote http://localhost:8787/sse在极少数情况下,清除添加到~/.mcp-auth的文件可能会有所帮助
rm -rf ~/.mcp-authThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceA Cloudflare Workers-based implementation of the Model Context Protocol server with OAuth login, allowing Claude and other MCP clients to connect to remote tools.1
- -licenseNot gradedqualityNot gradedmaintenanceA server implementation for the Model Context Protocol (MCP) that runs on Cloudflare Workers and supports OAuth login, allowing Claude AI to use custom tools through local or remote connections.1,284
- FlicenseNot gradedqualityCmaintenanceA Cloudflare Workers-based implementation of Model Context Protocol (MCP) server that enables AI tools like Claude to connect to external services through OAuth login.
- -licenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol server implementation that runs on Cloudflare Workers with OAuth authentication support, allowing users to connect MCP clients like Claude Desktop or the MCP Inspector to utilize remote AI tools.
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Hosted remote MCP server for YNAB on Cloudflare Workers with OAuth
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Appeared in Searches
- Information about SSE (possible meanings: Scottish and Southern Energy, Server-Sent Events, etc.)
- Finding MCP servers that support SSE or Streamable HTTP, excluding stdio transport
- How to Submit an Outpatient Medical Claim to AIA
- Using Server-Sent Events (SSE) in the Terminal
- A GitHub repository for an MCP server with a clear description of config.json
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/huanshenyi/mcp-server-bearer-auth'
If you have feedback or need assistance with the MCP directory API, please join our Discord server