communitystdio

Twilio MCP Server

Send SMS, WhatsApp messages, and voice calls from Claude Code or Cursor with your Twilio Account SID and Auth Token.

Updated: April 15, 2026

Install

npx mcp-server-twilio
~/.claude/settings.json
{
  "mcpServers": {
    "twilio-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-twilio"
      ],
      "env": {
        "TWILIO_ACCOUNT_SID": "ACxxx",
        "TWILIO_AUTH_TOKEN": "your_auth_token"
      }
    }
  }
}

Capabilities

  • + Send SMS messages to any E.164 formatted phone number
  • + Send WhatsApp messages from your approved Twilio WhatsApp sender
  • + Place voice calls with text-to-speech or audio URL payload
  • + List message history with status, error code, and delivery timestamp
  • + Get call logs with duration, direction, and outcome
  • + Check account balance and usage for the current billing period
  • + Manage phone numbers including listing active numbers and release

Limitations

  • - Cannot receive inbound SMS or calls through MCP; inbound needs a webhook endpoint Twilio POSTs to
  • - No webhook configuration via the MCP tool set
  • - MMS (picture messages) are limited to US and Canada on several plan tiers
  • - Rate limits apply per account tier; trial accounts are capped hard

Twilio MCP server setup for Claude Code and Cursor

Quick answer: The Twilio MCP server wraps the Twilio API as MCP tools for Claude Code and Cursor. Drop in the env vars, run one npx command, and the editor can reach the service directly. Setup takes about 3 minutes, tested on mcp-server-twilio@0.3.8 on April 15, 2026.

Twilio is the default messaging and voice API for most product teams. A single Account SID plus Auth Token unlocks SMS, WhatsApp, voice, and a dozen other channels. Without an MCP connection, working with Twilio means flipping between the editor and the web UI - copying IDs, pasting results, losing context. The MCP server removes that loop. Claude can fetch the data itself, reason about it, and write changes back without you switching tabs.

This guide covers install, config for both editors, prompt patterns that actually work, and the places where the API will bite back.

What this server does

The server speaks MCP over stdio and wraps the standard Twilio SDK. The tool surface is grouped into these sets:

  • Messaging: send_sms, send_whatsapp, list_messages, get_message
  • Voice: make_call, list_calls, get_call
  • Account: get_balance, list_phone_numbers, release_phone_number

Authentication uses TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN. The server holds credentials in process memory for the life of the subprocess. Nothing is written to disk by the server itself. If you rotate the credential, restart the MCP server and the new value takes effect immediately.

The server does not implement a local cache. Every tool call is a fresh round trip. For most workflows this is fine - round trip times are 100-400 ms - but it adds up on heavy batch jobs. For those, prefer the native SDK in a script.

Installing the server

The package ships on npm as mcp-server-twilio. The npx -y prefix fetches on first launch and caches the binary for subsequent runs. Cold pull is typically 3-8 MB depending on the SDK footprint and lands in 2-4 seconds.

Before touching editor config, get your credentials ready:

  1. Sign in at console.twilio.com
  2. Copy the Account SID and Auth Token from the main dashboard
  3. For WhatsApp, complete the sender approval in the Messaging > Senders section
  4. For production voice, buy a phone number in the console with the right region and capability set

Keep the credential values out of any file you commit. The rest of this guide assumes they live in your shell profile or a .envrc managed by direnv.

Configuring for Claude Code

Claude Code reads MCP servers from ~/.claude/mcp.json or a per-project .mcp.json. Add a twilio entry:

{
  "mcpServers": {
    "twilio": {
      "command": "npx",
      "args": ["-y", "mcp-server-twilio"],
      "env": {
        "TWILIO_ACCOUNT_SID": "ACxxx",
        "TWILIO_AUTH_TOKEN": "your_auth_token"
      }
    }
  }
}

Restart Claude Code, then run /mcp in a session to confirm Twilio is attached. Call a read-only tool as a smoke test before any write operations. If the first call returns real data, the auth is working and you can widen the prompt scope.

For team projects, commit a placeholder version of .mcp.json with ${VAR_NAME} inside the env values and let each developer provide the real credential via their shell. Claude Code expands env vars when it spawns the subprocess.

Configuring for Cursor

Cursor uses the same MCP spec and reads from ~/.cursor/mcp.json. The config is identical to Claude Code:

{
  "mcpServers": {
    "twilio": {
      "command": "npx",
      "args": ["-y", "mcp-server-twilio"],
      "env": {
        "TWILIO_ACCOUNT_SID": "ACxxx",
        "TWILIO_AUTH_TOKEN": "your_auth_token"
      }
    }
  }
}

Open Cursor settings, navigate to the MCP tab, and toggle the server on. Cursor spawns the subprocess lazily on the first tool call. Expect 2-4 seconds of cold start and 150-500 ms per subsequent call depending on network latency to the upstream API.

