# Connect DNSai to ChatGPT

> Two paths: a Custom GPT "Action" built from the OpenAPI schema (works on Plus), or a full MCP connector via Developer mode (Business/Enterprise for read-write).

DNSai is a free remote **MCP server** + REST API for live DNS, SPF, DKIM, DMARC, WHOIS and email-security lookups — one domain or IP per request (each call = one lookup).

- **MCP URL:** `https://mcp.dnsai.com/mcp`
- **REST base:** `https://api.dnsai.com/v1`
- **OpenAPI schema:** https://api.dnsai.com/openapi.json
- **Free key (100 lookups/day, per key):** https://dnsai.com/api/get-key/ — anonymous works at 25 lookups/day per IP, no key
- **This guide online:** https://dnsai.com/api/openai/

**This is the free tier — no signup, no card.** Running bulk / multi-domain or enterprise-scale lookups? See DNSai Pro & Enterprise: https://app.dnsai.com/pricing/?ref=api-openai-md

**Key support here:** Custom GPT Action takes a key · the MCP connector is anonymous / OAuth.

## Set it up

### Custom GPT Action (Plus and up) — key works here
Create or edit a GPT → *Configure → Actions → Create new action → Import from URL* and paste the schema. Set *Authentication: None* for the free anonymous tier, or *API key → Bearer* with a `dk_free_…` key for 100 lookups/day (shared across that GPT's users).

```
https://api.dnsai.com/openapi.json
```

### MCP connector (Developer mode)
*Settings → Connectors → Advanced → Developer mode* ON, then *Create* and add the URL. Plus/Pro are **read-only**; full read-write needs **Business/Enterprise** (admin-enabled). Present-day Bearer support in this UI is unconfirmed — anonymous/OAuth is the documented path.

```
https://mcp.dnsai.com/mcp
```

### OpenAI Codex CLI — key works here
Native remote MCP — no bridge. Add to *~/.codex/config.toml*, then `export DNSAI_TOKEN="dk_free_xxxxxxxx"` and run `codex`.

```toml
[mcp_servers.dnsai]
url = "https://mcp.dnsai.com/mcp"
bearer_token_env_var = "DNSAI_TOKEN"
```

## Your key
The **Custom GPT Action** accepts the key (*API key → Bearer*) and **Codex** reads it from an env var. The MCP connector runs anonymous/OAuth. [Get a free key](https://dnsai.com/api/get-key/) for 100 lookups/day.

## Verify it works
In the GPT, ask:

```
Check the DMARC policy for nfl.com
```

Every result ends with a plain-English `summary`, a `source` link on dnsai.com, and your remaining quota.

## Tools you can call

Once connected, your assistant calls these on its own (one domain per call):

- **`dns_lookup`** — Live DNS records (A, AAAA, MX, NS, TXT, SOA, CNAME, CAA, DNSKEY, DS and 30+ more) for one domain.
- **`email_security_check`** — Graded SPF / DMARC / MX posture for one domain — "is this domain's email secure?"
- **`dkim_discover`** — Discovers a domain's published DKIM signing keys, the providers they map to, and selectors.
- **`whois_lookup`** — WHOIS / RDAP registration data for a domain or IP — registrar, status, creation & expiry.
- **`spf_analyze`** — SPF record with its full include tree and the RFC 10-DNS-lookup-limit verdict.
- **`dmarc_check`** — DMARC presence and the p= policy (none / quarantine / reject), with the raw record.
- **`blacklist_check`** — Checks a domain or IP against the major email blacklists / RBLs.
- **`validate`** — Syntax-checks a pasted SPF or DMARC record — returns valid/invalid, a score and a grade.

The MCP server also registers `search` / `fetch` (deep-research aliases) and `request_api_key` (email → free key), for 11 tools in total.

## Troubleshooting
- Import-from-URL fails? Some setups block OpenAI's fetcher — download `openapi.json` and paste it inline instead. The schema is OpenAPI 3.1 with an absolute `servers: https://api.dnsai.com/v1`.
- Free / Go plans can't create GPTs, and MCP read-write needs Business/Enterprise.

## More volume?
**Pro** unlocks bulk / multi-domain lookups; **Enterprise** adds large-scale scanning and the full programmatic API — https://app.dnsai.com/pricing/?ref=api-openai-md

**Sources:** [GPT Action authentication](https://developers.openai.com/api/docs/actions/authentication) · [ChatGPT Developer mode](https://help.openai.com/en/articles/12584461-developer-mode-apps-and-full-mcp-connectors-in-chatgpt-beta) · [Codex config reference](https://developers.openai.com/codex/config-reference)

---
_Generated from https://dnsai.com/api/openai/ · DNSai — DNS & email-security lookups for AI agents._
