MCP Cloudflare

DevOps

by crunchtools

面向 Cloudflare DNS、Transform Rules 和 Page Rules 的安全 MCP 服务器。

什么是 MCP Cloudflare

面向 Cloudflare DNS、Transform Rules 和 Page Rules 的安全 MCP 服务器。

README

MCP Cloudflare CrunchTools

A secure MCP (Model Context Protocol) server for Cloudflare DNS, Transform Rules, Page Rules, and cache management.

Overview

This MCP server is designed to be:

  • Secure by default - Comprehensive threat modeling, input validation, and token protection
  • No third-party services - Runs locally via stdio, your API token never leaves your machine
  • Cross-platform - Works on Linux, macOS, and Windows
  • Automatically updated - GitHub Actions monitor for CVEs and update dependencies
  • Containerized - Available at quay.io/crunchtools/mcp-cloudflare built on Hummingbird Python base image

Naming Convention

ComponentName
GitHub repocrunchtools/mcp-cloudflare
Containerquay.io/crunchtools/mcp-cloudflare
Python package (PyPI)mcp-cloudflare-crunchtools
CLI commandmcp-cloudflare-crunchtools
Module importmcp_cloudflare_crunchtools

Why Hummingbird?

The container image is built on the Hummingbird Python base image from Project Hummingbird, which provides:

  • Minimal CVE exposure - Hummingbird images are built with a minimal package set, dramatically reducing the attack surface compared to general-purpose images
  • Regular updates - Security patches are applied promptly, keeping CVE counts low
  • Optimized for Python - Pre-configured Python environment with uv package manager for fast, reproducible builds
  • Production-ready - Designed for production workloads with proper signal handling and non-root user defaults

This means your MCP server runs in a hardened environment with fewer vulnerabilities than typical Python container images

Features

Zone Management (2 tools)

  • list_zones - List all zones accessible by your API token
  • get_zone - Get zone details by ID or domain name

DNS Records (5 tools)

  • list_dns_records - List DNS records with filtering
  • get_dns_record - Get a single DNS record
  • create_dns_record - Create A, AAAA, CNAME, MX, TXT, NS, SRV, CAA records
  • update_dns_record - Update existing records
  • delete_dns_record - Delete records

Transform Rules (6 tools)

  • list_request_header_rules / set_request_header_rules - Modify request headers
  • list_response_header_rules / set_response_header_rules - Modify response headers
  • list_url_rewrite_rules / set_url_rewrite_rules - URL path/query rewrites

Page Rules (4 tools)

  • list_page_rules - List all page rules
  • create_page_rule - Create redirects, cache settings, SSL modes
  • update_page_rule - Modify existing rules
  • delete_page_rule - Remove rules

Cache Management (1 tool)

  • purge_cache - Purge by URL, tag, host, prefix, or everything

Installation

With uvx (Recommended)

bash
uvx mcp-cloudflare-crunchtools

With pip

bash
pip install mcp-cloudflare-crunchtools

With Container

bash
podman run -e CLOUDFLARE_API_TOKEN=your_token \
    quay.io/crunchtools/mcp-cloudflare

Configuration

Creating a Cloudflare API Token

  1. Navigate to API Tokens

  2. Configure Token Name

    • Enter: mcp-cloudflare-crunchtools
  3. Configure Permissions

    The Permissions section has three dropdowns per row:

    • First dropdown: Resource type (Account or Zone)
    • Second dropdown: Specific permission category
    • Third dropdown: Access level (Read or Edit)

    Click "+ Add more" to add each permission row. For full management, add:

    ResourcePermissionAccess
    ZoneZoneRead
    ZoneDNSEdit
    ZonePage RulesEdit
    ZoneTransform RulesEdit
    ZoneCache PurgePurge
  4. Configure Zone Resources

    • First dropdown: Select "Include"
    • Second dropdown: Select "All zones" or "Specific zone"
  5. Configure Client IP Address Filtering (Optional)

    • Click "Use my IP" button to restrict token to your current IP
  6. Create and Copy Token

    • Click "Continue to summary" → "Create Token"
    • IMPORTANT: Copy the token immediately - it's only shown once!

Add to Claude Code

bash
claude mcp add mcp-cloudflare-crunchtools \
    --env CLOUDFLARE_API_TOKEN=your_token_here \
    -- uvx mcp-cloudflare-crunchtools

Or for the container version:

bash
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

Permission Sets by Use Case

Read-Only (viewing only)

ResourcePermissionAccess
ZoneZoneRead
ZoneDNSRead

DNS Management Only

ResourcePermissionAccess
ZoneZoneRead
ZoneDNSEdit

Full Management (all features)