If the Cursor UI shows the server as red, click the refresh icon and watch the error log. Most failures at this stage are a missing env var or a wrong file path in the credential config.

Example prompts and workflows

A few prompts that work reliably once the server is attached:

  • "Send an SMS from +15551234567 to +15559999999 with the text Your order has shipped."
  • "List every SMS we sent yesterday and summarize how many failed with error code 30007."
  • "Place a voice call to +15559999999 and play the text This is a test call via text-to-speech."
  • "Show the message history for the last hour and flag anything with status undelivered."
  • "Send a WhatsApp template message order_shipped with variables {order_id} and {tracking_url}."

The model will chain calls. A debug flow usually runs list_messages with a date filter, then get_message on the failed ones to pull the error code, then recommends the fix. Tell Claude to stop after N messages - unbounded list calls on a busy account return thousands of rows.

One pattern that saves calls: narrow the scope up front. Instead of asking Claude to list every record and then filter, include the filter in the first prompt. The tool returns less data, the response is faster, and the model has less noise to reason through.

Troubleshooting

Tool call returns 20003. Auth token is wrong or the account is suspended. Confirm in the Twilio console and reset the auth token if needed.

SMS fails with error 30007. Carrier filtered the message as spam. Register the phone number with 10DLC in the US, shorten the text, and remove any link shorteners. Carrier filtering is increasingly strict on cold outbound.

WhatsApp template send fails. Template is not approved or the variable count does not match. Confirm template status in Messaging > Senders > WhatsApp Templates, and make sure every {{1}} placeholder has a value in the call.

Trial account hits a limit. Trial accounts can only send to verified numbers. Either verify the recipient or upgrade to a paid account. Trial SMS also prepends the Sent from your Twilio trial account banner.

Rate limit errors (429). Twilio enforces per-account queues. Paid accounts default to 100 messages per second but need pre-approval for higher volume. Spread sends with a short await between calls or use the native Messaging Services queue.

Server fails with ENOENT. npx is not on PATH in the env the editor inherits. On macOS, launch Claude Code or Cursor from a terminal so it inherits your shell env, or put the absolute path to npx in the command field.

Subprocess keeps restarting. The MCP transport is strict about newlines on stdio. If the server logs to stdout, those lines get treated as MCP messages and crash the client. Make sure any logging goes to stderr only (most well-built servers already do this).

Alternatives

A few options if the Twilio server does not fit your setup:

  • vonage-mcp covers Vonage (formerly Nexmo) with a matching SMS and voice surface.
  • messagebird-mcp targets MessageBird, which has better EU coverage and GDPR tooling.
  • plivo-mcp works with Plivo for teams that need cheaper outbound on specific routes.

The MCP server pays off when Claude triggers notifications during an ops workflow or debugs delivery issues without a context switch to the Twilio console.

Performance notes and hardening

Steady-state call latency lands in the 150-500 ms range for most tools. For latency-sensitive workflows, place the editor close to the upstream API region - a Claude Code session in us-east-1 calling an EU-only endpoint will see 120+ ms of extra RTT on every tool call.

For production credentials, prefer scoped tokens over root credentials. Most services expose fine-grained permission models; use them. A token that can only read is strictly safer than one that can write, and costs nothing to rotate.

Log review is easier if you redirect MCP subprocess stderr to a file. Most editors do this by default, but not all surface the log path. On macOS, check ~/Library/Logs/Claude/ or the Cursor equivalent.

The Twilio MCP server is the right default for any workflow that already touches Twilio regularly. A few minutes of setup replaces hours of copy-paste between the editor and the service's web UI. Start with a read-only credential scoped to a single resource, then widen scopes after you trust the prompt patterns your team develops.

Guides

Frequently asked questions

Can I receive inbound messages with this server?

Not through MCP directly. Inbound requires a webhook endpoint Twilio POSTs to. Set up the webhook in the Twilio console pointing at your own HTTP server, then have that server write messages to a DB Claude can read.

Does it support Twilio Segment or Flex?

No. The tool set covers Messaging, Voice, and account management only. Segment has a separate API under the same account, and Flex has its own automation layer (Studio) that lives outside this server.

How do I handle opt-outs and STOP keywords?

Twilio auto-handles STOP, UNSUBSCRIBE, and HELP on the network side. The message never reaches your account. The MCP server does not need special handling, but you should log opt-outs in your own DB to avoid re-sending.

Is there a sandbox for testing?

Trial accounts work as a sandbox but can only send to verified numbers. For richer testing, use Twilio Test Credentials (a separate SID/token pair) to simulate sends without charging your account or actually transmitting messages.

How are phone numbers billed?

Each active number costs $1 per month on most regions. SMS is charged per segment ($0.0079 in US at time of writing). WhatsApp messages use a conversation-based pricing model. The `get_balance` tool shows real-time usage.

Can the server place international calls?

Yes, but some destination countries are disabled by default to prevent fraud. Enable the target country in Voice > Geo Permissions before the first call, otherwise the call fails with error 13227.