MCP: drive it from an agent
Let an AI agent connect and check domains.
Use the MCP server when an agent should connect domains for a user. Claude, Cursor or your own MCP client can find providers, start connections and read their status. It is the same API, behind a tool interface.
Connect
Open AI tools in console (opens in a new tab)
- Endpoint:
https://mcp.customdomain.ai/mcp(Streamable HTTP). - API key: a
cd_live_…key from the console's API & SDK page (an oldersk_key keeps working), sent asAuthorization: Bearer <key>. It works for every tool exceptcreate-domain-order. It carries your whole workspace's authority, so give it only to agents you trust. - Agent token: the scoped option. A person approves exactly which scopes the
agent gets (
domains:read,domains:connect,domains:disconnect,domains:purchase) and can revoke it at any time. See Agent access. - Purchases through MCP are off on the hosted service.
- The console's MCP server page (switch it on in Settings → Features) has ready made setup for each client (with a key) and a connection test.
- VS Code in one command:
code --add-mcp '{"name":"customdomain","type":"http","url":"https://mcp.customdomain.ai/mcp"}'. VS Code opens your browser to sign in the first time it connects.
Set up an agent from the welcome
On the welcome's first question, tick Also let an AI agent connect and manage domains for me and it has one more step, Give your agent access. It is optional, and Not now always works. Pick your agent (Claude Code, Claude Desktop, Codex, Cursor, VS Code, ChatGPT or Other) and the step shows what to add to it: a command, or a few fields to fill in.
- Most agents sign in, so there is no key. A browser opens, you approve what the agent may do, and the step says connected, with the agent's name, only once it signed in and you approved it. A grant you revoked or that expired does not count. The same grant is what Overview shows on its Connect your agent row, and you can end it under Agents (in the sidebar under More).
- Cursor cannot sign in to a new server by itself yet, so it gets the key setup, with your default key from API & SDK (every workspace has one from the start).
- An agent that connects with a key leaves nothing to see, so the step says it cannot watch for it and the checklist does not claim it. Carry on once you have added it.
- A prompt to paste into the agent tells it to read the agent skill, to show you what it plans before anything changes, and what to do first for what you told the welcome: connect your domain, add the widget to your product, or list the domains you added. It never holds a key.
The flow an agent should follow
discover-provider { domain }is read only. It says where the domain's DNS lives and which ways can run:rails(domainConnect,oauth,secureSignIn,apiKey,manual,dnsHostingandsavedAccess),recommendedRailandblockedReason(the same truth asrailsonPOST /v1/domains:check). A person starts a secure sign in, never an agent, so for an agentsecureSignInreadsavailable: falsewithreason: caller_cannot_starteven where the provider offers it: that is not a missing way. Do this before promising anything.connect-domain { domain }creates the connection and returns therecordsto add, aconnectionIdand alinkfor the human to complete, with alinkKindthat says who opens it:domain_connect(one click at their DNS provider) andguided_setup(a single use setup page for this one domain, with no account, where they take a sign in, a secure sign in or the records) are for the user;consoleneeds a login to the workspace, so it is for a member of the workspace. An API key or a client credentials token getsguided_setupwhere the provider has no one click page; an agent token always getsconsole, so give the user therecords. Aguided_setuplink is a bearer link that lasts 30 days and lets whoever opens it first set up the domain, so send it only to the person who owns the domain. The agent never supplies DNS records: the server works them out.check-connection-status { connectionId }returns astatusofpending,propagating,liveorfailed. Stop whenconnectedistrue. A failed connection says why inerrorCode.pendinghas no deadline; afailedconnection can be retried by callingconnect-domainagain for the same domain, which revives it.- A domain that is not live yet:
diagnose-connectionsays record by record what public DNS shows and what is missing. Once the person has fixed it,recheck-connectionruns the check now.check-certificate-statusreads the HTTPS certificate; certificates renew on their own. list-connections { status?, dnsHosting?, limit?, cursor? }lists the connected domains with their status (every application in the workspace when you use an API key). Each row carriesdnsHosting, who runs the domain's DNS, anddnsHosting: "hosted"(ormoving, orany) keeps only the domains CustomDomain™ runs. A page that was cut saystruncated: true; call again withnextCursorascursor.
When a connect fails with billing_required, check-billing-status says why and
where an owner fixes it.
Buying: search-domain-availability and generate-domain-suggestions work as
read tools. create-domain-order exists, but ordering is off on the hosted
service. check-order-status and list-domain-orders read orders. Email and
forwarding: add-email, forward-domain. Moving a domain's nameservers to the
application's DNS host: migrate-nameservers and rollback-nameservers (both ask
the person first and send confirm: true), and check-nameserver-status to follow
the move. With an agent token, the application's setting decides where the
nameservers go: target and nameservers are refused, and it never resumes the
move another application of the workspace has open. An agent may move nameservers
only while the application's DNS hosting is on; with it off the call fails with
ns_not_offered and changes nothing, and a person can turn DNS hosting on in the
application's settings, or the platform can start the move with its API key. Each move an agent token
starts, resumes or reverses is in the audit log as agent.acted under its grant. See
Domain maintenance (nameserver migration).
Re-apply and disconnect
reapply-connectionrewrites a connection's records through the access CustomDomain™ keeps for the domain: the stored grant of a managed connection, a DNS zone CustomDomain™ hosts for it (dnsHostinghostedonlist-connections) or a connected provider account that keeps it. A connection with none of these answers409(conflict), so check first, and repair it withfind-saved-accessanduse-saved-access, or have the person add the records at their DNS provider or sign in again.managed: falsedoes not mean a repair needs the person at their DNS provider. With an agent token each re-apply that reached a write is in the audit log asagent.acted. See Managed connections.disconnect-domain { connectionId, confirm }removes any connection of the application, managed or not. The domain stops being served and its certificate and monitoring go away. DNS records are removed only where a kept grant wrote them; anywhere else they stay at the provider and the user deletes them. It answers409 removal_in_progresswhile another removal of the same connection is running. The domain goes offline, so ask the person first and send the domain they confirmed asconfirm. Every caller must send it, and it is compared with the connection's domain whatever the credential (an API key, a client credentials token or an agent token): another domain answers409 confirmation_mismatchand nothing is removed. The control plane checks it before anything is removed.- Disconnecting needs the
domains:disconnectscope, which is separate from connecting. A grant approved before that scope existed does not carry it until the person approves the agent again. See Removing a domain.
When a call fails
A failed call is an isError result with success: false, an error code and
details when there is one. Branch on the code. A token without the tool's
scope gets insufficient_scope, and a caller over its limit (5 calls a second,
bursts of 20) gets rate_limited with retryAfterSeconds. With API keys the
limit is per credential, so each key has its own; agent tokens share one per
workspace. An add-email or forward-domain value of the wrong shape (an IP
address where a hostname belongs, a DKIM selector with dots, more than one DMARC
address) fails with -32602, which names the argument. A key or token that is
invalid, expired or revoked gets HTTP 401 with a WWW-Authenticate challenge,
so the client knows to sign in again. See
What a call answers.
Agent authorization
Delegated agent access is live. An agent registers as an OAuth client, a person approves it on the consent page, and the agent gets a 15 minute token limited to the scopes that person approved. Review and revoke agents under Agents, which switches on after your first approval (see Managing access). Full tool reference: MCP server.