Overview
If your platform already runs an MCP server, you can add domain connection to it directly instead of asking your users to install a second server. You build two tools on top of Entri’s Sharing Links API:connect_domain creates a link where the user sets up their domain, and get_domain_connection_status reports whether the domain works. Your server holds the Entri credentials, resolves the DNS records for the current user, and decides what the agent sees.
That last part matters as much as the API calls. The agent only knows what your tool names, descriptions, and results tell it, so this guide covers both the Entri endpoints each tool calls and how to shape the tools so the agent picks the right one and acts correctly on the result. If you would rather not build tools, the hosted Entri MCP server exposes ready-made ones.
How it works
- The user asks the agent to connect a domain, and the agent calls
connect_domainwith it. - Your server creates a link with the Sharing Links API, with the domain and the DNS records your platform needs, and returns it.
- The agent sends the link to the user. On that page, Entri detects the DNS provider. If Entri can configure it, the user signs in and Entri applies the records. If not, the page shows the records to add by hand and links to your setup guide.
- When the user says they are done, the agent calls
get_domain_connection_status, and your server reads the flow status to tell the agent where the setup stands.
The Sharing Links API response contains only
link and job_id. It does not say whether the user will get an automatic or a manual setup, because the modal decides that when the user opens the link. If you would rather handle manual setups with your own guide, you can optionally check the domain with /checkdomain before you create the link, as described in Handle manual setups yourself.Before you start
The Sharing Links API validates the link config against your plan, so the features you use in it, such as
prefilledDomain, must be included in your plan. Otherwise the request fails with Features [...] are disabled on your account.
Design the tools for the agent
An agent chooses a tool from its name, description, and input schema, and decides what to do next from the result. Treat all four as prompts. The patterns below cover the first three, and each tool section shows the results the agent gets back.Expose intents, not endpoints
Two tools that match what users ask for (“connect my domain”, “is my domain working?”) work better than one tool per API call.connect_domain loads the user’s records, creates the link, and stores the job_id in one call, so the agent never orchestrates API calls or passes IDs between them. Any logic you add later, such as the optional domain check, belongs inside the tools too, so the right behavior is the only one available.
Name the tools after the intent as well. Users never ask for a “sharing link”, so a tool called create_sharing_link matches their words poorly. connect_domain and get_domain_connection_status match how people phrase the request.
Write descriptions for the model
A description should say what the tool does, when to use it, when not to, and what happens after. Include a few phrases users actually say. Tool definitions are part of the agent’s context on every turn, so keep descriptions to a few sentences. If your server has other domain tools, for example one that buys domains or one that adds a domain to a project, say in each description when the other tool is the right one so the agent can tell them apart. If your platform needs the domain registered on its side before DNS is configured, do that insideconnect_domain rather than relying on the agent to call two tools in the right order.
Keep inputs to what the model knows
The only input of both tools is the domain. The model never supplies DNS records, yourapplicationId, or tokens. Your server resolves the records for the authenticated user, so the agent cannot invent or change them. The model never handles the job_id either. Agents lose opaque IDs in long conversations and between sessions, so your server stores it and looks it up by user and domain. Normalize the domain on your server, because users paste URLs: https://Example.com/shop should become example.com.
Shared code
The examples use TypeScript and the MCP TypeScript SDK. The same structure works with any MCP SDK. The full example at the end of this page puts every part in one file.Your platform
These declarations are the parts that depend on your platform. Replace them with your own code.dnsRecordsFor returns the records in the same format as the dnsRecords config key.
Entri API calls
Mint the JWT on your server as described in Token creation (JWT). It is valid for 60 minutes, so cache it instead of requesting one per call.flowStatus returns null when Entri no longer has the flow. Entri keeps a flow for 90 days, so setupStatus saves the domain as connected the first time the flow reports it, and both tools keep answering correctly after that.
userId so that webhooks for the flow map to your user, and manualSetupDocumentation so that the modal links to your guide if the setup turns out to be manual. It accepts every other Connect configuration option as well, for example whiteLabel.
Result helpers
Both tools return JSON in a text block, which every MCP client can read.Create the server
MCP servers can sendinstructions when a client connects, and clients can add them to the agent’s context. Use them to describe the workflow across both tools. Not every client uses them, so keep the essentials in the tool descriptions too. If you control the agent’s system prompt, for example in an assistant inside your product, add the same text there.
connect_domain
This tool takes the domain and returns a link where the user finishes the setup. A link only works until that setup finishes, so when the tool is called again for the same domain, step 1 returns the stored link only while the setup is unfinished, and no link once the domain is set up.
next_step, the field in every result that tells the agent what to say to the user and which tool to call next. This one covers both setups the user can get on that page, so the agent is ready when the page asks the user to add the records by hand.
get_domain_connection_status
This tool takes the domain, looks up the stored connection, and reads its status with setupStatus.
connected first. status only explains where the user is while the domain is not connected yet.
in_progress while the user adds the records, and connected turns true once the user confirms on that page and Entri detects the records.
Handle errors
Return errors as tool results withisError: true instead of throwing, so the agent can read the next_step and explain the problem to the user. Keep Entri’s messages, tokens, and stack traces in your logs and out of the result.
Input that is not a domain never reaches Entri. normalizeDomain rejects it, and the tool returns invalid_domain so the agent asks the user to check it. Errors from Entri go through failure, which logs the details and returns unavailable. That covers a link config that uses a feature outside your plan (400), invalid credentials (401 or 403), and problems on Entri’s side (5xx). The one exception is a 404 from the flow status endpoint, which flowStatus turns into null because it means the flow expired.
Test tool selection
Before you ship, run real requests through the agents your users have and check three things for each one: which tool the agent calls, the domain it passes, and what it tells the user. Keep the set and run it again whenever you change a tool name, a description, or anext_step, since a small wording change can shift which tool the agent picks.
Also check what the agent says: it shares the link, and it never asks for the DNS provider password. The MCP Inspector (
npx @modelcontextprotocol/inspector) lets you check the tool list and call each tool directly before you test with an agent.
Full example
server.ts
server.ts
server to your transport the same way you do for your other tools.
Handle manual setups yourself (optional)
You do not need this section to connect domains. When Entri cannot configure a DNS provider automatically, its page already shows the user the records to add by hand and links to yourmanualSetupDocumentation. Add the steps below only if you want the agent to walk those users through your own guide in the chat instead, without sending a link.
To do that, call POST /checkdomain before you create the link. It returns the DNS provider and whether the setup will be Automatic or Manual. When it is Manual, connect_domain returns the records and your guide instead of a link, and the status tool checks those records with your own DNS check, since no Entri flow runs.
/checkdomain is available on the Premium tier and above. It predicts the setup from the same provider data the modal uses, but the modal makes the final decision when the user opens a link. Pass it the same records you put in the link, because it also returns Manual when the provider cannot host one of them, for example an NS record on a subdomain.
When it cannot detect the provider, /checkdomain returns Manual with provider: "Unknown". The modal would let those users choose their provider from a list, and some of those providers support automatic setup. If you would rather give them that chance, also create the link when provider is "Unknown".
Add these next to the shared code:
connect_domain, check the domain after loading the records and before creating the link:
get_domain_connection_status, check manual setups first, at the start of the try block:
connect_domain description, so the agent expects either result:

