Twilio Messaging MCP server

Enables sending SMS messages through the Twilio API with a simple tool that handles authentication and message delivery using provided Twilio credentials and sender phone number.
Back to servers
Setup instructions
Provider
Des Hartman
Release date
Mar 18, 2025
Language
TypeScript
Stats
4 stars

This Twilio Messaging MCP Server allows you to send SMS messages via the Twilio API while providing integration with Claude AI through the Model Context Protocol (MCP). The server offers built-in status callback handling and can be run with minimal setup.

Prerequisites

  • Node.js >= 18.0.0
  • Twilio account with:
    • Account SID
    • API Key and Secret
    • Twilio phone number
  • ngrok account with:
    • Auth token
    • Custom domain (optional)

Installation

You can install the package globally or use it directly with npx:

npm install @deshartman/twilio-messaging-mcp-server

Running the Server

Using NPX (No Installation Required)

The simplest way to run the server is using npx with your Twilio credentials:

npx @deshartman/twilio-messaging-mcp-server <accountSid> <apiKey> <apiSecret> <number>

With Environment Variables for ngrok

To handle callbacks properly, you'll need to provide ngrok credentials:

env NGROK_AUTH_TOKEN=your_token NGROK_CUSTOM_DOMAIN=your_domain.ngrok.dev npx @deshartman/twilio-messaging-mcp-server <accountSid> <apiKey> <apiSecret> <number>

Using a .env File

For better security, you can use a .env file with your credentials:

  1. Create a .env file with the following content:
ACCOUNT_SID=YOUR_ACCOUNT_SID
API_KEY=YOUR_API_KEY
API_SECRET=YOUR_API_SECRET
TWILIO_NUMBER=YOUR_TWILIO_PHONE_NUMBER
NGROK_AUTH_TOKEN=YOUR_NGROK_AUTH_TOKEN
NGROK_CUSTOM_DOMAIN=your-domain.ngrok.dev
  1. Run the server using the provided script:
./run-server.sh

Directly with Node.js

You can also run the server directly with Node.js:

env NGROK_AUTH_TOKEN=your_ngrok_auth_token NGROK_CUSTOM_DOMAIN=your_domain.ngrok.dev node build/index.js <accountSid> <apiKey> <apiSecret> <number>

MCP Capabilities

The server provides several MCP capabilities for integration with Claude AI:

Tools

  • send-sms: Send an SMS message via Twilio with automatic server readiness validation

Resources

  • twilio://statuscallback: Retrieve the last raw status callback data from Twilio with enhanced error handling

Prompts

  • SendSMS: A prompt template for sending SMS messages using the Twilio Messaging MCP Server

Troubleshooting

ngrok Tunnel Issues

If you see an error like:

failed to start tunnel: The endpoint 'https://your-domain.ngrok.dev' is already online.

You can:

  1. Stop your existing endpoint first
  2. Use a different domain name
  3. Start both endpoints with --pooling-enabled to load balance between them

ENOTEMPTY Error

For npm errors like:

npm ERR! code ENOTEMPTY
npm ERR! syscall rename

Try running the server directly with Node.js instead of using npx.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "twilio-messaging-mcp-server" '{"command":"npx","args":["@deshartman/twilio-messaging-mcp-server"],"env":{"NGROK_AUTH_TOKEN":"","NGROK_CUSTOM_DOMAIN":""}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "twilio-messaging-mcp-server": {
            "command": "npx",
            "args": [
                "@deshartman/twilio-messaging-mcp-server"
            ],
            "env": {
                "NGROK_AUTH_TOKEN": "",
                "NGROK_CUSTOM_DOMAIN": ""
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "twilio-messaging-mcp-server": {
            "command": "npx",
            "args": [
                "@deshartman/twilio-messaging-mcp-server"
            ],
            "env": {
                "NGROK_AUTH_TOKEN": "",
                "NGROK_CUSTOM_DOMAIN": ""
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later