mcp-twilio — Claude Code MCP server: SMS, WhatsApp, calls
Wires Twilio into your agent: SMS and WhatsApp sending, outbound calls, Verify codes for 2FA, and phone validation through Lookups.
claude mcp add --env TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> --env TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> --env TWILIO_MESSAGING_SERVICE_SID=<TWILIO_MESSAGING_SERVICE_SID> --transport stdio twilio -- npx -y @codespar/mcp-twilioWhat mcp-twilio does
Twenty-two Twilio tools land in the agent's toolkit. send_message fires off an SMS or a WhatsApp note, make_call dials a number, start_verification and check_verification run a 2FA challenge, and lookup_phone checks a number against Lookups v2 and normalizes it. A second batch covers Conversations, Messaging Services, Studio Flows and TaskRouter, from opening a chat thread to creating a queue task for a worker.
Set TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN before anything else. There is no working server without them. The Basic auth header gets built internally from that pair, so you never write it yourself. For WhatsApp, put whatsapp: in front of both numbers, e.g. whatsapp:+5511999999999, and the sender has to be WhatsApp-enabled. TWILIO_MESSAGING_SERVICE_SID picks the default sender for send_message; Verify calls need a Service SID each time.
Stdio is the default transport and covers Cursor and Claude Desktop. An HTTP mode exists for server-to-server testing: MCP_HTTP=true MCP_PORT=3000 npx @codespar/mcp-twilio. Real messages and number purchases bill your Twilio account, so lock down buy_phone_number and delete_message if the agent runs unattended.
What it helps with
- send an SMS or WhatsApp message from inside an agent task
- verify a customer's phone with a Verify code
- check and normalize a phone number before storing it
- place a call and pull the recording list
- provision a number and add a participant to a Conversation
Example prompts for the agent
- Send an SMS to +5511999999999 saying the order is ready, use
send_message - Run
lookup_phoneon +14155552671 and tell me whether it's a mobile line - Check the Verify code against this Service SID with
check_verification
How to install mcp-twilio
Platform CLI
claude mcp add --env TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> --env TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> --env TWILIO_MESSAGING_SERVICE_SID=<TWILIO_MESSAGING_SERVICE_SID> --transport stdio twilio -- npx -y @codespar/mcp-twilioReplace <…> with your own values
Platform CLI
codex mcp add twilio --env TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> --env TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> --env TWILIO_MESSAGING_SERVICE_SID=<TWILIO_MESSAGING_SERVICE_SID> -- npx -y @codespar/mcp-twilioReplace <…> with your own values
Config file
{
"mcpServers": {
"twilio": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-twilio"
],
"env": {
"TWILIO_ACCOUNT_SID": "<TWILIO_ACCOUNT_SID>",
"TWILIO_AUTH_TOKEN": "<TWILIO_AUTH_TOKEN>",
"TWILIO_MESSAGING_SERVICE_SID": "<TWILIO_MESSAGING_SERVICE_SID>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"twilio": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@codespar/mcp-twilio"
],
"env": {
"TWILIO_ACCOUNT_SID": "<TWILIO_ACCOUNT_SID>",
"TWILIO_AUTH_TOKEN": "<TWILIO_AUTH_TOKEN>",
"TWILIO_MESSAGING_SERVICE_SID": "<TWILIO_MESSAGING_SERVICE_SID>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> -e TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> -e TWILIO_MESSAGING_SERVICE_SID=<TWILIO_MESSAGING_SERVICE_SID> twilio npx -y @codespar/mcp-twilioReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-twilio
How do I install mcp-twilio in Claude Code?
Run claude mcp add mcp-twilio -e TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> -e TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> -- npx -y @codespar/mcp-twilio. The stdio form also works: `claude mcp add --env TWILIO_ACCOUNT_SID=<TWILIO_ACCOUNT_SID> --env TWILIO_AUTH_TOKEN=<TWILIO_AUTH_TOKEN> --env TWILIO_MESSAGING_SERVICE_SID=<TWILIO_MESSAGING_SERVICE_SID> --transport stdio twilio -- npx -y @codespar/mcp-twilio`.
What does mcp-twilio do?
It exposes Twilio actions to the agent: SMS and WhatsApp, voice calls, Verify for 2FA, Lookups for phone validation, and management of Conversations, Messaging Services, Studio Flows and TaskRouter.
Does WhatsApp go through the same tool as SMS?
Yes, send_message handles both. Prefix the recipient and sender with whatsapp:, for instance whatsapp:+5511999999999.