ResourcePermissionAccess
ZoneZoneRead
ZoneDNSEdit
ZonePage RulesEdit
ZoneTransform RulesEdit
ZoneCache PurgePurge

Usage Examples

List Your Zones

code
User: List my Cloudflare zones
Assistant: [calls list_zones]

Create a DNS Record

code
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]

Add Security Headers

code
User: Add X-Content-Type-Options: nosniff to all responses for zone abc123...
Assistant: [calls set_response_header_rules with appropriate rule]

Purge Cache

code
User: Purge the cache for https://example.com/styles.css
Assistant: [calls purge_cache with files=["https://example.com/styles.css"]]

Security

This server was designed with security as a primary concern. See SECURITY.md for:

  • Threat model and attack vectors
  • Defense in depth architecture
  • Token handling best practices
  • Input validation rules
  • Audit logging

Key Security Features

  1. Token Protection

    • Stored as SecretStr (never accidentally logged)
    • Environment variable only (never in files or args)
    • Sanitized from all error messages
  2. Input Validation

    • Pydantic models for all inputs
    • Allowlist for record types, actions
    • Strict format validation for IDs
  3. API Hardening

    • Hardcoded API base URL (prevents SSRF)
    • TLS certificate validation
    • Request timeouts
    • Response size limits
  4. Automated CVE Scanning

    • GitHub Actions scan dependencies weekly
    • Automatic PRs for security updates
    • Dependabot alerts enabled

Development

Setup

bash
git clone https://github.com/crunchtools/mcp-cloudflare.git
cd mcp-cloudflare
uv sync

Run Tests

bash
uv run pytest

Lint and Type Check

bash
uv run ruff check src tests
uv run mypy src

Build Container

bash
podman build -t mcp-cloudflare .

License

AGPL-3.0-or-later

Contributing

Contributions welcome! Please read SECURITY.md before submitting security-related changes.

Links

<!-- mcp-name: io.github.crunchtools/cloudflare -->

常见问题

MCP Cloudflare 是什么?

面向 Cloudflare DNS、Transform Rules 和 Page Rules 的安全 MCP 服务器。

相关 Skills

环境密钥管理

by alirezarezvani

Universal
热门

统一梳理dev/staging/prod的.env和密钥流程,自动生成.env.example、校验必填变量、扫描Git历史泄漏,并联动Vault、AWS SSM、1Password、Doppler完成轮换。

统一管理环境变量、密钥与配置,减少泄露和部署混乱,安全治理与团队协作一起做好,DevOps 场景很省心。

DevOps
未扫描15.4k

可观测性设计

by alirezarezvani

Universal
热门

面向生产系统规划可落地的可观测性体系,串起指标、日志、链路追踪与 SLI/SLO、错误预算、告警和仪表盘设计,适合搭建监控平台与优化故障响应。

把监控、日志、链路追踪串起来,帮助团队从设计阶段构建可观测性,排障更快、系统演进更稳。

DevOps
未扫描15.4k

更新日志

by alirezarezvani

Universal
热门

基于 Conventional Commits 自动解析提交记录、判断语义化版本升级并生成规范 changelog,适合在 CI、发版前检查提交格式并批量输出可审计发布说明。

自动生成和管理更新日志与发布说明,帮团队把版本变更说清楚;聚焦版本化与流程自动化,省时又更规范。

DevOps
未扫描15.4k

相关 MCP Server

kubefwd

编辑精选

by txn2

热门

kubefwd 是让 AI 帮你批量转发 Kubernetes 服务到本地的开发神器。

微服务开发者最头疼的本地调试问题,它一键搞定——自动分配 IP 避免端口冲突,还能用自然语言查询状态。但依赖 AI 工作流,纯命令行爱好者可能觉得不够直接。

DevOps
4.1k

Cloudflare

编辑精选

by Cloudflare

热门

Cloudflare MCP Server 是让你用自然语言管理 Workers、KV 和 R2 等云资源的工具。

这个工具解决了开发者频繁切换控制台和文档的痛点,特别适合那些在 Cloudflare 上部署无服务器应用、需要快速调试或管理配置的团队。不过,由于它依赖多个子服务器,初次设置可能有点繁琐,建议先从 Workers Bindings 这类核心功能入手。

DevOps
3.8k

Terraform

编辑精选

by hashicorp

热门

Terraform MCP Server 是让 AI 助手直接操作 Terraform Registry 和 HCP Terraform 的桥梁。

如果你经常在 Terraform 里翻文档找模块配置,这个服务器能省不少时间——直接问 Claude 就能生成准确的代码片段。最适合管理多云基础设施的团队,但注意它目前只适合本地使用,别在生产环境里暴露 HTTP 端点。

DevOps
1.4k

评论