
Cloudflare API 的 MCP 服务器
概览
一个高效的令牌管理 MCP 服务器,支持整个 Cloudflare API。2500 个端点,1k 令牌,由代码模式驱动。 只需连接到MCP服务器的URL——你会被重定向到Cloudflare进行授权和权限选择。 用于CI/CD、自动化,或者如果你喜欢自己管理代币。 创建一个带有你需要权限的Cloudflare API令牌。两个都支持。对于账户令牌,包含权限,这样服务器才能自动检测你的账户ID。 启用的 API 令牌目前不被支持。 如果你的MCP客户端已经使用代码模式,或者你用另一个使用代码模式的服务器组合了这台服务器,你可以用 ?codemode=false 查询参数禁用它。这样会为每个~2,500个Cloudflare API端点注册一个独立工具,而不是代码模式API工具。文档工具在两种模式下都保持可用。 禁用代码模式时:- 每个API端点注册为独立工具(例如:
概述(AI 翻译)
一个高效的令牌管理的 MCP 服务器,支持整个 Cloudflare API。2500 个端点,1k 令牌,由代码模式驱动。
代币比较
| 方法 | 工具 | 代币成本 | 使用的上下文(200K) |
|---|---|---|---|
| 提示词中的Raw OpenAPI规范 | — | ~2,000,000 | 977% |
| 原生MCP(完整模式) | 2,594 | 1,170,523 | 585% |
| 原生MCP(最小——仅需参数) | 2,594 | 244,047 | 122% |
| 代码模式 | 3 | ~1,100 | 0.5% |
开始
MCP 网址:https://mcp.cloudflare.com/mcp
选项1:OAuth(推荐)
只需连接到MCP服务器的URL——你会被重定向到Cloudflare进行授权和权限选择。
示例 JSON 配置
选项2:API令牌
用于CI/CD、自动化,或者如果你喜欢自己管理代币。
创建一个带有你需要权限的 Cloudflare API 令牌。用户令牌和账户令牌都支持。对于账户令牌,请添加账户资源:读取权限,这样服务器可以自动检测你的账户ID。
注: 启用客户端IP地址过滤的API令牌目前不被支持。
添加到代理人
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
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
{
"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
{
"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
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"cloudflare-api": {
"type": "http",
"url": "https://mcp.cloudflare.com/mcp"
}
}
}