cloudflare-mcp
You can discover and manage Cloudflare zones and DNS records; however, the supplied schema implements only 7 zone/DNS tools and excludes the README-advertised Email Routing tools.
List zones visible to the API token, filtering by exact zone name or status, optionally scoped to
CLOUDFLARE_ACCOUNT_ID.Retrieve detailed information for a single zone by zone ID.
List DNS records in a zone, filtering by type, exact name, or content.
Retrieve a single DNS record’s details by zone ID and record ID.
Create DNS records such as A, AAAA, CNAME, MX, TXT, etc., specifying content, TTL, comments, proxy state, and priority where applicable.
Partially update existing DNS records so only passed fields change.
Irreversibly delete a DNS record from a zone.
Provides tools for managing Cloudflare zones and DNS records, including listing and inspecting zones, and listing, retrieving, creating, updating, and deleting DNS records within a zone.
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 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.
Cloudflare MCP — Zones & DNS Management
13 tools for Cloudflare zone/DNS management and Email Routing — for Claude Desktop, Claude Code, and any MCP client.
Unofficial. This is an independent, community-built project — not affiliated with, endorsed by, or sponsored by Cloudflare.
What is this?
Cloudflare MCP is a Model Context Protocol server that gives AI assistants structured access to the Cloudflare API v4 — zones (domains), their DNS records, and Email Routing (destination addresses + forwarding rules).
It deliberately covers only this slice. Cloudflare's REST API is enormous — Workers, KV/R2/D1, cache purging, general zone settings, Analytics, Radar, and more — and Cloudflare already ships more than a dozen product-specific MCP servers of its own for that surface. This one stays narrow: zones, DNS records, and the Email Routing feature (which itself just manages a specific set of DNS records plus destination-address verification and rule matching). Cache purging and other zone-settings edits are explicitly out of scope for v1 — they change how traffic is served for an entire domain and deserve their own deliberate tool design later, not a bolt-on here.
Supported platform: any MCP client on macOS, Linux, or Windows with Python 3.12+.
Related MCP server: Cloudflare MCP Server
Tools
Category | Tools | What you can do |
Zones | 2 | List zones (domains) visible to the token, fetch one by ID |
DNS Records | 5 | List/filter, fetch, create, update, and delete DNS records within a zone |
Email Routing | 6 | Enable routing on a zone, manage destination addresses, manage forwarding rules |
Tool | Description |
| List zones visible to this API token, optionally filtered by name/status |
| Fetch one zone's details by zone ID |
| List DNS records in a zone, optionally filtered by type/name/content |
| Fetch one DNS record's details by record ID |
| Create a DNS record (A, AAAA, CNAME, MX, TXT, NS, CAA, SRV, etc.) |
| Partially update an existing DNS record — only the fields you pass change |
| Delete a DNS record (irreversible) |
| Enable Email Routing on a zone (auto-adds/locks the required MX + SPF-include records) |
| List destination addresses on the account (shared across all zones), with verification status |
| Add a destination address (triggers a verification email, unless it's the account's own login email) |
| List forwarding rules for a zone |
| Create a rule forwarding one exact address to a verified destination |
A note on Email Routing permissions
Beyond the base Zone:DNS:Edit/Zone:Zone:Read above, Email Routing needs three more token permissions: Account → Email Routing Addresses → Edit, Zone → Email Routing Rules → Edit, and Zone → Zone Settings → Edit (the last one specifically gates the enable/disable toggle — easy to miss since it's not obviously "email" named). CLOUDFLARE_ACCOUNT_ID is required, not optional, for the two account-scoped address tools.
If a zone already has MX/SPF records from another provider (e.g. registrar-based forwarding), remove those first with delete_dns_record — Cloudflare Email Routing's own MX records will conflict with them otherwise, and SPF only allows one TXT record.
Requirements
Requirement | Version |
Python | 3.12 or later |
any recent version | |
Cloudflare account | with at least one zone (domain) added |
Cloudflare API token | scoped, created via the dashboard (see below) |
Authentication
Cloudflare API tokens are simple bearer credentials — no OAuth flow, no refresh step. Setup:
Go to dash.cloudflare.com/profile/api-tokens and click Create Token.
Choose Create Custom Token.
Under Permissions, add:
Zone→Zone→ReadZone→DNS→Edit
Under Zone Resources, scope it to Specific zone and pick the domain(s) this server should be able to touch — avoid "All zones" unless you actually need it. This is the principle of least privilege: a leaked token scoped to one zone can't touch the rest of the account.
Click Continue to summary, then Create Token. Copy it immediately — Cloudflare shows it once.
Put it in
.env(see Installation).
CLOUDFLARE_ACCOUNT_ID is optional — only needed if the token has access to more than one Cloudflare account and you want list_zones scoped to a specific one. Find it on the right sidebar of any domain's Overview page in the dashboard.
If the token is ever exposed, revoke it from the same API Tokens page — this immediately invalidates it account-wide.
Installation
git clone https://github.com/jimsimoy/cloudflare-mcp.git
cd cloudflare-mcp
uv sync
cp .env.example .env # fill in CLOUDFLARE_API_TOKEN (and CLOUDFLARE_ACCOUNT_ID if needed)Run directly:
uv run cloudflare-mcpClient Setup
{
"mcpServers": {
"cloudflare": {
"command": "uv",
"args": ["--directory", "/path/to/cloudflare-mcp", "run", "cloudflare-mcp"],
"env": {
"CLOUDFLARE_API_TOKEN": "...",
"CLOUDFLARE_ACCOUNT_ID": "..."
}
}
}
}Restart your MCP client after saving. The 7 Cloudflare tools will appear automatically.
Usage Examples
See what's in the account
List my Cloudflare zones, then list the DNS records for the first onePoint a subdomain at a new IP
Create an A record for api.example.com pointing to 203.0.113.10 in zone
<zone_id>, not proxied, TTL automaticUpdate an existing record
Update DNS record <record_id> in zone <zone_id> to change its content to
203.0.113.20Clean up a stale record
Delete DNS record <record_id> from zone <zone_id>Security
The credential (
CLOUDFLARE_API_TOKEN) is read from the environment only —.envand.env.*(except.env.example) are gitignored.A Cloudflare API token is a long-lived credential. Scope it to specific zones and only the permissions listed above; treat it like a password and revoke it at dash.cloudflare.com/profile/api-tokens if it's ever exposed.
create_dns_record,update_dns_record, anddelete_dns_recordmake real changes to live DNS — a wrongdelete_dns_recordcall can take a subdomain offline. There's no confirmation step in the server itself; that judgment call belongs to whatever is driving the MCP client.Cache purging, zone settings (SSL mode, security level, page rules, etc.), and anything outside zones/DNS are out of scope for this server by design — see What is this?.
Project Structure
src/cloudflare_mcp/
server.py # MCP server entry point and tool definitions
client.py # Cloudflare API client (bearer auth, pagination, error unwrapping)
config.py # Credential loading from the environmentThe server communicates over stdio using JSON-RPC 2.0, the standard MCP transport.
A note on testing
This was built directly from Cloudflare's official REST API v4 reference (zone and DNS record endpoints, request/response shapes, and the success/errors/result/result_info envelope), with pagination and error handling covered by manual verification of the client against that reference. It has not been exercised against a live Cloudflare account — no API token was available in this environment at build time. Before relying on it, run it against a real account starting with the read-only tools (list_zones, list_dns_records) and confirm the shapes match what you expect before trying create_dns_record / update_dns_record / delete_dns_record.
License
MIT — free to use, modify, and distribute.
Available Tools
7 toolscreate_dns_recordA
Create a DNS record in a zone.
type is one of A, AAAA, CNAME, MX, TXT, NS, CAA, SRV, etc. name is the record name (e.g. 'www.example.com' or '@' for the zone apex). content is the record's value (an IP for A/AAAA, a hostname for CNAME/MX, etc.). ttl is in seconds; 1 means "automatic". proxied routes traffic through Cloudflare's proxy (orange cloud) — only valid for A/AAAA/CNAME records. priority is required for MX and some SRV/URI records.
Inputs: name (required), type (required), content (required), zone_id (required), +4 more. Returns: object
delete_dns_recordC
Delete a DNS record from a zone. This is irreversible.
Inputs: zone_id (required), dns_record_id (required). Returns: object
get_dns_recordA
Fetch one DNS record's details by its ID within a zone.
Inputs: zone_id (required), dns_record_id (required). Returns: object
get_zoneA
Fetch one zone's details by its Cloudflare zone ID.
Inputs: zone_id (required). Returns: object
list_dns_recordsA
List DNS records in a zone, optionally filtered by type, name, or content.
type is a record type such as A, AAAA, CNAME, MX, TXT, NS, CAA, SRV, etc. name is an exact record name (e.g. 'www.example.com'). content filters by the record's value (e.g. an IP address).
Inputs: zone_id (required), name, type, content. Returns: result
list_zonesA
List zones (domains) visible to this API token.
name filters to an exact zone name (e.g. 'example.com'). status filters
by zone status (e.g. 'active', 'pending'). Automatically scoped to
CLOUDFLARE_ACCOUNT_ID if that's set in the environment.
Inputs: name, status. Returns: result
update_dns_recordA
Partially update an existing DNS record. Only the fields you pass are changed.
Inputs: zone_id (required), dns_record_id (required), ttl, name, +5 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 7 tools
Each tool has a clearly distinct purpose: zone retrieval vs. listing, and DNS records are fully separated into get/list/create/update/delete. No overlapping functionality.
All tools follow a consistent verb_noun snake_case pattern (e.g., get_zone, list_dns_records, update_dns_record), making the API predictable and easy to navigate.
Seven tools are well-scoped for managing zones and DNS records, covering the essential operations without unnecessary bloat.
The set provides full CRUD for DNS records and read operations for zones, which covers the typical Cloudflare management workflow. No obvious gaps for common use cases.
Maintenance
Related MCP Connectors
Zendesk MCP server for ChatGPT, Claude and any AI agent: list tickets, reply to ticket, update ticket, apply macro, add internal note and search tickets in your own Zendesk account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Zendesk yourself; Cotlet does not store your password and you need no Zendesk API key. About the official Zendesk API: Zendesk has a full REST API, the Support API (also called the Ticketing API), but no documented Zendesk-hosted MCP server for working tickets (checked 16 Oct 2026). Zendesk's MCP documentation covers the MCP client, where Zendesk calls other servers. Setup and FAQ: https://cotlet.dev/integrations/zendesk-api-mcp-server
Sunsama MCP server for ChatGPT, Claude and any AI agent: list tasks for a day, create task, timebox task to the calendar, move task to a day or the backlog, log actual time, complete task, add subtask and list weekly objectives in your own Sunsama account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Sunsama yourself; Cotlet does not store your password and you need no Sunsama API key. About the official Sunsama API: Sunsama has no documented public API (checked 6 Nov 2026). It runs an official MCP server at api.sunsama.com/mcp, out of beta since 27 Aug 2026 and included in the Pro plan, with OAuth sign-in; Sunsama has not published a list of its tools. Setup and FAQ: https://cotlet.dev/integrations/sunsama-api-mcp-server
Flickr MCP server for ChatGPT, Claude and any AI agent: list albums, upload photo, edit title and tags, move photos between albums, change privacy, reply to comment and add photo to group in your own Flickr account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Flickr yourself; Cotlet does not store your password and you need no Flickr API key. About the official Flickr API: Flickr has a full REST API with methods for photos, albums, comments, groups and uploads, but no official MCP server (checked 17 Oct 2026). Only Flickr Pro subscribers can request new API keys, and commercial use needs a separate commercial key, by prior arrangement with Flickr. Setup and FAQ: https://cotlet.dev/integrations/flickr-api-mcp-server
Quickbase MCP server for ChatGPT, Claude and any AI agent: list apps and tables, run report, search records, create record, update record, export report to CSV, list app users and change user role in your own Quickbase account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Quickbase yourself; Cotlet does not store your password and you need no Quickbase API key. About the official Quickbase API: Quickbase has a full RESTful API and an older XML API, but no official MCP server (checked 23 Oct 2026). The API adds, edits, deletes and searches records and builds tables and fields, and you call it with a user token that inherits your role. Setup and FAQ: https://cotlet.dev/integrations/quickbase-api-mcp-server
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server implementation that allows AI agents to manage DNS records for domains hosted on Cloudflare by providing tools to list, create, update, and delete various types of DNS records.570 npm3GPL 3.0
- AlicenseAqualityCmaintenanceEnables AI assistants to manage Cloudflare resources through natural language, including DNS records, zone management, Workers KV storage, cache purging, and analytics. Supports comprehensive Cloudflare operations with secure API token authentication.132MIT
- 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