mcp-cloudflare-crunchtools
This server provides MCP tools to manage Cloudflare zones, DNS records, transform rules, page rules, cache, analytics, and WAF rules.
Zone management: List and get details for Cloudflare zones
DNS management: List, get, create, update, and delete DNS records (A, AAAA, CNAME, MX, TXT, NS, SRV, CAA)
Transform rules: List and set request header, response header, and URL rewrite rules
Page rules: List, create, update, and delete page rules for redirects, caching, and SSL
Cache management: Purge cache by everything, files, tags, hosts, or prefixes
Analytics: Get zone traffic summaries, top pages, traffic by country, and security events
WAF management: List, create, update, and delete WAF custom rules
Manages Cloudflare zones, DNS records, transform rules, page rules, and cache purging.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-cloudflare-crunchtools list all DNS records for example.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 - 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-cloudflarebuilt on Hummingbird Python base image
Related MCP server: cloudflare-dns-mcp-server
Naming Convention
Component | Name |
GitHub repo | |
Container |
|
Python package (PyPI) |
|
CLI command |
|
Module import |
|
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 tokenget_zone- Get zone details by ID or domain name
DNS Records (5 tools)
list_dns_records- List DNS records with filteringget_dns_record- Get a single DNS recordcreate_dns_record- Create A, AAAA, CNAME, MX, TXT, NS, SRV, CAA recordsupdate_dns_record- Update existing recordsdelete_dns_record- Delete records
Transform Rules (6 tools)
list_request_header_rules/set_request_header_rules- Modify request headerslist_response_header_rules/set_response_header_rules- Modify response headerslist_url_rewrite_rules/set_url_rewrite_rules- URL path/query rewrites
Page Rules (4 tools)
list_page_rules- List all page rulescreate_page_rule- Create redirects, cache settings, SSL modesupdate_page_rule- Modify existing rulesdelete_page_rule- Remove rules
Access (8 tools)
get_access_organization- The Zero Trust organization and its team login domainlist_access_apps/get_access_app- Applications on a zone, with their audience tagscreate_access_app/delete_access_app- Put a hostname behind an Access login, or take it outlist_access_policies- Who an application admitscreate_access_policy/delete_access_policy- Allow, deny or bypass by email, email domain, IP or everyone
Cache Management (1 tool)
purge_cache- Purge by URL, tag, host, prefix, or everything
Installation
With uvx (Recommended)
uvx mcp-cloudflare-crunchtoolsWith pip
pip install mcp-cloudflare-crunchtoolsWith Container
podman run -e CLOUDFLARE_API_TOKEN=your_token \
quay.io/crunchtools/mcp-cloudflareConfiguration
Creating a Cloudflare API Token
Navigate to API Tokens
Click "Create Token"
Click "Get started" next to "Create Custom Token"
Configure Token Name
Enter:
mcp-cloudflare-crunchtools
Configure Permissions
The Permissions section has three dropdowns per row:
First dropdown: Resource type (
AccountorZone)Second dropdown: Specific permission category
Third dropdown: Access level (
ReadorEdit)
Click "+ Add more" to add each permission row. For full management, add:
Resource
Permission
Access
Zone
Zone
Read
Zone
DNS
Edit
Zone
Page Rules
Edit
Zone
Transform Rules
Edit
Zone
Cache Purge
Purge
Account
Access: Apps and Policies
Edit
Account
Access: Organizations, Identity Providers, and Groups
Read
Configure Zone Resources
First dropdown: Select "Include"
Second dropdown: Select "All zones" or "Specific zone"
Configure Client IP Address Filtering (Optional)
Click "Use my IP" button to restrict token to your current IP
Create and Copy Token
Click "Continue to summary" → "Create Token"
IMPORTANT: Copy the token immediately - it's only shown once!
Add to Claude Code
claude mcp add mcp-cloudflare-crunchtools \
--env CLOUDFLARE_API_TOKEN=your_token_here \
-- uvx mcp-cloudflare-crunchtoolsOr for the container version:
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-cloudflarePermission Sets by Use Case
Read-Only (viewing only)
Resource | Permission | Access |
Zone | Zone | Read |
Zone | DNS | Read |
DNS Management Only
Resource | Permission | Access |
Zone | Zone | Read |
Zone | DNS | Edit |
Full Management (all features)
Resource | Permission | Access |
Zone | Zone | Read |
Zone | DNS | Edit |
Zone | Page Rules | Edit |
Zone | Transform Rules | Edit |
Zone | Cache Purge | Purge |
Usage Examples
List Your Zones
User: List my Cloudflare zones
Assistant: [calls list_zones]Create a DNS Record
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
User: Add X-Content-Type-Options: nosniff to all responses for zone abc123...
Assistant: [calls set_response_header_rules with appropriate rule]Purge Cache
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
Token Protection
Stored as SecretStr (never accidentally logged)
Environment variable only (never in files or args)
Sanitized from all error messages
Input Validation
Pydantic models for all inputs
Allowlist for record types, actions
Strict format validation for IDs
API Hardening
Hardcoded API base URL (prevents SSRF)
TLS certificate validation
Request timeouts
Response size limits
Automated CVE Scanning
GitHub Actions scan dependencies weekly
Automatic PRs for security updates
Dependabot alerts enabled
Development
Setup
git clone https://github.com/crunchtools/mcp-cloudflare.git
cd mcp-cloudflare
uv syncRun Tests
uv run pytestLint and Type Check
uv run ruff check src tests
uv run mypy srcBuild Container
podman build -t mcp-cloudflare .License
AGPL-3.0-or-later
Contributing
Contributions welcome! Please read SECURITY.md before submitting security-related changes.
Links
Available Tools
34 toolscreate_access_app_toolCreate Access App ToolA
Put a hostname behind a Cloudflare Access login.
A new application has no policy and admits no one until create_access_policy adds one.
Inputs: name (required), domain (required), zone_id (required), session_duration. Returns: object
create_access_policy_toolCreate Access Policy ToolB
Add a policy to an Access application.
Each rule is an object with exactly one key: {"email": "user@example.com"}, {"email_domain": "example.com"}, {"ip": "203.0.113.0/24"} or {"everyone": true}.
Inputs: name (required), app_id (required), include (required), zone_id (required), +3 more. Returns: object
create_dns_record_toolCreate Dns Record ToolC
Create a new DNS record.
Inputs: name (required), type (required), content (required), zone_id (required), +4 more. Returns: object
create_page_rule_toolCreate Page Rule ToolC
Create a new page rule.
Inputs: actions (required), targets (required), zone_id (required), status, +1 more. Returns: object
create_waf_rule_toolCreate Waf Rule ToolA
Create a new WAF custom rule.
Free plans support up to 5 custom rules. Provide either zone_id or zone_name, not both.
Inputs: action, enabled, zone_id, zone_name, +2 more. Returns: object
delete_access_app_toolDelete Access App ToolB
Delete an Access application, leaving its hostname with no Access login.
Inputs: app_id (required), zone_id (required). Returns: object
delete_access_policy_toolDelete Access Policy ToolC
Delete a policy from an Access application.
Inputs: app_id (required), zone_id (required), policy_id (required). Returns: object
delete_dns_record_toolDelete Dns Record ToolC
Delete a DNS record.
Inputs: zone_id (required), record_id (required). Returns: object
delete_page_rule_toolDelete Page Rule ToolC
Delete a page rule.
Inputs: rule_id (required), zone_id (required). Returns: object
delete_waf_rule_toolDelete Waf Rule ToolB
Delete a WAF custom rule.
Provide either zone_id or zone_name, not both.
Inputs: rule_id (required), zone_id, zone_name. Returns: object
get_access_app_toolGet Access App ToolARead-only
Get one Access application, including its audience tag (aud).
Inputs: app_id (required), zone_id (required). Returns: object
get_access_organization_toolGet Access Organization ToolBRead-only
Get the Zero Trust organization behind a zone's Access applications.
Inputs: zone_id (required). Returns: object
get_dns_record_toolGet Dns Record ToolBRead-only
Get a single DNS record by ID.
Inputs: zone_id (required), record_id (required). Returns: object
get_security_events_toolGet Security Events ToolARead-only
Get security/firewall events grouped by action and source.
Provide either zone_id or zone_name, not both.
Inputs: limit, since, until, zone_id, +1 more. Returns: object
get_top_pages_toolGet Top Pages ToolBRead-only
Get top pages by request count.
Provide either zone_id or zone_name, not both.
Inputs: limit, since, until, zone_id, +1 more. Returns: object
get_traffic_by_country_toolGet Traffic By Country ToolARead-only
Get traffic breakdown by country.
Provide either zone_id or zone_name, not both.
Inputs: limit, since, until, zone_id, +1 more. Returns: object
get_zone_analytics_toolGet Zone Analytics ToolARead-only
Get zone traffic analytics summary.
Returns total requests, unique visitors, bandwidth, cache ratio, and status code breakdown for the given date range.
Provide either zone_id or zone_name, not both.
Inputs: since, until, zone_id, zone_name. Returns: object
get_zone_toolGet Zone ToolARead-only
Get Cloudflare zone details by ID or name.
Provide either zone_id or zone_name, not both.
Inputs: zone_id, zone_name. Returns: object
list_access_apps_toolList Access Apps ToolCRead-only
List the Access applications on a zone.
Inputs: zone_id (required). Returns: object
list_access_policies_toolList Access Policies ToolBRead-only
List the policies on an Access application.
Inputs: app_id (required), zone_id (required). Returns: object
list_dns_records_toolList Dns Records ToolCRead-only
List DNS records for a Cloudflare zone.
Inputs: zone_id (required), name, page, type, +2 more. Returns: object
list_page_rules_toolList Page Rules ToolCRead-only
List all page rules for a zone.
Inputs: zone_id (required), order, status. Returns: object
list_request_header_rules_toolList Request Header Rules ToolBRead-only
List request header modification rules.
Inputs: zone_id (required). Returns: object
list_response_header_rules_toolList Response Header Rules ToolCRead-only
List response header modification rules.
Inputs: zone_id (required). Returns: object
list_url_rewrite_rules_toolList Url Rewrite Rules ToolCRead-only
List URL rewrite rules.
Inputs: zone_id (required). Returns: object
list_waf_rules_toolList Waf Rules ToolARead-only
List all WAF custom rules for a zone.
Provide either zone_id or zone_name, not both.
Inputs: zone_id, zone_name. Returns: object
list_zones_toolList Zones ToolARead-only
List all Cloudflare zones accessible by the API token.
Inputs: name, page, status, per_page. Returns: object
purge_cache_toolPurge Cache ToolA
Purge cached content from Cloudflare's edge.
Use one of: purge_everything, files, tags, hosts, or prefixes. Every method works on every plan, Free included. Prefer hosts, prefixes, tags or files over purge_everything when only part of a zone is stale.
Inputs: zone_id (required), tags, files, hosts, +2 more. Returns: object
set_request_header_rules_toolSet Request Header Rules ToolA
Set request header modification rules (replaces all existing rules).
Each rule should have:
expression: Filter expression (e.g., "true" for all requests)
description: Human-readable description
action: "rewrite"
action_parameters: {"headers": {"Header-Name": {...}}}
Inputs: rules (required), zone_id (required). Returns: object
set_response_header_rules_toolSet Response Header Rules ToolA
Set response header modification rules (replaces all existing rules).
Each rule should have:
expression: Filter expression (e.g., "true" for all responses)
description: Human-readable description
action: "rewrite"
action_parameters: {"headers": {"Header-Name": {...}}}
Inputs: rules (required), zone_id (required). Returns: object
set_url_rewrite_rules_toolSet Url Rewrite Rules ToolA
Set URL rewrite rules (replaces all existing rules).
Each rule should have:
expression: Filter expression
description: Human-readable description
action: "rewrite"
action_parameters: {"uri": {"path": {"value": "..."}, "query": {"value": "..."}}}
Inputs: rules (required), zone_id (required). Returns: object
update_dns_record_toolUpdate Dns Record ToolC
Update an existing DNS record.
Inputs: zone_id (required), record_id (required), ttl, name, +5 more. Returns: object
update_page_rule_toolUpdate Page Rule ToolC
Update an existing page rule.
Inputs: rule_id (required), zone_id (required), status, actions, +2 more. Returns: object
update_waf_rule_toolUpdate Waf Rule ToolB
Update an existing WAF custom rule.
Provide either zone_id or zone_name, not both.
Inputs: rule_id (required), action, enabled, zone_id, +3 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 34 tools
Each tool targets a distinct Cloudflare resource and action (zones, DNS records, header rules, URL rewrite rules, page rules, cache, analytics, WAF, Access apps/policies), and the separate rule types are clearly differentiated by their names. No two tools appear to perform the same operation.
All 34 tools use a consistent snake_case verb_noun pattern with a uniform _tool suffix, using standard verbs like list/get/create/update/delete/set/purge. The only variation is 'set_' for replace-all operations, which is semantically appropriate and consistent across the header/URL rewrite tools.
34 tools is on the heavy side for an MCP server, exceeding the typical 3-15 range, though the breadth of Cloudflare features (DNS, WAF, Access, analytics, etc.) provides some justification. The set is not bloated with redundant tools, but a more consolidated approach could reduce count while keeping coverage.
Core CRUD is strong for DNS, WAF, and page rules, but there are notable lifecycle gaps: Access applications and policies lack update operations, and no tool exists for zone settings or SSL configuration. These gaps could force agents into delete-and-recreate workarounds for common Access management tasks.
Maintenance
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloudflare Workers MCP server: ai-guardrails
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Cloudflare Workers MCP server: ai-token-counter
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 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.-
- AlicenseNot gradedqualityCmaintenanceMCP server for managing Cloudflare DNS across multiple zones from a single API token, enabling bulk operations like toggling proxy, listing records, and batch updates.38 npmMIT

Cloudflare MCP Serverofficial
AlicenseNot gradedqualityBmaintenanceA token-efficient MCP server that provides access to the entire Cloudflare API (2500+ endpoints) using a code execution pattern, enabling natural language management of Cloudflare services.11 npm1,090Apache 2.0