Cloudflare MCP server
Commit Nov 1, 2026Manage Cloudflare zones, DNS records, cache, Workers KV, and analytics through natural language conversations.
Also known as ry-ops/cloudflare-mcp-server
- Stars
- 2
- Tools
- —
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 1, 2026
- License
- MIT
What is Cloudflare MCP?
Cloudflare manages Cloudflare zones, DNS records, cache, Workers KV, and analytics through natural language conversations.
Summary generated from the project's README
About Cloudflare MCP server
Managing Cloudflare infrastructure through natural language conversations is what this MCP server enables for developers and DevOps engineers. By connecting to an MCP client like Claude Desktop, you can control zones, DNS records, cache settings, Workers KV, and analytics using plain English commands. The server runs locally via Python 3.10+ and requires a Cloudflare API token provided through environment variables.
Users can perform read-only tasks or execute changes such as updating DNS records, purging specific cache files, or writing values to KV namespaces. The server includes thirteen specialized tools organized into five functional groups: Zones, DNS, Workers KV, Cache, and Analytics. While DNS and cache management only require zone-level permissions, managing Workers KV also necessitates a Cloudflare Account ID and specific account-level storage permissions.
What you can do with it
- 1Update DNS and clear cacheDirect an AI to point a specific subdomain to a new IP address and immediately purge the cache.
- 2Manage Workers KV storageStore or retrieve configuration flags within a Workers KV namespace using conversational commands.
- 3Analyze traffic and security dataRequest a summary of website traffic, bandwidth usage, or detected threats for a specific zone.
- 4Audit DNS configurationsIdentify which DNS records are currently pointing to an outdated server address.
Written from the project's README. Every use case is checked against a quote from it.
Configuration
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKEN
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablery-ops/cloudflare-mcp-server is public and reachablegithub.com/ry-ops/cloudflare-mcp-server ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-01github.com/ry-ops/cloudflare-mcp-server ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model0 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNot checked
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHub✨ 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."
🧰 13 tools, and the permissions they need
| Group | Tools | Token permission |
|---|---|---|
| Zones | list_zones, get_zone |
Zone · Zone · Read |
| DNS | list_dns_records (filter by type, name or content), create_dns_record, update_dns_record, delete_dns_record |
Zone · DNS · Edit |
| Workers KV | list_kv_namespaces, list_kv_keys, read_kv_value, write_kv_value, delete_kv_value |
Account · Workers KV Storage · Edit, plus CLOUDFLARE_ACCOUNT_ID |
| Cache | purge_cache (everything, or specific files, tags or hosts) |
Zone · Cache Purge · Purge |
| Analytics | get_zone_analytics (requests, bandwidth, threats, pageviews) |
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 sync
4. 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 server
All the code is in src/cloudflare_mcp_server/__init__.py. See CONTRIBUTING.md and CHANGELOG.md.
License
MIT. See LICENSE.
Cloudflare MCP questions
How do I use Workers KV with this server?
You must provide the CLOUDFLARE_ACCOUNT_ID environment variable and ensure your token has Account Workers KV Storage Edit permissions.
Can I purge specific files from the cache?
Yes, the purge_cache tool allows you to purge everything or specific files, tags, or hosts.
What if I get a 401 or 403 error?
This usually means the API token is incorrect or lacks the necessary permissions for the requested tool.