Skip to main content
Glama
romeucampos

Cloudflare MCP Server — Code Mode

by romeucampos

Cloudflare MCP Server — 代码模式

无服务器入门模板,用于在 Cloudflare Workers 上构建远程 Model Context Protocol (MCP) 服务器。

该项目专为 代码模式 设计:客户端可以发现能力,并根据结构化响应组合工具调用。入门模板中不启用任意代码执行;只有在定义了沙箱、身份验证、限制和审计之后,才应添加该能力。

目标

  • 通过 Cloudflare Workers 在边缘运行。

  • /mcp 暴露一个 MCP 端点。

  • 保持工具小巧、类型化且可组合。

  • 准备 OAuth 身份验证和 Cloudflare 绑定。

  • 后续在隔离沙箱中实现安全的代码执行。

Related MCP server: Adi MCP

本地开发

先决条件:Node.js 18+ 以及一个启用了 Workers 的 Cloudflare 账户。

npm install
npm run dev

本地服务器在 http://localhost:8788/mcp 运行。

使用 MCP Inspector 验证:

npx @modelcontextprotocol/inspector@latest

部署

npx wrangler login
npm run deploy

部署完成后,端点将是:

https://<worker>.<account>.workers.dev/mcp

结构

  • src/index.ts:Worker 的 HTTP 路由。

  • src/mcp.ts:MCP 服务器和工具。

  • wrangler.jsonc:Worker 的配置。

  • PLAN.md:实现计划和验收标准。

安全

不要直接在 Worker 中添加 evalnew Function 或代码解释器。对于真正执行代码的代码模式,请使用合适的沙箱、强身份验证、API 允许列表、CPU/内存/时间限制、用户级隔离,以及不含敏感信息的日志。

后续步骤

参见 PLAN.md

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • F
    license
    Not graded
    quality
    B
    maintenance
    A remote MCP server that exposes tools from many services (X, LinkedIn, GitHub, Gmail, Notion, etc.) through a single endpoint on Cloudflare Workers, enabling unified access to third-party APIs via natural language.
  • F
    license
    Not graded
    quality
    C
    maintenance
    A stateless remote MCP server on Cloudflare Workers without authentication, supporting custom tool registration and integration with MCP clients like Cloudflare AI Playground and Claude Desktop.

View all related MCP servers

Related MCP Connectors

  • MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.

  • A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage

  • Remote MCP for GenAI span mapping, provider normalization, dashboard schemas, and receipts.

View all MCP Connectors

Latest Blog Posts

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/romeucampos/cloudflare-mcp-server-code-mode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server