twilio-mcp-server
Allows sending SMS messages through Twilio and checking the delivery status of previously sent messages by message SID.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@twilio-mcp-serversend an SMS to +15551234567 saying 'Your order is ready'."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
twilio-mcp-server
An MCP (Model Context Protocol) server that exposes Twilio SMS sending as MCP tools, protected by OAuth 2.0 (client_credentials grant), and reachable remotely through a Cloudflare Tunnel (cloudflared).
MCP Client --Bearer token--> [cloudflared tunnel] --> Express app :3020 --> Twilio API
|-- POST /oauth/token (get access token)
|-- POST /mcp (MCP tools, needs Bearer token)
|-- GET /health1. Install
cd twilio-mcp-server
npm install
cp .env.example .envEdit .env:
PORT=3020
TRANSPORT=http
# OAuth 2.0 credentials for THIS server (make up your own strong values)
OAUTH_CLIENT_ID=demo-client-id
OAUTH_CLIENT_SECRET=demo-client-secret-change-me
OAUTH_JWT_SECRET=super-secret-signing-key-change-me
OAUTH_TOKEN_TTL_SECONDS=3600
# Twilio account credentials (from twilio.com/console)
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_FROM_NUMBER=+15017122661Related MCP server: twilio-mcp
2. Build & run
npm run build
npm startYou should see:
twilio-mcp-server v1.0.0
MCP endpoint: http://localhost:3020/mcp (requires Bearer token)
OAuth token: POST http://localhost:3020/oauth/token
Health check: GET http://localhost:3020/health3. How the OAuth 2.0 flow works
This server implements the client_credentials grant (machine-to-machine — no user login screen):
A client calls
POST /oauth/tokenwith itsclient_id+client_secret.The server verifies them and returns a signed, short-lived JWT
access_token.The client calls
POST /mcpwithAuthorization: Bearer <access_token>.The server verifies the token signature/expiry before handling any MCP request.
Get a token:
curl -X POST http://localhost:3020/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "demo-client-id",
"client_secret": "demo-client-secret-change-me"
}'Response:
{
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "sms:send"
}Call the MCP endpoint with it:
curl -X POST http://localhost:3020/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer <access_token>" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'Note: Twilio itself doesn't support OAuth for its SMS API — Twilio authenticates server-to-server using
TWILIO_ACCOUNT_SID+TWILIO_AUTH_TOKEN. The OAuth 2.0 layer here protects access to this MCP server; the server then uses your Twilio credentials internally to actually send the SMS.
4. Tools exposed
Tool | Description |
| Sends an SMS. Args: |
| Looks up delivery status of a previously sent message by |
5. Expose it publicly with cloudflared (Cloudflare Tunnel)
Install cloudflared (one-time):
# macOS
brew install cloudflare/cloudflare/cloudflared
# Debian/Ubuntu
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared.deb
# Windows
winget install --id Cloudflare.cloudflaredStart the MCP server (port 3020), then in a separate terminal run a quick tunnel (no Cloudflare account needed, great for testing):
cloudflared tunnel --url http://localhost:3020Cloudflared prints a public URL like:
https://random-words-here.trycloudflare.comYour MCP endpoint is now reachable at:
https://random-words-here.trycloudflare.com/mcpand the OAuth token endpoint at:
https://random-words-here.trycloudflare.com/oauth/tokenPersistent named tunnel (production)
For a stable subdomain instead of a random one each time:
cloudflared tunnel login
cloudflared tunnel create twilio-mcp-server
cloudflared tunnel route dns twilio-mcp-server mcp.yourdomain.comCreate ~/.cloudflared/config.yml:
tunnel: twilio-mcp-server
credentials-file: /root/.cloudflared/<tunnel-id>.json
ingress:
- hostname: mcp.yourdomain.com
service: http://localhost:3020
- service: http_status:404Run it:
cloudflared tunnel run twilio-mcp-serverNow https://mcp.yourdomain.com/mcp is your permanent MCP endpoint.
6. Connect an MCP client through the tunnel
A ready-made example client is in client-example/mcpClient.mjs:
cd client-example
npm install
MCP_SERVER_URL=https://random-words-here.trycloudflare.com/mcp \
OAUTH_TOKEN_URL=https://random-words-here.trycloudflare.com/oauth/token \
OAUTH_CLIENT_ID=demo-client-id \
OAUTH_CLIENT_SECRET=demo-client-secret-change-me \
TO_NUMBER=+919876543210 \
MESSAGE_BODY="Hello from the tunnel!" \
node mcpClient.mjsThis will:
Fetch an OAuth access token from the tunnel URL
Connect to the MCP server through the tunnel
List available tools
Call
twilio_send_smsto actually send a message
7. Testing with MCP Inspector
npx @modelcontextprotocol/inspectorPoint it at http://localhost:3020/mcp (or your tunnel URL), set the Authorization header to Bearer <token> obtained from /oauth/token, and call the tools interactively.
8. Notes on Twilio trial accounts
If you're using a Twilio trial account:
You can only send SMS to phone numbers you've verified in the Twilio console (Console → Phone Numbers → Verified Caller IDs).
Messages will be prefixed with "Sent from your Twilio trial account".
Upgrade the account to send to any number.
This server cannot be deployed
Maintenance
Related MCP Connectors
Twilio MCP Pack — send SMS, list messages, make calls via Twilio REST API.
Phone, SMS & email for AI agents — one remote MCP endpoint, OAuth login, zero install.
The Mobile Text Alerts SMS MCP server enables your AI to send SMS messages & manage contacts
MCP connector for iMessage & Contacts via a local Mac agent + Vercel relay
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP (Model Context Protocol) server that lets users send SMS messages through Twilio API directly from Claude Desktop via natural language commands.15 npm5MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Twilio communications, enabling SMS/MMS sending, message listing, outbound calls, and phone number lookup.MIT
- AlicenseBqualityBmaintenanceMCP server for sending SMS via the SMSPM API. Send transactional SMS from Claude Desktop, Cursor, Windsurf, Cline, or any MCP client.120 npmMIT
- AlicenseNot gradedqualityBmaintenanceA least-privilege, send-only MCP server for WhatsApp, backed by Meta's official WhatsApp Cloud API. It exposes tools to send text messages and pre-approved templates.4 npmMIT