Cloudflare MCP Server

MCP运维云端

提供方 cloudflare

运维云端 未标注 会话登录 社区 / 第三方 ClaudeCursorGemini CLICodex
查看接入方式

Cloudflare MCP Server Model Context Protocol (MCP) is a [new, standardized protocol](https://modelcontextprotocol.io/introduction) for managing context between large language models (LLMs) and external systems. In this repository, you can find several MCP servers allowing you to connect to Cloudflare's service from an MCP client (e.g. Cursor, Claude) and use natural language to accomplish tasks

一句话选型结论

按资料字段整理

Cloudflare MCP Server 属于运维云端类 MCP 服务器,传输方式未标注,会话登录,可直接接入 Claude、Cursor、Gemini CLI 等,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类运维云端 传输方式未标注 鉴权会话登录 部署方式未标注
GitHub 星标 未标注 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

运维云端
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

cloudflare api management mcp

支持客户端

适用场景

cloudflareapi managementmcp

安装与配置

未标注 会话登录
上游未给出传输方式
\t\t\t"command": "npx",

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    按官方文档确认运行环境(常见为 Node.js 或 Python),装好后再执行安装命令。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
云资源查询

查实例、存储、账单等云上资源状态。

部署与发布

把部署、重启、回滚这类操作接进对话。

监控与告警

拉取监控指标,异常时让模型帮你判断。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已适配 Claude、Cursor、Gemini CLI,换客户端不用重新研究配置。

先想清楚的地方

  • 使用前要准备好会话登录对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在运维云端场景里让模型直接调用外部能力的人。
  • 已经在用 Claude、Cursor 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
Cloudflare MCP Server当前 未标注 未标注 未标注 有 未标注
lobehub 未标注 stdio · 本地进程 本地部署 有 2026-04-11
TrendRadar 未标注 stdio · 本地进程 本地部署 有 2026-04-13
Ui Tars Desktop 8a825770 未标注 stdio · 本地进程 本地部署 有 2026-05-17
ruflo 未标注 stdio · 本地进程 本地部署 有 2026-04-13
FastGPT 未标注 stdio · 本地进程 本地部署 有 2026-04-11

服务器档案

运维云端
字段来自项目仓库与公开索引,中文说明由本站标注
提供方cloudflare上游标注的维护方 cloudflare
分类运维云端本站按上游分类展示
连接方式未标注上游未给出传输方式
鉴权方式会话登录远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · node本地安装时用到的包标识与运行时
部署类型未标注上游给出的部署形态
最近核验未标注上游最后核验时间

详细介绍

9.3 KB
来自项目仓库与上游目录的原文,未做删改

Cloudflare MCP Server

> A token-efficient MCP server for the entire Cloudflare API. 2500 endpoints in 1k tokens, powered by Code Mode.

Token Comparison

Approach Tools Token cost Context used (200K)
Raw OpenAPI spec in prompt — ~2,000,000 977%
Native MCP (full schemas) 2,594 1,170,523 585%
Native MCP (minimal — required params only) 2,594 244,047 122%
Code mode 3 ~1,100 0.5%

Get Started

MCP URL: https://mcp.cloudflare.com/mcp

Option 1: OAuth (Recommended)

Just connect to the MCP server URL - you'll be redirected to Cloudflare to authorize and select permissions.

Example JSON Configuration```json

{
"mcpServers": {
"cloudflare-api": {
"type": "http",
"url": "https://mcp.cloudflare.com/mcp"
}
}
}


### Option 2: API Token

For CI/CD, automation, or if you prefer managing tokens yourself.

Create a Cloudflare API token with the permissions you need. Both **user tokens** and **account tokens** are supported. For account tokens, include the **Account Resources : Read** permission so the server can auto-detect your account ID.

> **Note:** API tokens with **Client IP Address Filtering** enabled are not currently supported.

### Add to Agent

| Setting      | Value                                                                       |
| ------------ | --------------------------------------------------------------------------- |
| MCP URL      | `https://mcp.cloudflare.com/mcp`                                            |
| Bearer Token | Your Cloudflare API Token |

### Disable Code Mode

If your MCP client already uses code mode, or you're composing this server with another server that uses code mode, you can disable it with the `?codemode=false` query parameter. This registers an individual tool for each of the ~2,500 Cloudflare API endpoints instead of the code mode API tools. The `docs` and `whoami` tools remain available in both modes.```
https://mcp.cloudflare.com/mcp?codemode=false

Example JSON Configuration```json

{
"mcpServers": {
"cloudflare-api": {
"type": "http",
"url": "https://mcp.cloudflare.com/mcp?codemode=false"
}
}
}


When code mode is disabled:
- Each API endpoint is registered as its own tool (e.g., `get_workers_scripts`, `post_d1_database`)
- Tool input schemas are derived from the endpoint's path parameters, query parameters, and request body
- Tools make direct API calls — no code execution involved
- Path parameters like `account_id` are auto-resolved when possible (single account)

> **Note:** Disabling code mode significantly increases the token cost (~244k tokens vs ~1k tokens). Only disable it when necessary for composition with other code mode systems.

### Tool Result Truncation

In code mode, the server caps each `search` and `execute` result at ~6,000 tokens, to avoid context overload. Oversized JSON stays valid JSON: long lists keep their first items whole, long strings are clipped, and every cut is marked with `--- TRUNCATED ---`. An agent that writes a result straight to a file or pipe, rather than reading it into the conversation, can pass `truncate: false` to that call to get the whole result.

> **Note:** Without the cap, a broad query can return megabytes. Only turn it off when the result doesn't go to the model.

With code mode disabled, endpoint tools return whole results. The clients that disable it usually run code mode themselves: they call the endpoint tools from their own code and parse each result, so a capped result would lose data.

### Missing Permissions

When Cloudflare refuses a call because the OAuth connection lacks a scope, the server asks the client to re-authorize with that scope added to the ones it already has. Claude and other clients that follow the MCP authorization spec get a `403 insufficient_scope` challenge. Codex and ChatGPT get it in the tool result, which is where they look for it. Either way, the tool error says which scope is missing. Some endpoints, such as `GET /zones`, don't refuse: they answer with an empty list when the scope is missing. An empty list from a read the connection holds no accepted scope for is refused the same way, so it isn't mistaken for an empty account.

## The Problem

The Cloudflare OpenAPI spec is **2 million tokens**. Even with native MCP tools using minimal schemas, it's still **~244k tokens**. Traditional MCP servers that expose every endpoint as a tool leak this entire context to the main agent.

This server solves the problem by using **code execution** in a Code Mode pattern - the spec lives on the server, and only the result of the code execution is returned to the agent.

## Tools

Agent writes code to search the spec and execute API calls. It can also search Cloudflare's developer documentation directly.

| Tool      | Description                                                                   |
| --------- | ----------------------------------------------------------------------------- |
| `docs`    | Search Cloudflare developer documentation                                     |
| `search`  | Write JavaScript to query `spec.paths` and find endpoints                     |
| `execute` | Write JavaScript to call `cloudflare.request()` with the discovered endpoints |
| `whoami`  | Return the Cloudflare user or account this connection is authenticated as     |

Agent MCP Server
│ │
├──search({code: "..."})───────►│ Execute code against spec.json
│◄──[matching endpoints]────────│
│ │
├──execute({code: "..."})──────►│ Execute code against Cloudflare API
│◄──[API response]──────────────│


`whoami` takes no arguments and returns `{ id, email }` for a user credential or `{ id, name }` for an account token. The `id` is `user:` or `account:`, so it stays the same across token refresh, reconnection and permission changes. Clients can use it to tell connected accounts apart; it is marked as an OpenAI profile tool.

## Skills

The server also serves the Cloudflare skills (Wrangler, Durable Objects, Agents SDK, Workers best practices and more) through the MCP Skills extension. Clients that support it discover them with `skills/list` and read each file at `skill:///`. The catalog is synced from GitHub every six hours.

## Supported Products

Workers, KV, R2, D1, Pages, DNS, Firewall, Load Balancers, Stream, Images, AI Gateway, Vectorize, Access, Gateway, and more. The server ships the OpenAPI document from a pinned Forge release (`openapi.forge.json`), updated by pull request.

## Usage

Once configured, just ask your agent to do things with Cloudflare:

- "List all my Workers"
- "Create a KV namespace called 'my-cache'"
- "Add an A record for api.example.com pointing to 192.0.2.1"

The agent will search for the right endpoints and execute the API calls. Here's what happens behind the scenes:```javascript
// 1. Search for endpoints
search({
  code: `async () => {
    const results = [];
    for (const [path, methods] of Object.entries(spec.paths)) {
      for (const [method, op] of Object.entries(methods)) {
        if (op.tags?.some(t => t.toLowerCase() === 'workers')) {
          results.push({ method: method.toUpperCase(), path, summary: op.summary });
        }
      }
    }
    return results;
  }`,
});

// 2. Execute API call (user token - account_id required)
execute({
  code: `async () => {
    const response = await cloudflare.request({
      method: "GET",
      path: \`/accounts/\${accountId}/workers/scripts\`
    });
    return response.result;
  }`,
  account_id: "your-account-id",
});

// 2. Execute API call (account token - account_id auto-detected)
execute({
  code: `async () => {
    const response = await cloudflare.request({
      method: "GET",
      path: \`/accounts/\${accountId}/workers/scripts\`
    });
    return response.result;
  }`,
});

GraphQL Analytics API

The server automatically detects and handles Cloudflare's GraphQL Analytics API endpoints. GraphQL queries work seamlessly through the same execute tool:javascript execute({ code: `async () => { const response = await cloudflare.request({ method: "POST", path: "/client/v4/graphql", body: { query: \`query { viewer { zones(filter: { zoneTag: "your-zone-id" }) { httpRequests1dGroups(limit: 7, orderBy: [date_ASC]) { dimensions { date } sum { requests bytes cachedBytes } } } } }\`, variables: {} } }); return response.result; }`, account_id: "your-account-id", });

Build a Code Mode MCP Server

Code execution uses Cloudflare's Dynamic Worker Loader API to run generated code in isolated Workers, following the Code Mode pattern.

Read the Code Mode SDK docs for more info.

Resources

  • Code Mode blog post
  • Build your own remote MCP server
  • Cloudflare's own MCP Servers

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
Cloudflare MCP Server 怎么安装?

在客户端按下面的安装命令接入:\t\t\t"command": "npx",。装完在客户端配置里引用同一个包或端点。

Cloudflare MCP Server 怎么在 Claude、Cursor、Gemini CLI 里配置?

它的传输方式未标注,在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,配置才会生效。

Cloudflare MCP Server 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Cloudflare MCP Server 需要 API Key 吗?

资料标注需要会话登录认证,使用前准备好对应凭据,并按最小权限配置。

Cloudflare MCP Server 支持哪些客户端?

资料标注支持 Claude、Cursor、Gemini CLI、Codex、Zed;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

Cloudflare MCP Server 能提供哪些能力?

资料显示能力标签包括 cloudflare、api management、mcp。具体工具清单以官方文档为准。

Cloudflare MCP Server 需要什么运行环境?

运行时为 node。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 未标注。