@archawat/mcp-cloudflare
@archawat/mcp-cloudflare
模型上下文协议 (MCP) 服务器,用于通过单个 API 令牌管理多个区域(域名)的 Cloudflare DNS。专为批量工作流构建——可在多条记录间开启/关闭代理、审计跨区域的 DNS 以及批量更新记录。
功能
单令牌多区域 — 传入域名(如
"example.com"),服务器会自动为您解析区域。同时也支持区域 ID。批量操作 —
bulk_toggle_proxy、bulk_update_dns_record和bulk_list_dns_records可并发运行,并共享单次调用的区域 ID 缓存,因此重复的区域不会产生额外的查询成本。安全默认值 — 新创建的 A/CNAME 记录默认
proxied: false(仅 DNS,灰色云朵)。代理需手动开启。自动分页 —
list_dns_records会并行获取所有页面,除非您指定了特定页面。
Related MCP server: Cloudflare API MCP
安装
无需本地安装 — 使用 npx 或 bunx 即可按需运行。
Claude Code / Claude Desktop (.mcp.json)
通过 npx (Node):
{
"mcpServers": {
"cloudflare": {
"command": "npx",
"args": ["-y", "@archawat/mcp-cloudflare"],
"env": { "CLOUDFLARE_API_TOKEN": "cf-token-here" }
}
}
}通过 bunx (Bun):
{
"mcpServers": {
"cloudflare": {
"command": "bunx",
"args": ["-y", "@archawat/mcp-cloudflare"],
"env": { "CLOUDFLARE_API_TOKEN": "cf-token-here" }
}
}
}Claude Code CLI
claude mcp add cloudflare -s user \
-e CLOUDFLARE_API_TOKEN="cf-token-here" \
-- npx -y @archawat/mcp-cloudflare全局安装(冷启动最快)
npm install -g @archawat/mcp-cloudflare
# or: bun add -g @archawat/mcp-cloudflare全局二进制文件名为 mcp-cloudflare(无作用域),因此:
{
"mcpServers": {
"cloudflare": {
"command": "mcp-cloudflare",
"env": { "CLOUDFLARE_API_TOKEN": "cf-token-here" }
}
}
}API 令牌
在 https://dash.cloudflare.com/profile/api-tokens 创建 Cloudflare 令牌,并赋予以下权限:
Zone:ReadZone:DNS:Edit
将令牌范围限定为您要管理的区域,或授予“所有区域”权限。
工具
工具 | 用途 |
| 查看令牌可管理的域名。 |
| 列出区域中的记录;除非设置了 |
| 在一次调用中列出多个区域的记录。每个区域并发执行。 |
| 创建 A 记录。 |
| 创建 CNAME 记录。 |
| 通过记录 ID 或名称(+ 可选类型)切换代理开关。 |
| 在一次调用中为多条记录切换代理(共享 |
| 修补记录的 |
| 在一次调用中修补多条记录,支持每项单独设置字段。 |
| 通过 ID 删除记录。此操作具有破坏性。 |
所有工具均接受域名("example.com")或 32 位字符的区域 ID 作为 zone 参数。
批量结果格式
批量工具返回每项的结果;单项失败不会中止整个批次:
{
"succeeded": 10,
"failed": 1,
"results": [
{ "zone": "example.com", "ok": true, "record": { "id": "…", "proxied": true } },
{ "zone": "other.com", "ok": false, "error": "No proxyable record found for 'www.other.com'." }
]
}当任何一项失败时,工具响应中会设置 isError: true,同时仍会返回所有结果。
开发
需要 Bun(推荐)或 Node 18+。
bun install
bun run dev # run src/index.ts with --watch
bun run start # run src/index.ts once
bun run typecheck # tsc --noEmit
bun run build # emit dist/ for publishing要运行开发副本作为 MCP 服务器而不是已发布的包,请将 .mcp.json 指向您的本地构建:
{
"mcpServers": {
"cloudflare": {
"command": "bun",
"args": ["/abs/path/to/mcp-cloudflare/src/index.ts"],
"env": { "CLOUDFLARE_API_TOKEN": "cf-token-here" }
}
}
}服务器使用 stdio 通信 — 您的 MCP 客户端会启动该进程并通过 stdin/stdout 进行通信。
许可证
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Official Porkbun MCP server: domains, DNS, SSL, hosting and Cloudflare via the Porkbun API.
MCP server for DNSimple — domains, DNS zone records, availability, pricing and contacts.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceA lightweight MCP server for managing DNS records, purging cache, and interacting with the Cloudflare API through natural language commands.24-
- AlicenseNot gradedqualityDmaintenanceA lightweight MCP server that enables agents to interface with Cloudflare's REST API, allowing management of DNS records and other Cloudflare services.15GPL 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceA token-efficient MCP server for managing Cloudflare DNS zones and records with full CRUD support and bulk operations. It can be deployed locally via stdio or as a Cloudflare Worker for remote HTTP access.-
- AlicenseAqualityDmaintenanceMCP server for managing and analyzing Cloudflare DNS — zones, records, analytics, and DNSSEC.141MIT