Skip to content
Codelia SMSDocs
Guides: AI assistants (MCP)

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

  1. In your assistant's settings, add https://api.sms.codelia.studio/v1/mcp as 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.
  2. When it asks, sign in to Codelia SMS.
  3. Choose the organization it should use. It can act only in that organization.
  4. 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/mcp.json in your project, and in Claude Code you add it with one command:

{
  "mcpServers": {
    "codelia-sms": {
      "url": "https://api.sms.codelia.studio/v1/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

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.

ToolPermissionWhat it does
get_accountNoneSays which organization it works in, what it may do there, and its organization's limit on assistant actions
get_balancebilling:readReads your balance
list_sender_namessender-ids:readLists your sender names
quote_messagemessages:readPrices a message without sending it
quote_campaignmessages:readPrices a campaign without sending it
send_messagemessages:send and messages:readSends a message, once you've confirmed its estimated cost
send_campaignmessages:send and messages:readSends a campaign now or schedules it, once you've confirmed its estimated cost
cancel_campaignmessages:sendCancels a queued or scheduled campaign, or one whose sending stopped part-way
list_messages, get_messagemessages:readFinds messages and their status
list_campaigns, get_campaignmessages:readFinds campaigns and their progress
list_contacts, get_contactcontacts:readFinds contacts
create_contact, update_contact, delete_contactcontacts:writeAdds, edits and deletes contacts
list_contact_lists, get_contact_listcontact-lists:readFinds lists and how many contacts each holds
create_contact_list, add_to_list, remove_from_listcontact-lists:writeCreates lists, and adds or removes contacts

create_contact and update_contact take a contact's birthday as a day and a month, with the year optional; update_contact removes it when given null. list_contacts 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:manage lets 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."

  1. If you keep those people on a list, the assistant finds it by name with list_contact_lists.
  2. It calls send_campaign with the list in listIds and scheduledAt set to 9:00 tomorrow. That first call schedules nothing: it answers with the contacts, the parts and the estimated cost, and a confirmationToken, and the assistant shows them to you.
  3. You say yes. It calls send_campaign again with the same input plus the 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_message and send_campaign each take two calls.

  1. 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. With billing:read it includes your balance too. Nothing is sent, scheduled or charged.
  2. 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_changed 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_recipients_not_allowed if one is in such a country, otherwise with all_recipients_unsupported 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_campaign 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_campaign with scheduledAt answers auto_topup_required, 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_rate_limited and says how many seconds to wait. get_account tells the assistant the number.
  • 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 answers rate_limited with retryAfterSeconds. If the request to the server itself is over, the server answers HTTP 429 with a Retry-After header.

Errors

A tool that fails answers with an error the assistant can read, with a code and a message.

CodeWhat to doWhat happened
confirmation_invalidPrice 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_expiredPrice it again and ask the person to confirm.The confirmation is more than 10 minutes old.
quote_changedShow 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_rate_limitedWait 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_scopeConnect 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_errorCheck list_messages or list_campaigns 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_credits, explained in Errors and limits, or auto_topup_required, explained in Scheduling needs auto top-up.

Two answers come from the server itself, before any tool runs:

  • 401, invalid_token: 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 as Authorization: Bearer <key>." and the WWW-Authenticate header tells the assistant where to sign in. A key that is wrong, disabled, expired or revoked answers invalid_api_key instead, with the same header.
  • 403, api_key_required: 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."