Managing DNS at Scale with Claude and Cloudflare

DNS management across many domains gets easier when you connect Claude to the Cloudflare API: it reads every zone at once, builds an inventory, flags stale and risky records, checks SPF and DMARC against your standard and proposes changes. A person approves each change before it is applied, and each change is verified after.

One domain is simple. Ten domains, each touched by a different vendor, agency or former employee over several years, become a problem nobody owns.

The usual symptoms:

  • Records pointing at services you cancelled
  • DMARC on some domains, missing on others
  • SPF records drifted until no two match
  • Nobody able to answer "what is in our DNS?" without opening each zone by hand

We run several domains of our own on Cloudflare, with a mix of Microsoft 365 and Google Workspace mailboxes, marketing senders and form senders. More and more of the routine work now runs through Claude, with a person approving every change. Below is how that works, what it is good for, and the guardrails that make it safe on production DNS.

How does Claude connect to Cloudflare?

Claude connects through MCP (Model Context Protocol), an open standard for connecting AI assistants to tools and data. An MCP server sits between Claude and a system's API and exposes actions Claude can call, such as listing zones or reading DNS records.

Cloudflare publishes an official MCP server for its API at mcp.cloudflare.com. According to Cloudflare's documentation, it covers the full Cloudflare API, including DNS, and supports two ways to authenticate:

  • An interactive OAuth flow where you choose which permissions to grant
  • A Cloudflare API token passed as a bearer token, for automated use

Our article on what MCP servers are covers the broader idea.

Which MCP servers can manage domains and DNS?

What a domain management MCP server can do depends on the provider's API and on what the server exposes. Check the action list before you assume it can edit records.

  • Cloudflare's official MCP server: reads and edits DNS records across zones, plus the rest of the Cloudflare API. This is what we use.
  • Registrar connectors: the GoDaddy connector we have tried in Claude covers domain availability checks and name suggestions, not DNS record edits.
  • Providers without an MCP server: a gateway such as Composio, or a small custom MCP server, can wrap the provider's API. Scope the API token the same way you would for Cloudflare.

If your DNS is spread across several providers, consolidating onto one DNS host first makes everything below simpler.

Job 1: Inventory every zone

Start with a read-only inventory. It is the safest job and the one everything else builds on.

Ask Claude to pull every record from every zone in the account into a table: domain, name, type, value, TTL, proxy status. With an MCP connection to Google Sheets or Excel, it writes that table straight to a workbook with one tab per domain and a summary tab.

Questions that used to take an afternoon now take a minute:

  • Which domains have MX records, and which mail provider does each use?
  • Which domains have no DMARC record at all?
  • Which subdomains point at third-party services, and what are those services?
  • Which records are proxied through Cloudflare, and should they be?
  • Which records have unusually long or short TTLs?

Save the inventory. It is your baseline, and the next run compares against it to show exactly what changed.

Job 2: Find stale and risky records

Old records are a security problem, not just clutter. A CNAME that still points at a hosting or SaaS service you stopped paying for can, in some cases, let someone else claim that service name and serve content on your subdomain. Records pointing at old IP addresses can do the same if those addresses are reassigned.

Claude works through the inventory and flags candidates:

  • CNAMEs pointing at platforms commonly used for hosting, landing pages or help desks, so you can confirm each is still in use
  • A records pointing at addresses that no longer respond or belong to a provider you have left
  • Verification TXT records for services you no longer use
  • Subdomains named old, test, dev, staging or after a former vendor
  • Duplicate records, such as two SPF records on the same name

Our take: treat this as a list for review, not a list for deletion. Verification records in particular look stale but may still be checked by an active service.

The win is that a person reviews a short, specific list instead of scrolling through every zone.

Job 3: Standardize SPF and DMARC

Email authentication is where DNS drift does the most damage and where a consistent standard pays off fastest. With the inventory in hand, Claude compares every domain's SPF, DKIM and DMARC records against the standard you define.

A typical standard for a multi-domain business:

  • Domains that send mail: one SPF record that includes only the services that actually send for that domain, ending in -all or ~all depending on how confident you are in the list; DKIM enabled for each sender; and a DMARC record with an enforcing policy once reports confirm everything passes.
  • Domains that never send mail: an SPF record that allows nothing and a DMARC record with a reject policy, so nobody can spoof them.
example-parked.com.         TXT  "v=spf1 -all"
_dmarc.example-parked.com.  TXT  "v=DMARC1; p=reject"

