mcp-cloudflare-crunchtools
MCP Cloudflare CrunchTools
一个用于 Cloudflare DNS、Transform Rules、Page Rules 和缓存管理的安全 MCP(模型上下文协议)服务器。
概述
该 MCP 服务器的设计目标:
默认安全 - 全面的威胁建模、输入验证和令牌保护
无第三方服务 - 通过 stdio 本地运行,您的 API 令牌绝不会离开您的机器
跨平台 - 支持 Linux、macOS 和 Windows
自动更新 - GitHub Actions 监控 CVE 并更新依赖
容器化 - 可在
quay.io/crunchtools/mcp-cloudflare获取,基于 Hummingbird Python 基础镜像构建
Related MCP server: Cloudflare API MCP
命名约定
组件 | 名称 |
GitHub 仓库 | |
容器 |
|
Python 包(PyPI) |
|
CLI 命令 |
|
模块导入 |
|
为什么选择 Hummingbird?
容器镜像基于 Hummingbird Python 基础镜像(来自 Project Hummingbird)构建,该镜像提供:
极低的 CVE 暴露 - Hummingbird 镜像仅包含最精简的软件包,与通用镜像相比大幅减少了攻击面
定期更新 - 安全补丁会及时应用,保持较低的 CVE 数量
为 Python 优化 - 预配置了 uv 包管理器的 Python 环境,实现快速、可复现的构建
生产就绪 - 专为生产工作负载设计,具备正确的信号处理和非 root 用户默认配置
这意味着您的 MCP 服务器运行在加固环境中,与典型的 Python 容器镜像相比漏洞更少。
功能特性
区域管理(2 个工具)
list_zones- 列出您的 API 令牌可访问的所有区域get_zone- 按 ID 或域名获取区域详情
DNS 记录(5 个工具)
list_dns_records- 带筛选条件地列出 DNS 记录get_dns_record- 获取单条 DNS 记录create_dns_record- 创建 A、AAAA、CNAME、MX、TXT、NS、SRV、CAA 记录update_dns_record- 更新现有记录delete_dns_record- 删除记录
Transform Rules(6 个工具)
list_request_header_rules/set_request_header_rules- 修改请求头list_response_header_rules/set_response_header_rules- 修改响应头list_url_rewrite_rules/set_url_rewrite_rules- URL 路径/查询重写
Page Rules(4 个工具)
list_page_rules- 列出所有页面规则create_page_rule- 创建重定向、缓存设置、SSL 模式update_page_rule- 修改现有规则delete_page_rule- 删除规则
缓存管理(1 个工具)
purge_cache- 按 URL、标签、主机、前缀或全部内容进行清除
安装
使用 uvx(推荐)
uvx mcp-cloudflare-crunchtools使用 pip
pip install mcp-cloudflare-crunchtools使用容器
podman run -e CLOUDFLARE_API_TOKEN=your_token \
quay.io/crunchtools/mcp-cloudflare配置
创建 Cloudflare API 令牌
导航到 API 令牌
点击"创建令牌"
在"创建自定义令牌"旁边点击"开始使用"
配置令牌名称
输入:
mcp-cloudflare-crunchtools
配置权限
权限部分每行有三个下拉菜单:
第一个下拉菜单:资源类型(
账户或区域)第二个下拉菜单:具体权限类别
第三个下拉菜单:访问级别(
读取或编辑)
点击"+ 添加更多"以添加每个权限行。如需完整管理权限,请添加:
资源
权限
访问级别
区域
区域
读取
区域
DNS
编辑
区域
Page Rules
编辑
区域
Transform Rules
编辑
区域
Cache Purge
清除
配置区域资源
第一个下拉菜单:选择"包含"
第二个下拉菜单:选择"所有区域"或"特定区域"
配置客户端 IP 地址过滤(可选)
点击"使用我的 IP"按钮,将令牌限制为仅限您当前的 IP 使用
创建并复制令牌
点击"继续到摘要"→"创建令牌"
重要提示:请立即复制令牌 - 它只会显示一次!
添加到 Claude Code
claude mcp add mcp-cloudflare-crunchtools \
--env CLOUDFLARE_API_TOKEN=your_token_here \
-- uvx mcp-cloudflare-crunchtools或者使用容器版本:
claude mcp add mcp-cloudflare-crunchtools \
--env CLOUDFLARE_API_TOKEN=your_token_here \
-- podman run -i --rm -e CLOUDFLARE_API_TOKEN quay.io/crunchtools/mcp-cloudflare按使用场景划分的权限集
只读(仅查看)
资源 | 权限 | 访问级别 |
区域 | 区域 | 读取 |
区域 | DNS | 读取 |
仅 DNS 管理
资源 | 权限 | 访问级别 |
区域 | 区域 | 读取 |
区域 | DNS | 编辑 |
完整管理(所有功能)
资源 | 权限 | 访问级别 |
区域 | 区域 | 读取 |
区域 | DNS | 编辑 |
区域 | Page Rules | 编辑 |
区域 | Transform Rules | 编辑 |
区域 | Cache Purge | 清除 |
使用示例
列出您的区域
User: List my Cloudflare zones
Assistant: [calls list_zones]创建 DNS 记录
User: Create an A record for www.example.com pointing to 192.168.1.1
Assistant: [calls create_dns_record with type=A, name=www, content=192.168.1.1]添加安全响应头
User: Add X-Content-Type-Options: nosniff to all responses for zone abc123...
Assistant: [calls set_response_header_rules with appropriate rule]清除缓存
User: Purge the cache for https://example.com/styles.css
Assistant: [calls purge_cache with files=["https://example.com/styles.css"]]安全性
该服务器将安全性作为首要设计目标。请参阅 SECURITY.md 了解:
威胁模型和攻击向量
纵深防御架构
令牌处理最佳实践
输入验证规则
审计日志记录
关键安全特性
令牌保护
以 SecretStr 类型存储(绝不会被意外记录)
仅通过环境变量提供(绝不会出现在文件或参数中)
从所有错误消息中清除
输入验证
所有输入均使用 Pydantic 模型
记录类型、操作采用白名单机制
对 ID 进行严格的格式验证
API 加固
硬编码 API 基础 URL(防止 SSRF)
TLS 证书验证
请求超时
响应大小限制
自动化 CVE 扫描
GitHub Actions 每周扫描依赖
安全更新自动创建 PR
启用 Dependabot 警报
开发
环境搭建
git clone https://github.com/crunchtools/mcp-cloudflare.git
cd mcp-cloudflare
uv sync运行测试
uv run pytest代码检查与类型检查
uv run ruff check src tests
uv run mypy src构建容器
podman build -t mcp-cloudflare .许可证
AGPL-3.0-or-later
贡献
欢迎贡献!在提交与安全相关的更改之前,请先阅读 SECURITY.md。
链接
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
- Alicense-quality-maintenanceA lightweight MCP server for managing DNS records, purging cache, and interacting with the Cloudflare API through natural language commands.24
- Alicense-qualityDmaintenanceA lightweight MCP server that enables agents to interface with Cloudflare's REST API, allowing management of DNS records and other Cloudflare services.515GPL 2.0
- Alicense-quality-maintenanceA 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.
- Alicense-qualityCmaintenanceMCP server for managing Cloudflare DNS across multiple zones from a single API token, enabling bulk operations like toggling proxy, listing records, and batch updates.18MIT
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloud-hosted MCP server for durable AI memory
A MCP server built for developers enabling Git based project management with project and personal…
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/crunchtools/mcp-cloudflare'
If you have feedback or need assistance with the MCP directory API, please join our Discord server