MCP gives an SMS agent hands. Instead of hard-coding every integration, your agent connects to MCP servers that expose tools (check a calendar, look up an order, create a ticket) and lets the model call them while it answers a text. The catch is that a texting agent is reachable by anyone with a phone, so every tool you add is also reachable by anyone who can trick the model.
This guide builds on our SMS agent architecture guide.
Where does MCP fit in an SMS agent?
MCP (Model Context Protocol) is an open standard for connecting models to tools and data. There are two roles: clients, which run inside your agent and pass tools to the model, and servers, which implement the tools. For a general primer, see getpersonalaiagents.com's MCP connectors explainer.
- Inbound SMS
- Your agent (MCP client)
- LLM picks a tool
- MCP server (calendar, CRM)
- Reply SMS
Your SMS webhook and compliance gate stay exactly as before. MCP only changes the agent loop: rather than a fixed list of Python functions, the loop asks each connected server for its tools, filters them, and passes the survivors to the LLM.
Which Twilio MCP servers exist?
Twilio offers MCP in two quite different forms. Neither is a ready-made "SMS agent".
| Server | What it does | Intended user |
|---|---|---|
| Twilio MCP server (docs) | Semantic search over 1,500+ Twilio API endpoints across 30+ products, via a twilio__search tool |
Coding agents such as Claude Code and Cursor, helping you write integration code |
@twilio-alpha/mcp (April 2025) |
Exposes Twilio APIs themselves as callable tools, filtered with --services and --tags |
Developers experimenting with an AI that can act on a Twilio account |
| Serverless MCP template | A pattern for hosting your own MCP server on Twilio Functions | Teams building custom tools |
Sources: Twilio's AI docs, the Alpha MCP announcement and Twilio's Serverless MCP post.
The Alpha announcement notes that Twilio has nearly 2,000 endpoints, too many for most context windows, which is why filtering exists. It also says the server ran locally only, without user authentication, at launch, and Twilio's security team advised against running community MCP servers alongside it because of injection risk. Treat it as a developer tool, not something to wire into a public bot.
Community MCP servers that let assistants send and read SMS through Twilio also exist. They are useful for a personal assistant on your own phone; they are a liability in a customer-facing agent.
How do you add MCP tools to an agent loop?
A sketch in Python using the official MCP SDK's client session. The important part is the allowlist, not the plumbing.
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
ALLOWED = {"find_slots", "book_slot", "get_order_status"}
NEEDS_CONFIRM = {"book_slot"}
async def agent_reply(user_text, history, verified_user):
params = StdioServerParameters(command="node", args=["calendar-server.js"])
async with stdio_client(params) as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
tools = [t for t in (await session.list_tools()).tools
if t.name in ALLOWED]
plan = call_llm(history + [user_text], tools=tools)
if plan.tool_call:
name, args = plan.tool_call.name, plan.tool_call.args
if name in NEEDS_CONFIRM and not verified_user.confirmed(name, args):
return "Reply YES to confirm booking " + args["slot"] + "."
result = await session.call_tool(name, args)
return call_llm(history + [user_text, result], tools=[]).text
return plan.text
Three things this does deliberately:
- Filters by name, so a server update that adds new tools does not silently expand what the model can do.
- Checks confirmation in code, using a stored pending action, not the model's claim that the user agreed.
- Never gives the model a messaging tool. Your own outbound layer sends the reply to the number that texted in, and only that number.
What are the security risks of MCP over SMS?
The best-known demonstration is Invariant Labs' April 2025 research. An agent connected to a WhatsApp MCP server was attacked two ways:
- A "sleeper" malicious server. A harmless-looking tool changed its description after approval to tell the agent to redirect messages to an attacker's number. The malicious tool never had to be called.
- An injected message. A crafted inbound message that appeared in the agent's chat list made it send the user's recent contacts to the attacker.
In both cases the data left through the messaging tool itself, and the exfiltration payload was hidden off-screen in the confirmation dialog. Simon Willison's write-up summarises why this class of problem is hard to fix at the model level.
How do you lock it down?
- Allowlist toolsExpose the fewest tools the use case needs, by exact name.
- Pin serversRun only first-party or audited servers, pinned to a version you reviewed.
- Default to read-onlyLookups run automatically; writes need confirmation checked in code.
- Bind to the senderTools act only on the verified user's own records, never arbitrary IDs or numbers.
- Log every callRecord tool name, arguments and result for audit and abuse detection.
Also scope credentials per server. A calendar server should hold a token that can only touch your booking calendar, not your whole workspace. If a tool needs customer identity, pass it from your verified session, not from the model's arguments. Our guide to prompt injection through text messages covers more defences, and SMS spoofing explains why the sender number alone is not verification.
When is MCP worth it?
Pros
- Reuse existing tool servers instead of writing integrations
- Share one tool layer across SMS, WhatsApp and voice agents
- Swap models without rewriting tool code
Cons
- Extra moving parts and another trust boundary
- Server updates can change tool descriptions after review
- Public bots amplify the impact of any injection
If your agent needs two or three in-house functions, native function calling is simpler and has fewer trust boundaries. MCP pays off when you have several agents or channels sharing tools, or want to reuse well-maintained servers. Self-hosters can see the pattern in the open-source gateway covered in our OpenClaw messaging setup guide.
Bottom line
MCP is a clean way to give a texting agent real capabilities. Treat each tool as a public API: small, scoped to the sender, read-only by default and confirmed in code before it changes anything. Keep sending messages out of the model's hands entirely.



