Cloudflare MCP Server
Cloudflare MCP Server lets an MCP client (e.g. Claude) run Cloudflare zone, DNS, cache, Workers KV, and analytics operations in plain English.
Zones —
list_zones(filter by name/status, paginated),get_zone(full details by ID).DNS records —
list_dns_records(filter by type, name, content), plus create, update and delete records with TTL, proxy status, priority and comments.Cache —
purge_cacheeverything, or target specific files, tags or hosts.Workers KV — list namespaces, list keys (prefix/cursor), and read, write or delete values, with optional metadata and expiry TTL.
Analytics —
get_zone_analyticsfor requests, bandwidth, threats and pageviews over a time range.Safety model — 7 read-only tools; 6 mutate state (DNS create/update/delete, cache purge, KV write/delete), so tokens need matching Cloudflare permissions.
Provides comprehensive management of Cloudflare resources including zones, DNS records, Workers KV storage, cache purging, and analytics through the Cloudflare API
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., "@Cloudflare MCP Server list 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.
✨ Ask things like
"List my zones." "Point staging.example.com at 203.0.113.10, proxied, then purge the cache." "Which DNS records point at the old server?" "Purge just /assets/app.css." "How much traffic and how many threats did example.com see this week?" "Store
maintenance=truein theflagsKV namespace."
Related MCP server: cloudflare-api-mcp
🧰 13 tools, and the permissions they need
Group | Tools | Token permission |
Zones |
| Zone · Zone · Read |
DNS |
| Zone · DNS · Edit |
Workers KV |
| Account · Workers KV Storage · Edit, plus |
Cache |
| Zone · Cache Purge · Purge |
Analytics |
| Zone · Analytics · Read |
Seven tools only read. Six change things: creating, updating or deleting DNS records, purging the cache, and writing or deleting KV keys. A token without a permission can't use those tools, so grant only what you need.
🚀 Setup
1. Create an API token. In the Cloudflare dashboard, go to My Profile → API Tokens → Create Token. Start from the Edit zone DNS template, or build a custom token from the table above. Limit it to the zones you want the server to touch.
2. Find your Account ID (Workers KV only). It's on any zone's Overview page, in the right-hand column.
3. Install. You need Python 3.10+ and uv.
git clone https://github.com/ry-ops/cloudflare-mcp-server
cd cloudflare-mcp-server
uv sync4. Connect Claude Desktop. Add this to claude_desktop_config.json: ~/Library/Application Support/Claude/ on macOS, or %APPDATA%\Claude\ on Windows.
{
"mcpServers": {
"cloudflare": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/cloudflare-mcp-server", "run", "cloudflare-mcp-server"],
"env": {
"CLOUDFLARE_API_TOKEN": "your_api_token",
"CLOUDFLARE_ACCOUNT_ID": "your_account_id"
}
}
}
}The server reads only environment variables: CLOUDFLARE_API_TOKEN (required) and CLOUDFLARE_ACCOUNT_ID (for KV). Quit and reopen Claude Desktop to load it. There are more examples in EXAMPLES.md, and a short walkthrough in QUICKSTART.md.
🔒 Security
Scope the token to specific zones and only the permissions you need. The Edit zone DNS template plus Zone Read is enough for most DNS work.
Keep your MCP client's tool approval on. Deleting DNS records and purging cache take effect immediately.
Keep the token out of git. Put it in your client's
envblock, or in a secrets manager.
🤝 Agent-to-agent (A2A)
agent-card.json describes the server to other agents. It has five skills (zone management, DNS management, KV storage, cache management and analytics), and the minimum and recommended token permissions for each.
🩺 Troubleshooting
The token is wrong or is missing a permission for that tool. Check it against the table above, and that its zone resources include the zone you asked about.
Set CLOUDFLARE_ACCOUNT_ID, and give the token Account · Workers KV Storage · Edit.
Use an absolute path in --directory, run uv sync once in the project, check the JSON is valid, and quit Claude Desktop completely before reopening it.
🛠️ Development
uv sync
uv run cloudflare-mcp-server # stdio serverAll the code is in src/cloudflare_mcp_server/__init__.py. See CONTRIBUTING.md and CHANGELOG.md.
License
MIT. See LICENSE.
Available Tools
13 toolscreate_dns_recordB
Create a new DNS record in a zone. Supports all DNS record types.
Inputs: zone_id (required), type (required), name (required), content (required), +4 more.
delete_dns_recordB
Delete a DNS record from a zone
Inputs: zone_id (required), record_id (required).
delete_kv_valueB
Delete a key from Workers KV storage
Inputs: namespace_id (required), key (required), account_id.
get_zoneA
Get detailed information about a specific zone by zone ID
Inputs: zone_id (required).
get_zone_analyticsB
Get analytics data for a zone including requests, bandwidth, threats, and pageviews.
Inputs: zone_id (required), since, until.
list_dns_recordsB
List DNS records for a zone. Can filter by type, name, content, etc.
Inputs: zone_id (required), type, name, content, +2 more.
list_kv_keysA
List all keys in a Workers KV namespace. Supports pagination and prefix filtering.
Inputs: namespace_id (required), account_id, prefix, limit, +1 more.
list_kv_namespacesB
List all Workers KV namespaces in the account. KV is Cloudflare's key-value storage.
Inputs: account_id, page, per_page.
list_zonesB
List all zones (domains) in the Cloudflare account. Returns zone details including ID, name, status, and nameservers.
Inputs: name, status, page, per_page.
purge_cacheB
Purge Cloudflare's cache for a zone. Can purge everything or specific files/tags/hosts.
Inputs: zone_id (required), purge_everything, files, tags, +1 more.
read_kv_valueB
Read a value from Workers KV storage by key. Returns the stored value.
Inputs: namespace_id (required), key (required), account_id.
update_dns_recordB
Update an existing DNS record. Can modify type, name, content, TTL, proxy status, etc.
Inputs: zone_id (required), record_id (required), type (required), name (required), +5 more.
write_kv_valueC
Write a key-value pair to Workers KV storage. Can store text or metadata.
Inputs: namespace_id (required), key (required), value (required), account_id, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool targets a distinct operation within well-separated domains (DNS, KV, zones, cache, analytics). No two tools have overlapping purposes; an agent can easily distinguish them.
All tool names follow a consistent snake_case verb_noun pattern (e.g., create_dns_record, list_kv_keys). There are no deviations or mixed conventions.
With 13 tools covering DNS lifecycle, KV storage operations, zone queries, cache purging, and analytics, the count is well-scoped for a Cloudflare management server.
Core workflows are covered: DNS CRUD, KV operations (create/read/update/delete/list), zone listing/details, cache purge, and analytics. Minor gaps: no single DNS record retrieval (list can filter) and no zone creation, but overall coverage is strong.
Maintenance
Related MCP Connectors
Manage hosts, redirects, SSL, and traffic analytics from Claude and other AI assistants.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
29 DNS, SEO, SSL, security, WHOIS & mail tools for AI agents. Pay per call (x402) or card API key.
The agent-native cloud: database, functions, AI, storage, computers. 53 tools. OAuth or API key.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Cloudflare infrastructure including DNS records, cache purging, SSL settings, Workers, and analytics through the Cloudflare API. Eliminates dashboard context-switching by allowing natural language control of domain management and infrastructure operations.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with the Cloudflare REST API for managing DNS records, zones, and other Cloudflare resources.MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to manage Cloudflare DNS zones and records, including listing, creating, updating, and deleting DNS records through natural language.6MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to manage Cloudflare DNS records, including listing zones and records, and creating, updating, or deleting DNS records.681 npmMIT