Skip to content
AdminKit

How do you audit SPF and DMARC with an AI agent, using AdminKit's MCP server?

AdminKit's check_mail_auth tool lets an AI agent ask AdminKit's live Check API to read a domain's SPF and DMARC records and report whether outbound mail authentication is actually enforced, so you can audit SPF and DMARC posture from a chat prompt instead of decoding DNS TXT records by hand.

By AdminKit team, Netbase JSC · Updated

Ask your agent, don’t read DNS by hand

Install AdminKit’s open-source adminkit-mcp connector (MIT, PyPI) and wire it into any MCP-capable AI agent — see connect an AI agent to AdminKit’s MCP server if you haven’t yet. Once it’s running:

uvx adminkit-mcp

Ask the agent, in plain language:

“Use check_mail_auth to check SPF and DMARC for my domain, and tell me what to fix if anything looks wrong.”

The agent calls check_mail_auth(domain="...") and gets back a structured result it can read, summarize, or act on — no manual dig TXT lookups or squinting at raw SPF mechanisms required.

What the tool checks, specifically

check_mail_auth reads the domain’s published SPF record (the v=spf1 ... TXT record) and its DMARC policy (the _dmarc TXT record), and flags four specific conditions: SPF missing or unparsable, DMARC missing or unparsable, SPF ending in the permissive +all mechanism (which RFC 7208 defines as matching literally any sending host), and DMARC still set to p=none. RFC 9989 §3.2.8 defines p=none as the Domain Owner offering no expression of preference — the current DMARC specification’s own way of saying it carries no enforcement effect on its own, so a domain can have a syntactically valid DMARC record and still be fully spoofable in practice.

Example response (fixture)

This is a labelled fixture, not a claim about any specific domain’s current records: the exact response shape check_mail_auth returns, matching the connector’s own open-source test suite. Reproduce it yourself by asking your agent to run the tool against a domain you manage. A domain with a permissive SPF record comes back like this:

{
  "tool": "check_mail_auth",
  "status": "warn",
  "result": {
    "domain": "example-nonprofit.test",
    "spf_status": "ok",
    "dmarc_status": "ok",
    "findings": []
  },
  "evidence": {
    "spf": { "status": "ok", "allMechanism": "+all" },
    "dmarc": { "status": "ok", "tags": { "p": "none" } }
  },
  "fix_hint": "Replace +all in the SPF record with -all or ~all; +all allows anyone to send as this domain.",
  "report_url": "https://adminkit.net/tools/spf-check/?utm_source=mcp"
}

A domain that’s missing SPF or DMARC entirely gets spf_status/dmarc_status of "not-found" and a fix_hint naming which record to publish first; a well-configured domain gets status: "ok" and fix_hint: null. How do you read a DMARC check result covers reading the DMARC-specific tags (p, pct, rua) in depth once you have a real result in front of you.

Why do this from an agent instead of the SPF tool page

An agent that can call check_mail_auth directly can fold the check into a bigger workflow — auditing every domain your org sends mail from before a migration, re-checking after a DNS change, or explaining the fix in the same conversation where you’re already debugging why a message landed in spam. The AI agents & MCP cluster covers the broader pattern of giving an agent real, structured tools instead of asking it to scrape a web page and guess at the meaning of what it finds. If you’re moving mail providers, migrating email providers without breaking SPF/DKIM/DMARC is the fuller checklist beyond what this one check covers.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

Which real tool does this use, and where does the data come from?

check_mail_auth, one of the 13 tools in adminkit-mcp (PyPI, MIT). It calls AdminKit's live Check API (api.adminkit.net), the same backend behind the public SPF check tool page, with a fallback to AdminKit's live site function if that specific route is ever briefly unreachable. It only reads published DNS records for the domain you give it — nothing is guessed or fabricated.

Does it check DKIM too?

Not automatically. DKIM verification needs a selector (the prefix before `._domainkey` in the DNS record), which isn't knowable from the domain name alone — common selectors are listed on the DKIM check tool page, or your mail admin can tell you. Once you know the selector, ask your agent to check the DKIM tool page directly; check_mail_auth's automatic summary covers SPF and DMARC only.

Do I need to own the domain to run this?

No ownership verification is required for this check — SPF and DMARC records are published in public DNS by design, the same data any mail server performing its own authentication check would read. Treat the result the same way regardless: it's informative about any domain's public posture, not a private scan.

What does a 'warn' result mean versus 'ok'?

ok means SPF and DMARC both resolve cleanly, SPF doesn't end in the permissive +all mechanism, and DMARC isn't stuck at monitoring-only (p=none). warn means at least one of those is true, and the tool's fix_hint field names which one to fix first.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.