Claude flags:

  • SPF records with two v=spf1 entries
  • Includes for services you no longer use
  • More than the ten DNS lookups the SPF standard allows

It can also cross-check DKIM by looking for the selector records each of your mail providers and senders uses.

DMARC aggregate reports are one decision that gets easier at scale. While you are tightening policy, reports sent to the rua address are useful. Once domains are stable, the daily XML reports often become noise.

On our own domains we removed the rua address once everything was passing consistently. Doing that across every zone in one reviewed batch beat doing it by hand. Our guide to DMARC reports covers when to keep them and when to turn them off.

Job 4: How do you make bulk DNS changes safely?

Propose, review, then apply. This is where the time savings are largest and where discipline matters most, and we run the same three steps every time.

  1. Propose. Claude reads the current records and produces a change plan: for each zone, the exact record being added, edited or deleted, with the current value and the new value side by side. Nothing changes at this stage.
  2. Review. A person reads the plan and approves it, edits it, or removes items. For large batches, we approve in groups, starting with low-risk zones.
  3. Apply and verify. Claude applies only the approved changes, one at a time, and after each change reads the record back from Cloudflare and checks it with a public DNS lookup to confirm it matches the plan.

Write the plan to a spreadsheet. It makes review easy, and the same sheet becomes the change log.

A typical row: zone, record name, type, old value, new value, reason, approver, time applied, verification result.

What guardrails make AI-assisted DNS management safe?

The same controls you would put on a new employee with admin access. These are the ones we consider non-negotiable.

Scoped API tokens

Never use a global API key. Create Cloudflare API tokens with only the permissions the task needs. Cloudflare lets you choose a permission such as Zone DNS Read or Zone DNS Edit and restrict it to specific zones.

  • Read-only token (DNS Read) for inventory and audit work. Most sessions should never need more.
  • Edit token only for a planned change window, limited to the zones in that change.
  • Token expiration date set, plus client IP address filtering if the connection runs from a known location.
  • Edit tokens revoked when the change is done.

A written change log

Record every change with the old value, new value, reason and approver. The log is how you reverse a change quickly, and it is what you show an auditor or a new IT lead.

Cloudflare's own audit log records changes made through the API as well, which gives you a second record.

Verification after each change

Apply one, read it back, confirm it resolves correctly from outside, then move to the next. Do not batch everything and check at the end.

If a change does not verify, stop the batch.

Extra care with mail and delegation

Treat MX, SPF, DKIM and DMARC changes as higher risk, and test mail after applying them.

If you only do one thing: keep nameserver changes, DNSSEC changes and zone deletions out of automated batches entirely. A person does those deliberately, every time.

Keep a snapshot

Export the current records for each affected zone before any batch of changes. If something goes wrong, you restore from a known good state instead of reconstructing it from memory.

Who is this approach for?

Companies with several domains, a lean IT team, and a leader who wants to understand and control what is in DNS without learning every record type by heart.

It also fits PE-backed groups consolidating acquired businesses, where each new company arrives with its own domains and its own history.

We set this up as part of our DNS management service:

  • Connect Claude to Cloudflare with scoped tokens
  • Build the initial inventory
  • Agree a standard
  • Run the first cleanup with the review-then-apply process

If your domains are not on Cloudflare yet, start with our guide to DNS migration to Cloudflare.

Frequently asked questions

Is it safe to give an AI assistant access to DNS?

It can be, with the right controls. Use scoped API tokens limited to specific zones, keep most work read-only, require human approval of a written change plan before anything is applied, verify each change after it is made, and keep a change log. Never automate nameserver or DNSSEC changes.

Do I need to be technical to use Claude for DNS management?

No. You ask questions in plain English and review proposed changes in a readable table. You do need someone who understands DNS to set the standard and approve higher-risk changes, at least at the start.

What Cloudflare API permissions does Claude need?

For inventory and audits, a token with DNS Read permission on the relevant zones is enough. For changes, a token with DNS Edit permission limited to the zones being changed, ideally with an expiration date. Avoid global API keys.

Can Claude manage DNS that is not on Cloudflare?

Yes, the approach is the same with any DNS provider that has an API and an MCP server or similar connector. Cloudflare is convenient because it has a well-documented API and an official MCP server, which is one reason we consolidate client domains there.

How often should we audit DNS across our domains?

A full inventory at least quarterly, and after any acquisition, vendor change or mail platform change. Comparing each inventory to the last one makes changes you did not expect stand out quickly.