Tutorial7 min read

How to Connect a Custom Domain to Your Site With an AI Agent

To connect a custom domain with an AI agent you need two things: the record your host wants — a CNAME or A value from its custom-domain screen, or from the hosting MCP itself on Vercel — and a DNS server the agent can write to: Cloudflare, Porkbun, Hostinger, Name.com, Vercel or the Namecheap API server. Then verify from outside with IntoDNS and let the host issue the certificate. Five steps, each with the prompt to paste.

Goal

A domain you own answers on a site you deployed

Time

~10 min, plus propagation

Prereq

A deployed site, a domain, and the registrar or DNS MCP connected

Steps

1

Get the record your host wants

Every host publishes the same two shapes: a CNAME for a subdomain such as www, pointing at the host's hostname, and an A (or ALIAS) record for the bare apex. On Vercel the agent can do this half itself — add_project_domain attaches the name to the project, and list_project_domains reports whether it is verified and what it expects. On other hosts the value sits on the custom-domain screen of the dashboard; paste it into the conversation. Do not let the agent guess an IP.

Prompt
I am adding www.example.com to my site on Vercel. Add the
domain to the project "example-site" and tell me exactly
which DNS record the project expects for it.
2

Read the zone before you write anything

Three of the six writing servers replace the whole record set if you let them: Namecheap's set_dns_hosts always, Hostinger's dns_records_update with overwrite, Vercel's BIND replace. Even on the per-record servers, reading first is how the agent notices an existing record it would collide with. Porkbun: dns_list. Hostinger: dns_records_list through execute. Namecheap: get_dns_hosts. Name.com: ManageDNS with operation list. Cloudflare: the zone's DNS records endpoint through execute.

Prompt
List every DNS record on example.com and show me the table
before you change anything. Tell me if a record already
exists for www or for the apex.
3

Write the record with the safest tool the server has

Prefer the tool that cannot delete what you did not send. Porkbun: dns_upsert for one record, or domain_cutover_web to move the whole web presence to a new target in one call. Hostinger: dns_records_validate, then dns_records_update without overwrite. Name.com: ManageDNS create. Vercel (when Vercel manages the DNS): update_record, or create the record the project asked for. Namecheap: get_dns_hosts, merge, then set_dns_hosts with the complete set. Cloudflare: execute against the DNS records endpoint, with the record set to DNS only (not proxied) unless the host tells you otherwise.

Prompt
Add a CNAME for www.example.com pointing at
cname.vercel-dns.com with a 300-second TTL. Use the upsert
tool if this server has one. Do not modify or delete any
other record. Show me the exact call before you run it.
4

Wait, then verify from outside — not by re-reading the record

A record the agent reads back from the same server one second after writing it will always look right; that is the authoritative answer, not what the internet sees. Wait a few minutes, then ask IntoDNS: check_dns_propagation asks nine resolvers and reports the ones that still disagree, and lookup_dns reads the record over DNS-over-HTTPS. On the command line, dig does the same for one resolver.

Prompt
Wait for me to say "check". Then use IntoDNS
check_dns_propagation for www.example.com, record type
CNAME, and report which resolvers agree. Do not edit the
record again unless I ask.
5

Let the host issue the certificate

Hosts provision TLS automatically once the record resolves; a pending certificate a few minutes after a DNS change is normal. On Vercel the agent can check with list_certs and request one with issue_cert; Porkbun's ssl_retrieve fetches the bundle Porkbun issues for its own domains. The one thing to forbid: an agent that "fixes" a pending certificate by rewriting the record it just set.

Prompt
Check whether the certificate for www.example.com has been
issued. If it is still pending, tell me how long to wait.
Do not change any DNS record.

Full-replace tools delete what you did not send

Namecheap's set_dns_hosts replaces every host record, Hostinger's dns_records_update does the same when overwrite is true, and Vercel's replace_domains_by_domain_records swaps the whole zone for a BIND file. An agent that "adds a CNAME" with one of these and a one-line payload removes the MX records nobody notices are gone until mail stops. Read, merge, write the complete set — or use a per-record tool.

Which write tool, per server

Zone lives atReadWrite one recordUndo
CloudflareDNS records endpoint via executeCreate or update via execute, DNS onlyDelete the record; Change History for audit
Porkbundns_listdns_upsert, or domain_cutover_web for the whole web presencedns_remove; writes need --get-muddy
Hostingerdns_records_listdns_records_validate, then dns_records_update (no overwrite)dns_snapshots_restore
Name.comManageDNS listManageDNS createManageDNS delete by id
Vercel-managed DNSget_domains_records_by_record_idupdate_recordupdate_record again; avoid the BIND replace
Namecheapget_dns_hostsset_dns_hosts with the merged full setset_dns_hosts with the previous full set — keep it

One connection can do both halves

On Vercel, the same MCP attaches the domain to the project, writes the record when Vercel manages the DNS, and issues the certificate. On Hostinger, the server that deployed the site writes its zone too. Everywhere else, expect two servers: the host's for the target, the registrar's for the record.

Frequently asked questions

Do I need to change the nameservers to connect a domain?

Usually not. Pointing a domain at a site is a record inside the existing zone — a CNAME for www, an A or ALIAS record for the apex — and the servers on this page write those. You change nameservers only when you are moving DNS hosting itself, for example to Cloudflare or to Vercel, and that is a separate, slower change: Porkbun's domains_update_nameservers, Namecheap's set_custom_nameservers, Name.com's ManageDomains setNameservers and Hostinger's domains_portfolio_update-nameservers all do it.

What is the difference between www and the bare domain?

A subdomain like www can be a CNAME to the host's hostname, which follows the host if its addresses change. The bare apex cannot carry a CNAME under DNS rules, so hosts give you an A record with an IP, or the DNS provider offers an ALIAS or flattened CNAME. Ask the host for both values and set both, then redirect one to the other on the host side.

How long does it take before the site answers on the domain?

Minutes to hours. New records usually resolve within minutes; a changed record can lag for as long as the old TTL, and some resolvers cache longer than they should. IntoDNS's propagation check shows you which resolvers have caught up. Certificate issuance starts once the host can resolve the name, so it adds a few more minutes.

Can one MCP do both the hosting side and the DNS side?

Two can. Vercel's MCP attaches the domain to the project, writes the records if Vercel manages the DNS, and issues the certificate. Hostinger's MCP deploys the site and writes the zone through the same execute tool. Everywhere else it is two servers: the host's for the target, the registrar's or DNS provider's for the record.

Can I do this from ChatGPT?

For Vercel and Cloudflare, yes: both are hosted servers ChatGPT reaches as connectors (Vercel is reviewed; Cloudflare through Developer mode), and the GoDaddy and Namecheap apps edit DNS on their own accounts inside ChatGPT. Porkbun, Name.com, Hostinger and the Namecheap API server run locally and need Claude Desktop, Claude Code, Cursor or another local client.

The host says "invalid configuration" — what does the agent do?

Nothing, for a few minutes. The three usual causes are propagation lag, a proxied record where the host wanted DNS only, and a record on the wrong name (apex versus www). Have the agent run the IntoDNS propagation check and read the record type and value back from outside before it touches anything. An agent that rewrites the record every time the host reports pending is the failure this page exists to prevent.

Before and after this step

Publish the site first, pick the DNS server by its write model, or read which servers can register the name in the first place.

Related guides

Browse all 64 guides