Back to Blog
How to Use Cloudflare MCP with Claude Code
Manage Cloudflare Workers, DNS records, KV storage, R2 buckets, and security settings from Claude Code without opening the Cloudflare dashboard.
cloudflarecdnedgeworkersclaude-code
What is the Cloudflare MCP?
The Cloudflare MCP connects Claude Code to the Cloudflare API, enabling it to manage your zone configuration, deploy and test Workers, manipulate DNS records, access KV namespaces and R2 buckets, and configure security settings like WAF rules and Page Rules — all without leaving your editor.
Installation
mcpizy install cloudflare
Create a Cloudflare API token at dash.cloudflare.com/profile/api-tokens with permissions scoped to the resources you need (Zone:Read, Worker Scripts:Edit, etc.). Provide the token and your Account ID during setup.
Key Capabilities
- Manage DNS records — list, create, update, and delete A, CNAME, TXT, and MX records.
- Deploy Workers — upload and publish Cloudflare Workers scripts.
- Access KV storage — read and write key-value pairs in Workers KV namespaces.
- Manage R2 buckets — list buckets, upload objects, and configure CORS policies.
- Configure Page Rules and cache — purge the CDN cache for specific URLs after deployments.
Example Usage
After deploying a new version, purge the CDN cache for your homepage:
// Claude will:
// 1. Identify the zone for your domain
// 2. Call the Cloudflare cache purge API for the specific URLs
// 3. Confirm the purge was successful
Tips and Best Practices
- Use scoped API tokens — never use your Global API Key; create tokens with minimum necessary permissions.
- Pair with Vercel MCP — Vercel handles your Next.js deployment while Cloudflare provides the CDN and DNS layer.
- Use Cloudflare Workers KV for edge-side feature flags — ask Claude to read and update flags during canary releases.
- Combine with Terraform MCP to manage Cloudflare infrastructure as code.
Found this useful? Share it.