domain-setup-mcp
Configures Amazon SES sending domains, including a custom MAIL FROM subdomain with SPF alignment and exactly one MX record as AWS requires, plus the three Easy DKIM CNAME tokens supplied per domain.
Manages DNS and redirect configuration in Cloudflare zones. Builds a reviewable per-domain diff of the records it intends to change, then applies each domain's DNS changes through Cloudflare's batch endpoint as a single atomic transaction, with a dry-run default, a zone fingerprint drift check to skip domains whose DNS changed after planning, and a full rollback that restores the original records and the previous redirect ruleset. Also handles token scope guidance (Zone Read, DNS Edit, Single Redirect Edit), Cloudflare rate-limit errors, and CNAME conflict detection.
Sets up Google Workspace sending domains: adds the google-site-verification TXT record, merges include:_spf.google.com into a single SPF record and recursively resolves it against live DNS to stay under lookup limits, sets the smtp.google.com MX record, and publishes the 2048-bit DKIM TXT key from the Admin console.
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., "@domain-setup-mcp audit SPF, DKIM and DMARC for my cold email domains"
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.
domain-setup-mcp
An MCP server for Claude and other MCP clients that sets up cold email domains in bulk on Cloudflare: verification TXT, SPF, DKIM, DMARC, MX, custom tracking domains and website forwarding. Works with Google Workspace, Microsoft 365 and Amazon SES, and with Smartlead and Instantly tracking.
Use it to audit email deliverability DNS, fix SPF records, add DMARC, and roll out sending domains for outbound campaigns without hand-editing DNS.
Agencies set up dozens of domains per client by hand. One wrong SPF edit (a second record, an overwrite, an 11th lookup) or one DKIM key pasted onto the wrong domain silently breaks deliverability. This server plans every change as a reviewable diff, refuses unsafe plans, applies each domain atomically, and can undo any run.
Tools
Tool | Writes? | What it does |
| No | Checks SPF, DKIM, DMARC and MX on public DNS. No token needed. |
| No | Builds a per-domain diff against current Cloudflare records. Returns a |
| Yes | Applies a plan, one atomic batch per domain. Dry run unless |
| No | Confirms every planned record is visible on public DNS and that forwarding answers with its 301. |
| Yes | Undoes one apply run, including redirect rules. Dry run unless |
All tools take lists of domains (max 100 per call). One failing domain never stops the batch.
Related MCP server: own-domain-mcp
What gets configured
Item | Google Workspace | Microsoft 365 | Amazon SES |
Verification TXT |
|
| n/a |
SPF | merge | merge | on MAIL FROM subdomain |
MX |
| value you supply (never guessed) | MAIL FROM: exactly one MX |
DKIM | TXT you supply (per domain) | 2 CNAMEs you supply (per domain) | 3 CNAMEs from tokens |
Extra |
| ||
DMARC |
| same | same |
Tracking | Smartlead | same | same |
Forwarding | 301 from root and www to your site | same | same |
Safety rules (the engineering decisions)
Per-domain secrets stay per-domain. DKIM keys, Microsoft DKIM targets, SES tokens and verification codes are unique to each domain. Passing one shared key for a multi-domain plan is rejected, and Microsoft targets are checked against the domain they're pasted for.
SPF is merged, never duplicated. Existing mechanisms are kept, duplicate records are merged into one, and the result is resolved recursively against live DNS (Google's include dropped from 4 lookups to 1 in Dec 2025; static tables are wrong, live resolution isn't). Over 10 lookups or 2 void lookups blocks the plan.
Never guess provider values. Microsoft MX moved to
*.mx.microsoftfor new domains in July 2026, and Microsoft says the admin center or Graph API is the only source of truth. Microsoft DKIM targets contain a routing character Microsoft assigns. The tool asks for both.Atomic apply. Each domain's DNS changes go through Cloudflare's batch endpoint in one transaction. If anything fails, nothing is written for that domain.
Drift check. A plan stores a fingerprint of the zone. If DNS changed between plan and apply, that domain is skipped.
No double apply. A plan applies once per domain; a clean rollback re-enables it.
Full rollback. Snapshots and change logs restore the exact original records and the previous redirect ruleset.
Live mail is protected. Existing MX is never replaced unless
replace_mx=true. Existing DMARC is never changed. Existing website records are never overwritten by forwarding.CNAME conflicts are blocked, both ways.
SES MAIL FROM gets exactly one MX, as AWS requires; extras are removed and other records on that subdomain are flagged.
DMARC report authorization is checked. If
ruapoints at another domain, receivers only send reports when that domain publishesclient.com._report._dmarc.agency.com=v=DMARC1;. The plan gives the exact record.RFC 9989 aware. Audit flags
pct,rf,ri(removed in May 2026) and the rua size suffix.Rate limits handled honestly. Cloudflare blocks all calls for 5 minutes after 1,200 requests. Short waits are retried; the 5-minute block returns a clear error instead of hanging the agent.
Input validated before any network call: domains, emails, URLs, regions, DKIM keys (pasted quotes and line breaks are cleaned), tokens, verification codes.
Install in Claude Desktop
Download
domain-setup-mcp.mcpbfrom the latest release.Double-click it, or go to Settings > Extensions > Advanced settings > Install Extension.
Enter your Cloudflare API token when asked (see the token permissions below).
Claude Desktop supplies its own uv to run the extension. Keep Python 3.11 or newer installed: running without it hasn't been tested.
Setup from source
Requires Python 3.11 or newer.
git clone https://github.com/anasmughal239-alt/domain-setup-mcp.git && cd domain-setup-mcp
pip install -e ".[dev]"
pytest # 116 tests, all offlineCloudflare token: My Profile > API Tokens > Create Token. Permissions: Zone: Read, DNS: Edit, and Single Redirect: Edit if you use forward_to (the token summary lists this as Dynamic URL Redirects Write). Under Zone Resources choose Specific zone and add only the domains you're setting up. Avoid "All zones": both setups below save the token in plain text in your client's config file, so keep it as narrow as you can, and delete it in Cloudflare when you're done.
Use a real token value in the commands below, and never commit it. If you read it from a secure PowerShell prompt, each character prints as *; one * after pasting means the paste failed, so right-click to paste instead of Ctrl+V.
Claude Code
claude mcp add domain-setup --env CLOUDFLARE_API_TOKEN=your_token -- domain-setup-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"domain-setup": {
"command": "domain-setup-mcp",
"env": { "CLOUDFLARE_API_TOKEN": "your_token" }
}
}
}Plans and run logs are stored in ~/.domain-setup-mcp (override with DOMAIN_SETUP_HOME). They contain DKIM public keys and verification codes, which are public DNS data.
Example config (2 Google Workspace domains)
{
"provider": "google",
"dmarc_rua": "dmarc@agency.com",
"tracking_tool": "smartlead",
"forward_to": "https://acme.com",
"per_domain": {
"getacme.com": {
"verification_txt": "google-site-verification=...",
"dkim": { "google_txt": "v=DKIM1; k=rsa; p=MIIB..." }
},
"tryacme.com": {
"verification_txt": "google-site-verification=...",
"dkim": { "google_txt": "v=DKIM1; k=rsa; p=MIIB..." }
}
}
}Typical Google flow: run once with verification only, verify in the Admin console, activate Gmail, wait 24 to 72 hours for DKIM to become available, then run again with the DKIM keys. Re-running is safe; correct records are left alone.
Config reference
Field | Notes |
|
|
|
|
| Admin console > Apps > Gmail > Authenticate email (2048-bit). Don't regenerate later: it replaces the key |
| Exact Selector1CNAME / Selector2CNAME from Defender portal or |
| The 3 Easy DKIM tokens |
| Required for Microsoft 365: exact MX from Admin center > Domains |
| Shortcut for single-domain plans only |
| Mailbox for aggregate reports |
|
|
| RFC 9989 policy for non-existent subdomains, e.g. |
|
|
| Full URL. Adds proxied |
| Off by default |
| On by default for Microsoft |
| Custom MAIL FROM so SPF aligns for SES |
Known limits (v0.3)
Cloudflare only.
Live-tested on Windows with Python 3.14, Google Workspace settings and an empty zone (plan, apply, verify, rollback, re-apply). Merging into existing records, restoring them on rollback, Microsoft 365 and SES are covered by the offline tests only so far. Try a test domain first and review every diff.
domain_verifycan only confirm that proxied A placeholders resolve, because they answer with Cloudflare IPs rather than the planned value. It checks forwarding over HTTPS on the root andwwwonly, not over plain HTTP.The DMARC authorization record lives on the report domain, which may be in another account, so the tool reports it instead of writing it.
Rollback restores the redirect ruleset as it was before the run. Redirect rules someone else added to that zone after the run are lost by a rollback.
Some practitioners argue that forwarding cold domains to the main site links their reputation. It's off unless you set
forward_to.
Sources (checked November 2026)
Google Workspace: Set up DKIM, MX records, verify with TXT (knowledge.workspace.google.com)
Microsoft: DKIM configure (learn.microsoft.com/defender-office-365/email-authentication-dkim-configure); MC1048624 MX provisioning change; Exchange Online DNS records
AWS SES custom MAIL FROM (docs.aws.amazon.com/ses/latest/dg/mail-from.html)
Cloudflare: batch DNS record changes, API rate limits, redirect one domain to another, Single Redirects via API
RFC 9989/9990/9991 (DMARC, May 2026); RFC 7208 (SPF limits); RFC 7489 §7.1 (external report authorization)
Smartlead and Instantly help centers (custom tracking domains)
Outlook.com high-volume sender requirements (May 2025); Gmail sender guidelines
Measure this (for the case study)
Time to set up 20 domains: manual in the Cloudflare dashboard vs
plan+apply+verify.Errors caught: run
domain_auditacross real client domains and count duplicate SPF, lookup overflows, missing DMARC, unauthorized report destinations, deprecated tags.Test suite: 116 offline tests, the Cloudflare client against a mock API, and mutation checks on every safeguard.
Available Tools
5 toolsdomain_applyADestructive
Apply a saved plan to Cloudflare. Each domain's DNS changes go in one atomic batch (all or nothing). Skips any domain whose DNS changed since the plan was made. Returns run_id for domain_rollback.
Inputs: plan_id (required), only, confirm.
domain_auditARead-only
Check SPF, DKIM, DMARC and MX on public DNS for each domain. Read-only; needs no Cloudflare token.
Inputs: domains (required), dkim_selectors.
domain_planARead-only
Build a reviewable diff of DNS changes per domain. Writes nothing to DNS.
Merges into existing SPF (never adds a second record), blocks plans over the 10-lookup limit, never overwrites live MX unless replace_mx=true, never changes an existing DMARC policy, and never guesses Microsoft MX or DKIM values. Per-domain values go in config.per_domain. Returns a plan_id.
Inputs: config (required), domains (required).
domain_rollbackADestructive
Undo every change made by one domain_apply run, in reverse order.
Inputs: run_id (required), confirm.
domain_verifyCRead-only
Check that every planned change is visible on public DNS and that forwarding answers with its 301.
Inputs: plan_id (required), wait_seconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool maps to a distinct phase of the DNS lifecycle: audit (read-only pre-check), plan (dry-run diff), apply (write), verify (post-check), rollback (undo). Audit vs. verify could superficially overlap but descriptions clearly separate pre-state inspection from post-apply confirmation.
All five tools use a uniform `domain_` prefix with a single descriptive verb (audit, plan, apply, verify, rollback). Perfectly predictable pattern.
Five tools is well-scoped for a plan-then-apply DNS workflow; each tool earns its place with no redundancy or filler.
The audit→plan→apply→verify→rollback lifecycle is fully covered, including atomic batching and state-change guards. Minor gaps exist: no tool to list/inspect saved plans by plan_id or run_id, and no way to remove domains from management outside a planned change.
Maintenance
Related MCP Connectors
Bulk verify B2B emails via Cloudflare DNS MX, SPF/DMARC, disposable check & 0-99 catch-all score.
Scan, fix, verify and monitor DNS: SPF, DMARC, DKIM, propagation, health, expiry. Validated fixes.
Daily SPF, DKIM, DMARC and MX monitoring with webhook alerts, plus free sending-domain audits.
Scan and fix a domain's email deliverability (SPF, DKIM, DMARC, MTA-STS, BIMI, DNS blocklists).
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables DNS and email security analysis through passive and active scanning capabilities. Provides comprehensive domain security checks including SPF, DMARC, DNSSEC validation, MX record analysis, and SMTP connectivity testing.17 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceProvisions own-domain email for families using Cloudflare's API, enabling automatic setup of email routing, catch-all forwarding, and verified destinations.MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for AI agents to safely manage Cloudflare DNS, DMARC, SPF, BIMI, and Email Routing with dry-run-first and approval-based writes.9MIT
- AlicenseBqualityCmaintenanceEnables users to inspect and manage domains, DNS records (including A, AAAA, CNAME, MX, TXT and more), HTTP forwards, invoices and dynamic DNS through a hosting provider's API, with previewed change plans, conflict detection, backups and independent readback before writes. Offers DNS shortcuts such as website setup, verification records, bulk IP replacement, zone import/export and backup restore, exposed via local stdio or authenticated Streamable HTTP for a central gateway.27MIT