Provides access to Twilio's API services including sending/receiving calls and messages, managing phone numbers, accessing recordings and transcriptions, configuring messaging services, A2P brand registrations, BYOC trunks, dialing permissions, and Studio flow management across API v2010, Messaging v1, Voice v1, and Studio v2.
Twilio MCP Server (Docker Edition with Auth Token Support)
š Features
Dual Authentication Support: Works with both Twilio API Keys and Auth Tokens
Docker Deployment: Pre-configured Docker setup with mcp-proxy for SSE transport
Multiple Twilio Services: Supports Twilio API v2010, Messaging v1, Voice v1, and Studio v2
Property Name Sanitization: Includes automatic patching to ensure Claude API compatibility
Unraid Compatible: Ready for deployment on Unraid or any Docker environment
Easy Configuration: Simple
.envfile configurationAuto-restart: Container automatically restarts if it crashes
š What's Different in This Fork
The official @twilio-alpha/mcp package requires API Key authentication (credentials starting with SK). However, many Twilio accounts may not have API Keys configured. This fork modifies the authentication layer to accept Auth Token authentication as an alternative:
API Key Format:
AccountSid/ApiKey:ApiSecret(original)Auth Token Format:
AccountSid/AuthToken(new)
When using Auth Token format, the server uses the AccountSid as the username and the Auth Token as the password for HTTP Basic authentication with the Twilio API.
Modified Files
packages/mcp/src/utils/args.ts: Updated to parse and validate both authentication formats
š¦ Prerequisites
Docker and Docker Compose
Twilio account credentials:
Account SID (starts with
AC)Auth Token OR API Key/Secret pair
š Quick Start
1. Clone and Configure
2. Create .env File
Create a .env file with your Twilio credentials:
3. Build and Run
The server will be available at http://localhost:3010 via SSE transport.
4. View Logs
You should see: starting server on port 3010
āļø Configuration
Authentication Modes
The start-twilio-mcp.sh script determines which authentication mode to use:
Auth Token Mode (default):
API Key Mode:
Available Services
You can customize which Twilio services to load by modifying the --services parameter in start-twilio-mcp.sh:
twilio_api_v2010: Core Twilio REST API (accounts, calls, messages, recordings, etc.)twilio_messaging_v1: Messaging services (messaging services, A2P, brand registrations, etc.)twilio_voice_v1: Voice services (BYOC trunks, connection policies, dialing permissions, etc.)twilio_studio_v2: Studio flows and executions
š Connecting to Claude Code
Add this server to your Claude Code MCP configuration:
Or if running on a remote server:
š³ Docker Compose Configuration
The docker-compose.yml includes:
Port mapping:
3010:3010for SSE transportEnvironment variables: Loaded from
.envfileExternal network:
mcp_network(create if needed)Auto-restart policy:
unless-stoppedCommand: Uses mcp-proxy to wrap the stdio server
Creating the Network
š¾ Deployment on Unraid
SSH into your Unraid server
Create directory:
mkdir -p /mnt/user/appdata/twilio-mcpPlace all files in
/mnt/user/appdata/twilio-mcp/Create
.envfile with your credentialsEnsure
mcp_networkexists:docker network create mcp_networkNavigate to directory:
cd /mnt/user/appdata/twilio-mcpRun:
docker compose up -d
š§ Technical Details
Property Name Sanitization
The patch-load-tools.sh script automatically patches the OpenAPI MCP server during Docker build to sanitize property names for Claude API compatibility:
Removes invalid characters (replaces with
_)Ensures names don't start with numbers
Limits length to 64 characters
Runs automatically during
docker build
This ensures all Twilio API parameters work correctly with Claude's MCP implementation.
Authentication Flow
The
start-twilio-mcp.shscript receives credentials as environment variablesIt passes them to
@twilio-alpha/mcpin the appropriate formatThe modified
args.tsparser detects the format:If contains
:, treats as API Key format (apiKey:apiSecret)If no
:, treats as Auth Token format (just the token)
For Auth Token mode:
apiKeyis set toAccountSidapiSecretis set to the Auth TokenValidation accepts
ACprefix (AccountSid) in addition toSKprefix (API Key)
Credentials are passed to the Twilio client for HTTP Basic authentication
mcp-proxy Wrapper
This deployment uses mcp-proxy to convert the stdio-based MCP server to SSE transport:
Stdio Transport: The original
@twilio-alpha/mcpcommunicates via stdin/stdoutSSE Transport: mcp-proxy wraps it and exposes at
http://localhost:3010/sseBenefits: Allows remote access and integration with web-based tools
File Structure
š Troubleshooting
Container Crashes Immediately
Check logs: docker compose logs twilio-mcp
Common issues:
Missing environment variables: Ensure
.envfile exists and contains all required variablesIncorrect credentials: Verify Account SID and Auth Token are correct
Network doesn't exist: Create with
docker network create mcp_networkPort conflict: Port 3010 is already in use
Authentication Errors (401)
Verify your Account SID starts with
ACVerify your Auth Token is correct (not the API Key)
Test credentials with curl:
If this returns account data, your credentials are correct.
Connection Issues from Claude Code
Ensure container is running:
docker ps | grep twilio-mcpVerify port 3010 is accessible:
curl http://localhost:3010/sseCheck network connectivity
Verify the URL in Claude Code config matches your setup
Try restarting Claude Code after configuration changes
Environment Variables Not Loading
Ensure
.envfile is in the same directory asdocker-compose.ymlCheck environment variables in container:
docker exec twilio-mcp-server env | grep TWILIORestart container after
.envchanges:docker compose down && docker compose up -d
Build Cache Issues
If changes to source files aren't being picked up:
š Available Twilio Operations
Once connected, you'll have access to hundreds of Twilio API operations across all configured services:
API v2010
Manage accounts, subaccounts, and credentials
Send/receive calls and messages
Manage phone numbers and addresses
Access call recordings and transcriptions
Configure applications and queues
Messaging v1
Create and manage messaging services
Configure alpha senders and channel senders
Register A2P brands and campaigns
Manage toll-free verifications
Handle phone number configuration
Voice v1
Configure BYOC trunks
Manage connection policies and targets
Set dialing permissions by country
Configure IP records and source IP mappings
Studio v2
Create and manage Studio flows
Trigger flow executions
Retrieve execution history and steps
Manage flow revisions
š Security Recommendations
From the Twilio ETI team:
To guard against injection attacks that may allow untrusted systems access to your Twilio data, we advise users to avoid installing or running any community MCP servers alongside official ones. Doing so helps ensure that only trusted MCP servers have access to tools interacting with your Twilio account.
Additional recommendations:
Store
.envfile securely and never commit it to version controlUse API Keys with restricted permissions when possible
Regularly rotate your Auth Tokens and API Keys
Monitor your Twilio usage for unusual activity
Run the container on a private network when possible
š License
This is a fork of @twilio-alpha/mcp which is licensed under the ISC License. Please refer to the original project for detailed licensing information.
š Credits
Original
@twilio-alpha/mcppackage by Twilio LabsModified for Auth Token support and Docker deployment by the community
mcp-proxyfor SSE transport support
š¤ Contributing
Contributions are welcome! If you encounter issues or have improvements:
Check existing issues
Create a detailed bug report or feature request
Submit pull requests with clear descriptions
Include tests for new functionality
š Support
Twilio API Issues: Consult the Twilio documentation
MCP Protocol Issues: Refer to the Model Context Protocol documentation
Docker Issues: Check the Docker documentation
This Fork: Open an issue in this repository
š Related Links
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables interaction with Twilio API services including messaging, voice, and Studio flows through Docker deployment. Supports both API Key and Auth Token authentication for managing calls, messages, phone numbers, and automation workflows.
- š Features
- š What's Different in This Fork
- š¦ Prerequisites
- š Quick Start
- āļø Configuration
- š Connecting to Claude Code
- š³ Docker Compose Configuration
- š¾ Deployment on Unraid
- š§ Technical Details
- š Troubleshooting
- š Available Twilio Operations
- š Security Recommendations
- š License
- š Credits
- š¤ Contributing
- š Support
- š Related Links