AI assistants (MCP)
Your AI assistant can price, send and schedule messages, and look after your contacts and lists, through the Codelia SMS MCP server. Before anything is sent or scheduled, it gets the contacts, the parts and an estimated cost to show you.
The server's address is https://api.sms.codelia.studio/v1/mcp.
Connect
The first three open the assistant with Codelia SMS filled in. Confirm it there, then sign in when it asks. If nothing happens, follow the steps below. ChatGPT can't be filled in from a link: turn on Developer mode in its settings, then add the address above as a custom connector.
To connect it by hand, there are two ways. Use the first if your assistant offers it.
Sign in
- In your assistant's settings, add
https://api.sms.codelia.studio/v1/mcpas a custom connector. ChatGPT and claude.ai connect this way, and so do other assistants that offer custom connectors. In ChatGPT, turn on Developer mode in its settings first. If claude.ai asks you to choose an OAuth client, choose Register automatically: Codelia SMS doesn't work with Use Claude's published identity. - When it asks, sign in to Codelia SMS.
- Choose the organization it should use. It can act only in that organization.
- Select what it can do. Reading starts selected; sending and changing contacts or lists don't, so select them only if you want it to do those things.
To connect an assistant you need the connected-apps:connect permission. Owners, admins and developers have it. If you don't, ask an owner or admin.
API key
For an assistant that lets you add a header, create a key on the API keys screen in the portal and add it to your assistant's config. In Cursor it goes in mcp.json, in VS Code in .vscode/ in your project, and in Claude Code you add it with one command:
Give the assistant a key of its own, so you can revoke it without stopping anything else that uses the API.
Which permissions to give it
Your assistant sees only the tools its permissions allow, so a read-only key never sees a tool that sends or changes anything. Give it only what it needs: select only those at sign-in, or give it its own key.
| Tool | Permission | What it does |
|---|---|---|
get_ | None | Says which organization it works in, what it may do there, and its organization's limit on assistant actions |
get_ | billing:read | Reads your balance |
list_ | sender-ids:read | Lists your sender names |
quote_ | messages:read | Prices a message without sending it |
quote_ | messages:read | Prices a campaign without sending it |
send_ | messages:send and messages:read | Sends a message, once you've confirmed its estimated cost |
send_ | messages:send and messages:read | Sends a campaign now or schedules it, once you've confirmed its estimated cost |
cancel_ | messages:send | Cancels a queued or scheduled campaign, or one whose sending stopped part-way |
list_, get_ | messages:read | Finds messages and their status |
list_, get_ | messages:read | Finds campaigns and their progress |
list_, get_ | contacts:read | Finds contacts |
create_, update_, delete_ | contacts:write | Adds, edits and deletes contacts |
list_, get_ | contact-lists:read | Finds lists and how many contacts each holds |
create_, add_, remove_ | contact-lists:write | Creates lists, and adds or removes contacts |
create_ and update_ take a contact's birthday as a day and a month, with the year optional; update_ removes it when given null. list_ can't find contacts by birthday: it searches names, email addresses and phone numbers. To send to the contacts whose birthday is this month, filter Contacts in the portal by "Birthday is this month" and save it as a list. The assistant can find that list by name and send to it, and because a smart list is read when it's sent to, a send in April reaches April's birthdays (see Smart lists).
A key made with the Send only preset holds messages:send and messages:read. It can send to numbers you give it, but it can't find a list by name. For it to send to one of your lists, add contact-lists:read so it can find the list.
Disconnect it
- Connected by sign-in: open Connected apps in the portal and choose Disconnect. It stops working straight away, and for good: to use that app again, connect it again. Anything it already scheduled still sends; cancel that under Campaigns. You can always disconnect your own connections, and
connected-apps:managelets you see and disconnect everyone's. If the same account connected that app to another organization too, the app may ask to sign in again there. - Connected with a key: revoke or disable the key on the API keys screen in the portal.
A connection made by sign-in also ends for good when the member who made it leaves the organization, is deactivated, or loses the connected-apps:connect permission. Giving the permission back doesn't bring it back: they connect it again.
Things to ask
- Price it: "How much would it cost to text my VIP customers list about Saturday's sale?" It finds the list, then quotes the contacts, the parts and an estimated cost. Nothing is sent.
- Send one message: "Text Alex Morgan: your table is ready." It finds Alex in your contacts and gets a quote to show you. Nothing is sent until it confirms that quote.
- Schedule a campaign: "Remind everyone on my “Tomorrow's bookings” list at 9." It finds the list and gets a quote to show you, and the campaign is scheduled only once it confirms that quote. Scheduling needs auto top-up.
- Check what failed: "Which messages failed yesterday?" It lists yesterday's messages that failed, were undelivered or were rejected, with each one's status.
- Tidy your contacts: "Put Alex Morgan on my VIP customers list." It finds Alex in your contacts, or adds them if you give it their number, then puts them on the list.
- Check your balance: "How much credit do I have left?" It tells you your credit balance, once you've given it permission to see the balance (billing:read).
Each needs the permissions of the tools it uses: see the table above.
Worked example
You ask: "Remind tomorrow's appointments at 9."
- If you keep those people on a list, the assistant finds it by name with
list_.contact_ lists - It calls
send_with the list incampaign listIdsandscheduledAtset to 9:00 tomorrow. That first call schedules nothing: it answers with the contacts, the parts and the estimated cost, and aconfirmationToken, and the assistant shows them to you. - You say yes. It calls
send_again with the same input plus thecampaign confirmationToken, and the campaign is scheduled.
If your assistant reads your calendar through another tool, it can pass the phone numbers in recipients instead of a list. Codelia SMS doesn't hold your appointments: the assistant works from the lists you keep, or from the numbers it passes.
Every message and campaign is priced first
send_ and send_ each take two calls.
- The first call prices the message or campaign and answers with the contacts, the parts and the estimated cost, in your organization's currency, and a
confirmationToken. Withbilling:readit includes your balance too. Nothing is sent, scheduled or charged. - The second call carries the
confirmationToken. The server prices it again and, if nothing changed, sends it or schedules it.
The server makes sure that:
- nothing that costs money happens on the first call;
- for a message or campaign sent now, the price can't rise between the first call and the second;
- repeating the second call returns the first answer, so a retry never sends twice.
It can't know that you said yes. The assistant is told to show you the estimated cost and wait for your answer, and most assistants also ask before they run a tool marked as destructive, as both send tools are.
A confirmation lasts 10 minutes. If the estimated cost went up or the number of contacts changed since the first call, the second call answers quote_ with the new estimated cost and a new confirmation, for the assistant to show you.
A scheduled campaign is priced again when you confirm it, but its contacts and its cost are set when it sends, so a list that changes by then changes what goes out. What you confirm is an estimate.
Contacts who opted out, numbers we can't send to, and numbers in a country your organization can't send to yet are counted in the estimated cost. They're skipped when the messages go out, and never charged. If every number would be skipped, the send is refused: with all_ if one is in such a country, otherwise with all_ if one is a number we can't send to.
A campaign sent now to more than 500 people is accepted shortly after the confirming call answers, and that call answers "The campaign is accepted. Check get_campaign for progress." A problem found once it's accepted, such as a balance that doesn't cover it or every number being skipped, doesn't come back from the tool: get_ gives the reason in failureReason, and nothing is charged. See Large campaigns.
Scheduling needs auto top-up
A campaign can be scheduled from 5 minutes to 90 days ahead, and only with auto top-up set up to pay for it. Without it, the confirming call to send_ with scheduledAt answers auto_, and nothing is scheduled. Turn on auto top-up under Billing in the portal, then ask the assistant to price it again. The confirmation that was refused can't be used again.
Limits
Two limits apply, each for one minute at a time.
- Your organization's assistant actions: 120 a minute by default, shared by every assistant connected to your organization, by key or by sign-in. Only actions count: connecting and listing what it can do don't. Over the limit, the tool answers
mcp_and says how many seconds to wait.rate_ limited get_tells the assistant the number.account - Each key's and each connection's requests: every tool call makes requests to the API, and they count against the limit of the key, or the sign-in connection, that made them. Each has 60 requests a minute by default, counted apart from every other key and connection. Sending one confirmed message or campaign takes about 5 of them, or 6 when the assistant holds
billing:read, because its first answer then includes your balance. Over the limit, a tool answersrate_withlimited retryAfterSeconds. If the request to the server itself is over, the server answers HTTP 429 with aRetry-Afterheader.
Errors
A tool that fails answers with an error the assistant can read, with a code and a message.
| Code | What to do | What happened |
|---|---|---|
confirmation_ | Price it again and ask the person to confirm the new estimated cost. | The confirmation doesn't match this request: it was changed, or it came from another key, another tool or a different input. |
confirmation_ | Price it again and ask the person to confirm. | The confirmation is more than 10 minutes old. |
quote_ | Show the new estimated cost and ask again. | The estimated cost went up, or the number of contacts changed, since it was priced. The answer carries the new estimated cost. |
mcp_ | Wait that long, then ask again. Don't retry in a loop. | Your organization used its assistant actions for this minute. The answer says how many seconds to wait, in retryAfterSeconds. |
insufficient_ | Connect again and select that permission, or add it to the key. | The connection can't do what the tool needs, and the message names the permission: "This connected app needs messages:send (send messages and campaigns, and cancel scheduled ones). Connect it again and allow that, then disconnect the old connection under Connected apps." for a sign-in, or "This key needs messages:send." for a key. |
internal_ | Check list_ or list_ before trying again: something may have been sent. | The request failed on our side, so its outcome is unknown. |
Any other error from the API comes back unchanged, with its own code and message: for example insufficient_, explained in Errors and limits, or auto_, explained in Scheduling needs auto top-up.
Two answers come from the server itself, before any tool runs:
401,invalid_: no API key and no sign-in, or one that isn't valid anymore (a connection that was disconnected, for example). The message reads "Sign in to connect this app, or send an API key astoken Authorization: Bearer <key>." and theWWW-Authenticateheader tells the assistant where to sign in. A key that is wrong, disabled, expired or revoked answersinvalid_instead, with the same header.api_ key 403,api_: a portal sign-in, which the server doesn't take. The message reads "This endpoint takes an API key or a connected-app sign-in."key_ required
Related
- Authentication: the permissions a key can hold, and how to roll or revoke one.
- Campaigns and templates: how a scheduled campaign is priced and charged when it sends.
- Billing: your balance, and auto top-up.