CustomDomain Docs
Features

MCP server

The tools an AI agent can call to manage domains.

Let an AI agent search for, connect and manage domains through the CustomDomain™ Model Context Protocol (MCP) server. It calls the same /v1 API, and the agent never handles DNS records itself. The server adds no logic of its own.

The hosted endpoint is live at https://mcp.customdomain.ai/mcp (Streamable HTTP). The console's MCP server page (under More, once you switch it on in Settings → Features) has the endpoint, a connection test and copy and paste setup for Claude Code, Claude Desktop, Codex, Cursor, VS Code, ChatGPT and any other client. The welcome has an optional step that does the same for the agent you pick, and says when it has signed in (see MCP: drive it from an agent). The agent skill teaches an agent the safe way to use the tools below.

The server reports itself as customdomain-mcp, version 0.7.0 (protocol revision 2025-06-18), and advertises only the tools capability.

Tools

The server registers the tools below, in a fixed order. None of them takes DNS records as input. Records always come from the control plane, so an agent can never inject them. Each tool needs one scope (see below).

ToolArgumentsScopeWhat it does
search-domain-availability{ domain }domains:readCheck whether a domain is available to register, with real time price and renewal price.
generate-domain-suggestions{ keywords, limit? }domains:readReturn suggestions for a set of keywords, each available to register and priced (default 5, min 5, max 20). The cheapest is marked the top pick.
create-domain-order{ domain, confirm_domain }domains:purchaseStart a registration through the resolved registrar. Direct registrars return an orderId; sharing registrars return a checkout link and a jobId to poll. Spends money, so ask the person first and repeat the domain they confirmed in confirm_domain (case does not matter). Without it, or with another domain, the call fails with -32602 and nothing is ordered. Also gated on the integrator's side: see below.
connect-domain{ domain, applicationId? }domains:connectAttach a domain the user already owns. Returns the exact DNS records to add, a link for the user with its linkKind, and the connectionId to poll (also sent as jobId). linkKind says what the link is and who opens it: domain_connect is a one click authorization at the DNS provider, which the user opens; guided_setup is a single use setup page for this one domain that the user opens with no account, where they take the ways the domain offers (a sign in at their provider, a secure sign in, or the records by hand); console is the connection's page in the console, which needs a login to the workspace, so it is for a member of the workspace and not for the user. guided_setup is issued only to an API key or a client credentials token, and only for a domain that is not live and that none of your end users connected; an agent token always gets console, so give the user the records instead. A guided_setup link 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. consoleLink is the console page when link is another kind. When a setup page cannot be issued the call still succeeds with the console link, and message says which you got. applicationId names the application: an API key may name any application of its workspace, while an agent token or a client credentials token acts only in its own. Never writes DNS directly.
check-connection-status{ connectionId } or { jobId }domains:readRead a connection's live status and its records. status is one of pending, propagating, live, failed, and connected: true is the reliable terminal signal. A failed connection says why in errorCode. managed says whether the platform holds a kept grant, which reapply-connection can use. managed: false does not mean a repair needs the person at their DNS provider: see Repair.
check-order-status{ orderId } or { jobId }domains:readRead the live status of a domain order, by orderId (direct) or jobId (sharing). Provide exactly one.
reapply-connection{ connectionId }domains:connectRe-apply a connection: the control plane recomputes its DNS from stored config and rewrites it through the access CustomDomain™ keeps for the domain: the stored grant of a managed connection (managed: true), a DNS zone CustomDomain™ hosts for it (dnsHosting hosted on list-connections), or a connected provider account that keeps the domain and wrote its records (list-provider-accounts). Never supply records. Fails with the code conflict (409) when none of those holds, so check first instead of calling it to find out; see Repair. With an agent token, each re-apply that reached a write is in the audit log as agent.acted ("re-applied a domain's records") under the agent's grant, whatever the answer; one refused before anything was sent leaves no row. See Managed connections.
disconnect-domain{ connectionId, confirm }domains:disconnectRemove any connection of the application, managed or not. The domain stops being served (edges forget the host within a minute), its certificate is removed and monitoring stops. DNS records come out only where a kept grant wrote them; otherwise they stay at the provider for the user to remove. This takes the domain offline and cannot be undone here, so ask the person first and send the domain they confirmed in confirm. Every caller must send confirm: without it the call fails with -32602 and nothing is removed. Whatever the credential (an API key, a client credentials token or an agent token), the server reads the connection first and compares confirm with its domain (case, a scheme, a path and a trailing dot do not matter): another domain is refused with 409 confirmation_mismatch and nothing is removed, and the control plane checks it again before it removes anything. A token that may disconnect but not read (an agent grant without domains:read) skips that first read, and the control plane's check of confirm alone decides. Answers 409 removal_in_progress while another removal of the same connection is running. See Removing a domain.
discover-provider{ domain }domains:readDetect where a domain's DNS is hosted and which setup rails can run for it. rails says per rail (oauth, domainConnect, apiKey, manual, and secureSignIn where it runs, with the key it makes: its rights beyond DNS and endsInDays) whether it can run for this domain, rails.dnsHosting is the application's DNS hosting offer (offered, offered_first, recommended or unavailable), alsoProvider names the nameservers' provider when the registrar names another (a former Google Domains name now at Squarespace), rails.savedAccess ({ available, accounts, use }) says the workspace already keeps a provider key that may act for the domain (accounts is how many) and recommendedRail is then saved_access; call find-saved-access and then use-saved-access (what use says), instead of starting a new sign in, recommendedRail is the server's pick, endUserAutomatic is true only when that pick needs nothing typed by the person, and registrar is the company the domain is registered with, which may differ from its DNS provider (null when not known), and blockedReason (unregistered, registration_hold or platform_subdomain) means no rail can proceed. A person starts secureSignIn in a browser, never an agent: for an agent it reads available: false with reason: caller_cannot_start even where the provider offers it, which is not a missing way, so hand the person the connect-domain link (linkKind guided_setup or console) to take it. recommendedRail is oauth, domain_connect, cloud_browser (secure sign in), api_key, manual or saved_access. It no longer returns supportsAutomatic or setupType, which only meant that an adapter exists. detectionError (nxdomain or resolver) is set when detection could not finish. Also returns the pre-flight advisories recordConflicts, willFallbackToManual and apexMessage. Read only. Use it before connect-domain, forward-domain or add-email.
forward-domain{ target, domain? , connectionId? }domains:connectForward (permanent 301) a domain to a destination. target is an http or https URL, or a bare host, whose host is a public hostname (not an IP address, localhost or a name that resolves only inside a network, such as one ending in .local or .internal), with no user name or password in it. Any other value fails with -32602, which names target, before any call is made, and the control plane checks the same rule again. Returns a link to authorize, or the records to add, plus a connectionId to poll. Never writes DNS directly.
add-email{ domain? , connectionId? , provider? , mxHost? , spfInclude? , dkimSelector? , dkimTarget? , dmarcRua? }domains:connectConfigure a domain for a mail provider (MX, SPF, DKIM, DMARC) through server side templates. Supply provider settings, never raw records. provider (google, microsoft365 or zoho) fills the standard MX and SPF (microsoft365 still needs your tenant's mxHost, and zoho fills Zoho's US data center, mx.zoho.com and zoho.com: for its EU data center send mxHost mx.zoho.eu and spfInclude spf.zoho.eu, since values you send win over the preset); DKIM values always come from you. Each value you send is checked before any call is made: mxHost, spfInclude and dkimTarget are fully qualified public hostnames (not an IP address, localhost or a name that resolves only inside a network, such as one ending in .local or .internal), dkimSelector is one DNS label with no dots, and dmarcRua is one email address at a public domain (a mailto: prefix is accepted and dropped) with no other DMARC tags. A value of another shape fails with -32602, which names the argument, and the control plane checks the same rules again. Returns a link to authorize, or the records to add, plus a connectionId to poll.
list-connections{ status?, dnsHosting?, limit?, cursor? }domains:readList the connected domains, each with domain, connectionId, status, connected, setupType, managed, dnsHosting (who runs the domain's DNS: state of none, moving, hosted or failed, and by, provider, zone, since once there is hosting) and, for a failed one, errorCode. With an API key it spans every application in the workspace. status filters to one of pending, propagating, live, failed; dnsHosting filters to the domains CustomDomain™ runs the DNS for (hosted, moving or any); limit is up to 1000. A page that was cut says truncated: true and gives nextCursor: call again with it as cursor. A row can be re-applied when managed is true, when its dnsHosting state is hosted, or when a connected provider account keeps it (list-provider-accounts). Read only.
check-certificate-status{ connectionId }domains:readRead the HTTPS certificate of a connected domain: issuer, expiry, days left, whether renewal is failing and the last error. Certificates renew on their own. attention is empty when nothing needs a person, else failed, renewal_failing, expired or expiring. Read only.
recheck-connection{ connectionId }domains:connectRe-run a connection's DNS check now instead of waiting for the next scheduled one: a failed connection re-enters verification, a live one is checked for drift. Returns which records resolve and the new status; poll check-connection-status for the outcome. Writes no DNS.
diagnose-connection{ connectionId }domains:readExplain, record by record, what public DNS shows for a connection and what the user still has to do: each record is found, missing or mismatch, plus the issues that explain it (a hostname typed in the Name field, a proxy in front, a leftover record). Read only.
check-billing-statusnonedomains:readCheck whether the workspace may connect new domains right now. When it may not, restricted is true, code is billing_required and details say where an owner or admin fixes billing. Also returns the plan and its usage over the quota window (windowMonths: 12 on Starter, else 1). Read only.
list-domain-orders{ limit? }domains:readList the domain purchases made through the account, newest first (default 50, at most 200). A list that was cut says truncated: true. Read only.
check-nameserver-status{ connectionId }domains:readRead the nameserver move of a connection's domain: its state (pending, copying, needs_review, needs_dnssec_off, waiting_ds, setting, propagating, active, failed, rolled_back), the registrar where the nameservers change, the oldDnsHost, the old and new nameservers, what the registry lists now, what it waits on and the next step for a person, how the records were copied (copySource) and what to check (copyWarnings), and the ways back (rollbackDefault, rollbackTargets). done is true once it is active, failed or rolled back. Read only.
migrate-nameservers{ connectionId, confirm, path?, providerAccountId?, target?, nameservers?, zoneReady?, copyReviewed? }domains:connectMove a connected domain's nameservers to the application's DNS host, so its records are hosted and kept correct from then on; an agent may do it only while the application's DNS hosting is on. The records are copied first, mail included, and DNSSEC is turned off first when it is on. This changes who answers for the whole domain, so ask the person first and send confirm: true. The nameservers change at the domain's registrar, through a connected registrar account (providerAccountId), the person's own secure sign-in, or by the person: nextStep says which. When the copy was read from public DNS the move waits in needs_review: show the person copyWarnings, and send copyReviewed: true only once they agreed. target is managed or custom (with nameservers, 2 to 13), and only with the platform's own credential (an API key or the application's client credentials): with a delegated agent token both are refused, and the application's setting decides. Never send a registrar key. While DNS hosting is off, every call is refused with ns_not_offered (even one that would carry on a move a person started) and nothing is changed: do not retry it, and tell the person they can turn DNS hosting on in the application's settings, or that the platform can start the move with its API key; rollback-nameservers is not refused. An agent token never resumes a move that another application of the workspace has open (409), and each start or resume that changed the move is in the audit log as agent.acted ("moved a domain's nameservers") under the agent's grant. Poll check-nameserver-status until done is true.
rollback-nameservers{ connectionId, confirm, target? }domains:connectMove a domain's nameservers back: to the ones it had before the move (target: "previous", refused once they no longer answer for the domain), or to its registrar's own DNS (target: "registrar_default"). Without a target it goes to the old nameservers while they still answer, else to the registrar's DNS (rollbackDefault says which). With a connected registrar account it happens at once; otherwise nextStep says what the person sets or chooses at the registrar. Ask the person first and send confirm: true. A move back an agent token makes is in the audit log as agent.acted ("moved a domain's nameservers back") under its grant.
list-provider-accounts{ provider?, domain?, applicationId? }domains:readList the provider accounts (saved keys at a DNS host or registrar) the workspace has connected, never a key: each has an accountId, provider, label, how (api_key or secure_sign_in), access (continuous or one_time), scope, the domains it covers, its status, and the domains linked to it. The accountId is what migrate-nameservers takes as providerAccountId and use-saved-access takes as accountId. With domain it keeps the accounts that may act for that domain, best first, and savedAccess says for each whether it already holds the domain (at most 3 keys are read at their provider to check that they reach it); applicationId only goes with domain (an API key may name any application of its workspace, an agent token only its own). Keys a customer made at their own sign in are not listed (endUserKeys counts them), the customer's identifiers at the provider are never returned, and neither is which member of the workspace made a key. An agent token sees only the keys that serve its own application, with that application's connections and without the domains another application of the workspace has connected. It never reads a key's name, the provider's words about a failed key (lastError) or the applications a key is shared with, and a key made for another application and shared with its own reads as <Provider> key, with no applicationId. Read only.
find-saved-access{ connectionId, provider? }domains:readFind the saved keys that may write a connected domain's records, best first: each entry has an accountId, provider, label, zone and ready (true: the key already covers the domain; false: a read showed it reaches the zone, and using it adds the zone to what the key covers). An empty list means none may act for this domain. Never returns a key, and never one a customer made at their own sign in. An agent token reads no keyName, and a key made for another application and shared with its own reads as <Provider> key, with no applicationId. Read only.
use-saved-access{ connectionId, accountId, confirm }domains:connectWrite a connected domain's records with a saved key and link the key to the domain, so later repairs and the removal use it. It changes the domain's live DNS through the person's own account at their provider: ask the person first and send confirm: true (without it nothing is sent), with an accountId that find-saved-access listed for the same connection. You supply no records. Answers status connected (written, so poll check-connection-status) or already (the domain was already serving and is linked with no write). Failures: saved_access_not_usable (that key cannot act for this domain: call find-saved-access again) and saved_access_write_failed (the provider refused the write: nothing was linked and the key's access is as it was, but a provider that writes one record set at a time may have changed some of the domain's records before it failed; details has the provider's words). The use is in the audit log as agent.acted ("used a saved key") under the agent's grant once whenever the records were written, the key linked or the write failed at the provider; a use refused before anything was sent leaves no row.
get-widget-setup{ applicationId? }domains:readShow a developer how to embed the CustomDomain™ widget in their own product: the customdomain-js install command, the server step that mints a short-lived widget token, and the browser snippet. Pass applicationId to write it into the snippets; without it the docs' placeholder is used. Read only.
list-applications{}app:readList the workspace's applications: id, name, environment, sandbox, connect target, DNS hosting setting and creation time. Read only.
get-application{ applicationId }app:readGet one application and its settings. Read only.
create-application{ name, environment?, sandbox? }app:writeCreate an application. The result carries its client secret, shown this once; store it in your server's environment right away.
update-application{ applicationId, name?, dnsHostingMode?, dnsHostingTarget?, endUserSavedAccess? }app:writeChange an application's name, its DNS hosting offer (off, offer or prefer) and whether end users may save a provider key. Fields left out keep their value.
get-connect-target{ applicationId }app:readRead where an application's domains point: the CustomDomain™ edge, or your own servers with a CNAME target and IPv4 addresses for root domains. Read only.
set-connect-target{ applicationId, cnameTarget, apexIpv4?, confirm }app:writePoint an application's domains at your own servers, or back at the CustomDomain™ edge with an empty cnameTarget. It moves traffic for every connected domain of the application. confirm repeats the application id.
mint-widget-token{ applicationId, domain?, endUserRef?, endUserEmail? }tokens:mintMint a widget token (15 minutes) that opens the connect flow for one application, optionally bound to a hostname and an end user. Hand it only to the end user it is for.
list-api-keys{ applicationId }keys:manageList an application's API keys: id, name, prefix, environment, scopes, last use and whether it was revoked. A secret is never listed. Read only.
create-api-key{ applicationId, environment?, expires_at? }keys:manageCreate an API key. The secret is shown this once. A key an agent creates acts as a member: it embeds and connects domains, and cannot manage billing, members or keys. It expires within 90 days.
revoke-api-key{ applicationId, keyId, confirm }keys:manageRevoke an API key; every request that uses it fails from then on. confirm repeats the key's id.
list-webhooks{ applicationId? }app:readList the webhook endpoints: id, application, URL, events and creation time. A signing secret is never listed. Read only.
create-webhook{ url, events? }app:writeRegister an https endpoint for domain events. The signing secret is shown this once. With no events the endpoint gets every event.
test-webhook{ webhookId }app:writeSend a signed test event to an endpoint now and report how it answered.
delete-webhook{ webhookId, confirm }app:writeDelete a webhook endpoint; it receives no more events. confirm repeats the endpoint's id.
list-webhook-deliveries{ applicationId?, eventType? }app:readList recent delivery attempts, newest first, with the status the endpoint answered and any error. Read only.
list-members{}member:readList the workspace's members and open invitations: email, role, status and when an invitation expires. Read only.
invite-member{ email, role }member:manageInvite a person by email as an admin, member or viewer. Only a person makes an owner, in the console.
change-member-role{ memberId, role, confirm }member:manageChange a member's role to admin, member or viewer. A lower role takes rights away from the person at once. An owner's role stays with a person in the console. confirm repeats the member's id.
remove-member{ memberId, confirm }member:manageRemove a member, or withdraw an open invitation. The person loses access at once. confirm repeats the member's id.
read-audit-log{ action?, limit? }audit:readRead the audit log, newest first: who did what to which target and when. An agent's actions show as agent:<grant id>. Read only.
get-usage{ period? }stats:readRead plan usage for a billing period (YYYY-MM): the plan, domains used against the quota and what remains. Read only.
get-billing-notice{}stats:readRead the billing standing the console shows, with the link to the console's billing page. Plan and payment changes are made there by a person. Read only.

The scope is checked twice. A delegated agent token must carry the tool's scope, or the call is refused before it runs; the control plane checks the same scope again on the route the tool calls. An API key or a client credentials token holds no scopes: the control plane authorizes each call.

generate-domain-suggestions is deterministic, not AI. Candidates are keyword joins plus a few common affixes (get, try, use, my, …app, …hq), expanded across TLDs by the registrar search and filtered to what is actually available. No LLM is involved: the same keywords always produce the same candidates, which keeps the tool predictable and testable.

create-domain-order spends money, so it asks twice. A person who signed in through OAuth approves the domains:purchase scope with a saved card and a monthly spending limit on the consent screen, and the agent names the domain they confirmed in confirm_domain. Any other caller goes through the integrator's purchase authorization callback, which fails closed: with no callback configured, every purchase is denied. API keys cannot buy. You can also buy a domain in the console; see Buying a domain.

Repair

managed: true means the platform holds a kept grant for the domain. That is one way reapply-connection can work, not the only one, and managed: false does not mean a repair needs the person at their DNS provider. reapply-connection recomputes the desired records and rewrites them through the access CustomDomain™ keeps for the domain:

  • the stored grant of a managed connection (managed: true);
  • a DNS zone CustomDomain™ hosts for the domain (dnsHosting state hosted on list-connections);
  • a connected provider account that keeps the domain and wrote its records (list-provider-accounts).

It answers conflict when none of these holds. Check first rather than calling it to find out. A domain with none of them is repaired with find-saved-access and then use-saved-access, or by the person adding the records at their DNS provider or signing in again (the connect-domain link opens that page). No field says which access applies; managed still means a kept grant only.

Purchase authorization callback

Before a paid order from a caller that is not a person signed in through OAuth with the domains:purchase scope, create-domain-order asks an endpoint the integrator runs whether this purchase may go ahead. The deployment configures it with MCP_PURCHASE_AUTHZ_URL, MCP_PURCHASE_AUTHZ_USER and MCP_PURCHASE_AUTHZ_PASSWORD. With no URL set, every such purchase is denied.

The server sends a POST with a JSON body that carries only the domain, and HTTP Basic auth with the configured user and password. The shapes below are illustrative; the field names are exact.

POST /authorize-purchase HTTP/1.1
Authorization: Basic <base64 of user:password>
Content-Type: application/json
Accept: application/json

{ "domain": "example.com" }

What the server does with your answer:

Your answerResult
200Authorized, unless the body says "authorized": false. The body may carry the registrant contact and records (below).
200 with "authorized": falseDenied. Your reason becomes the tool's message.
401Denied.
Any other statusDenied.
A network error, or no answer within 10 secondsDenied.

A denial answers success: false with the status and the error rejected. Nothing is ordered and nothing is charged.

An approval's body looks like this:

{
  "authorized": true,
  "reason": "approved",
  "buyer": { "name": "Ada Lovelace", "email": "[email protected]", "country": "GB" },
  "dnsRecords": [
    { "type": "CNAME", "host": "www", "value": "app.example.net", "ttl": 3600, "priority": 0 }
  ]
}
  • buyer is the registrant contact. The agent never supplies one, so it has to come from you. buyer.email is required: an approval without it (including a 200 with no body, or a body that is not JSON) answers the status and the error buyer_required, and nothing is ordered.
  • dnsRecords (each { type, host, value, ttl, priority }) optionally seeds the new domain's DNS. They come from you, never from the agent.
  • The order is sent with an idempotency key made from the domain and buyer.email, so a retried call for the same buyer and domain does not register it twice.

Scopes

ScopeLets an agent
domains:readLook, and change nothing: availability, suggestions, connection, certificate, order and nameserver move status, diagnosis, provider discovery, listings, billing standing, the connected provider accounts and which saved keys may act for a domain.
domains:connectSet a domain up: connect, re-apply, recheck, forward and email setup, move its nameservers or move them back, and write a domain's records with a saved key. A recheck can move a failed connection back into verification, so it is here and not in read.
domains:disconnectTake a connected domain offline. Its own scope, so a grant that may set domains up cannot also remove them. A grant approved before this scope existed does not carry it: the person approves the agent again to add it.
domains:purchaseRegister a domain. Spends money, and the grant needs a saved card and a monthly spend cap.
stats:readRead plan usage and the billing notice. Plan and payment changes stay with a person in the console.
audit:readRead the workspace audit log.
app:readRead applications, their connect target, webhooks and webhook deliveries.
app:writeCreate and change applications, set the connect target, and manage webhooks.
tokens:mintMint a short lived widget token for an application.
member:readList members and open invitations.
member:manageInvite members, change their role and remove them. Never makes an owner.
keys:manageList, create and revoke API keys. A key an agent creates acts as a member.

The discovery documents list them in that order: the domain scopes as look, change, remove, spend, then the workspace scopes, reads before writes. A workspace scope works only while the person who approved the agent still holds that permission in the workspace, and an agent never acts as an owner. See Agent access for how a person approves them.

What a call answers

A success is the tool's JSON object. A failure is an isError: true result with one shape, whichever tool made it:

{ "success": false, "error": "billing_required", "message": "An active subscription is needed to connect new domains.", "details": "..." }

error is the control plane's own code when it sent one (billing_required, quota_exceeded, confirmation_required, confirmation_mismatch, forbidden, not_found, conflict, service_unavailable, ns_not_offered and so on), else the tool's fallback code: search_failed, suggest_failed, order_failed, connect_failed, status_failed, reapply_failed, disconnect_failed, discover_failed, forward_failed, add_email_failed, list_failed, certificate_failed, recheck_failed, diagnose_failed, billing_failed, orders_failed, nameservers_failed (the three nameserver tools), accounts_failed (list-provider-accounts), saved_access_failed (find-saved-access and use-saved-access), or tool_failed for anything else. create-domain-order reports the status that stopped it, such as rejected or buyer_required. details is there only when there is one; for billing_required it says where to fix it. Branch on error. After a billing_required failure, check-billing-status says why.

Three refusals happen before a tool runs:

  • A call with a missing or malformed argument (for example no confirm on disconnect-domain, a confirm_domain on create-domain-order that does not repeat domain, or an add-email or forward-domain value of the wrong shape, such as an IP address for mxHost) gets the JSON-RPC error -32602, which names the argument. An unknown tool is -32601.
  • A token without the tool's scope gets the JSON-RPC error -32003, insufficient_scope, which names the scope it needed.
  • A caller over its tool call limit gets rate_limited with retryAfterSeconds, and the call never reaches the control plane. The limit is 5 calls a second with bursts of 20 (MCP_TENANT_RPS, MCP_TENANT_BURST; 0 turns it off). For API keys it is counted per credential: each API key, and each /token JWT, has its own bucket, so a workspace with several keys has several. A delegated agent token counts against its workspace, whose agents share one bucket, and the CLIENT_ID:CLIENT_SECRET form against its application.

On the http transport, a credential that is missing, invalid, expired or revoked is answered with HTTP 401 rather than a failure inside a 200, so the client knows to sign in again or use another credential. The answer carries the challenge WWW-Authenticate: Bearer realm="mcp", error="invalid_token", resource_metadata="https://mcp.customdomain.ai/.well-known/oauth-protected-resource" and the OAuth error body { "error": "invalid_token", "error_description": "..." }:

  • An API key or a /token JWT is checked with the control plane when it arrives, so a revoked or expired one is refused on initialize and tools/list as well as on a tool call. The server reuses that answer for a short while (60 seconds for a good credential, 30 for a refused one), and a credential revoked within that time is refused by the next tool call it makes: the request is answered 401 instead of a result. A check that fails for another reason (the control plane cannot be reached) lets the request through.
  • A delegated agent token is verified locally: an expired one, a bad signature or a token issued for another audience is refused at once. A token whose grant was revoked still verifies, so initialize and tools/list answer, but its first tool call that reaches the control plane is answered 401.
  • A CLIENT_ID:CLIENT_SECRET pair the control plane refuses is 401 at once (see Authentication for its limit).

The stdio transport has no HTTP status: there a refused credential is a failed tool result with the error unauthorized.

A request a browser sends from a web page is refused before any of this, unless the page's origin is the server's own or one its operator lists (MCP_ALLOWED_ORIGINS): it gets HTTP 403 with the JSON-RPC error -32000 (origin not allowed) and no id. A client that sends no Origin header, which is every desktop, command line and server MCP client, is not affected.

Text a third party wrote (domain names, DNS record values, provider and registrar names, error text) is data, never instructions. A DNS value is cut at 256 characters and an error text at 600, and the cut is marked [truncated].

Transports

The server binary (cmd/mcp) speaks two transports, selected with -transport:

  • stdio (default): line delimited JSON-RPC on stdin and stdout, one message per line. This is what a locally launched host (or mcp-remote) uses when it runs the server as a subprocess. It authenticates with a single static control plane credential (-bearer, or the CUSTOMDOMAIN_API_TOKEN environment variable, with the older JUSTEASY_API_TOKEN as a fallback).

  • http: a Streamable HTTP style endpoint. These are all of its routes:

    RoutePurpose
    POST /mcpThe MCP JSON-RPC endpoint. Requires Authorization: Bearer (unless started with -insecure for local development).
    POST /tokenOAuth 2.0 client credentials grant: exchange client_id and client_secret for a short lived Bearer. Limited per caller IP address (see Authentication).
    GET /healthzLiveness. Answers 200 with ok.
    GET /.well-known/oauth-protected-resourceRFC 9728 protected resource metadata, also served at /.well-known/oauth-protected-resource/mcp. The 401 from /mcp points here. It names the control plane (https://api.customdomain.ai) first as the authorization server, then this server, and lists the twelve scopes.
    GET /.well-known/oauth-authorization-serverRFC 8414 authorization server metadata for /token (the client_credentials grant). The authorization code flow for delegated agents belongs to the control plane, not to this server: see Agent access.
    GET /.well-known/agent/mcp.jsonThe agent capability manifest: protocol, transport, endpoint, auth and the live tool list.

    The three /.well-known/ documents are public, cacheable for an hour and open to any origin.

The hosted server is at https://mcp.customdomain.ai (the MCP endpoint is POST https://mcp.customdomain.ai/mcp).

Authentication

POST /token proxies the control plane's POST /v1/tokens with the app scope: it exchanges an application's client_id and client_secret (also accepted as application_id) for a widget JWT that acts as the whole application. Credentials may be sent as HTTP Basic auth, form fields, or a JSON body; the only supported grant_type is client_credentials.

# Mint a short lived Bearer
curl -X POST https://mcp.customdomain.ai/token \
  -u "<APPLICATION_ID>:<CLIENT_SECRET>" \
  -d "grant_type=client_credentials"
# → { "access_token": "eyJ…", "token_type": "Bearer", "expires_in": 900 }

expires_in is what is left of the token's life, in seconds: 900 (15 minutes, the control plane's JUSTEASY_TOKEN_TTL) for a new token. The server keeps the token it minted for a client id and secret and hands the same one back, with the seconds it has left, until a minute before it expires; the next request after that mints a new one. Mint again when it runs out.

POST /token is limited per caller IP address: one request a second, with bursts of 10. Over the limit the answer is 429 with { "error": "rate_limited" } and a Retry-After header in seconds. Each exchange carries the caller's address to the control plane, so the control plane's own limit on minting tokens counts each caller, not the MCP server as a whole.

POST /mcp accepts three Bearer forms, so hosts that cannot run the token dance still authenticate:

  1. a JWT minted by /token,
  2. a console API key (cd_live_… / cd_test_…, or an older sk_live_… / sk_test_… key, which keeps working),
  3. the mcp-remote shortcut CLIENT_ID:CLIENT_SECRET, which the server exchanges for a JWT on the fly and reuses like /token does, until a minute before it expires. A pair the control plane refuses is 401. Refused pairs are limited per caller IP address: 10, then one more every 10 seconds. Past that, a pair the server has not already exchanged gets 429 rate_limited with Retry-After, and no exchange is tried; a pair it already holds a token for keeps working.

For these integrator credentials the MCP server does not validate tokens cryptographically: it forwards the caller's credential to the control plane, which is the authority and rejects bad credentials on every wrapped call. It also asks the control plane about an API key or a /token JWT when it arrives (GET /v1/billing/standing, a read every credential may make), so a refused one gets HTTP 401 before any tool runs (see What a call answers). Every route a tool calls takes all three credentials; purchases stay closed to API keys.

Delegated agent tokens are the exception. When a person grants an AI agent access, the agent presents a short lived ES256 token that the MCP verifies locally against the control plane JWKS (no per request callback) and enforces the tool's required scope on, so a read only grant can never reach a connect, disconnect or purchase tool. The token must name this server's endpoint as its audience (aud, RFC 8707), https://mcp.customdomain.ai/mcp by default; a token for another audience is refused with 401 invalid_token. The control plane checks every tool call's token again, its grant included, so a token whose grant was revoked is refused with 401 too. A client that follows the 401 to the protected resource metadata needs no key: it signs the person in at the control plane and receives a delegated agent token. See Agent access for the human first consent flow.

# Call a tool
curl -X POST https://mcp.customdomain.ai/mcp \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"search-domain-availability","arguments":{"domain":"example.com"}}}'

Configuration

The http transport reads these (flags shown; each has an env alias):

Flag / envPurpose
-api / MCP_API_BASEControl plane base URL (default https://api.customdomain.ai).
-addr / MCP_ADDRHTTP listen address (default :8080).
-public-base / MCP_PUBLIC_BASEPublic origin used in the discovery documents and as the base of the token audience (default https://mcp.customdomain.ai).
-auth-server / MCP_AUTH_SERVERPublic origin of the control plane that issues agent tokens, named first in the protected resource metadata (default https://api.customdomain.ai). It must equal the issuer that server reports.
-agent-jwks-url / MCP_AGENT_JWKS_URLThe control plane's JWKS. Empty leaves delegated agent tokens off.
-tenant-rps / MCP_TENANT_RPS, -tenant-burst / MCP_TENANT_BURSTTool calls per second (default 5) and burst (default 20) for each caller: each API key or /token JWT, each workspace for agent tokens (see What a call answers). 0 turns the limit off.
-link-base / MCP_LINK_BASEConsole URL prefix for guided DNS fallback links.
-preferred-registrar / MCP_PREFERRED_REGISTRARRegistrar tried first during order resolution.
-purchase-authz-url/-user/-pass / MCP_PURCHASE_AUTHZ_*The fail closed purchase authorization callback. Unset means purchases are denied.
JUSTEASY_MCP_USAGE_KEYTurns on usage recording to the control plane (CUSTOMDOMAIN_MCP_USAGE_KEY is read first; MCP_USAGE_INGEST_KEY still works as a fallback). Unset leaves it off.
-allowed-origins / MCP_ALLOWED_ORIGINSBrowser origins (scheme://host[:port], comma separated) allowed to call /mcp besides the -public-base origin. A request from any other Origin gets 403; one with no Origin is unaffected. There is no wildcard, and an entry that is not an origin stops the server at start.
-insecure / MCP_INSECURE=1Serve /mcp without Bearer auth. Local development only: the server refuses to start with it unless -addr is a loopback address (such as 127.0.0.1:8080 or localhost:8080), and never when SENTRY_ENVIRONMENT says production.

On this page