Labsco
mustafa-boorenie logo

Twilio SMS Server

from mustafa-boorenie

Send SMS messages using the Twilio API. Functions as an MCP server or a standalone REST API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedPaid serviceNeeds API keys

Twilio SMS Server

A versatile SMS service that can run as both a Model Context Protocol (MCP) server for Claude Desktop and as a standalone REST API for cloud deployment.

โœจ Features

  • ๐Ÿ“ฑ Send SMS messages via Twilio
  • ๐ŸŒ REST API endpoints for web integration
  • ๐Ÿ”จ MCP server for Claude Desktop integration
  • ๐Ÿ“ Pre-built prompts for common messaging scenarios
  • ๐Ÿ”’ Secure handling of Twilio credentials
  • ๐Ÿณ Docker support for easy deployment
  • โ˜๏ธ Cloud deployment ready

๐ŸŒ Web API Endpoints

When running in Web API mode, the following endpoints are available:

GET /

API documentation and usage examples

GET /health

Health check endpoint

POST /send-sms

Send an SMS message

Request Body:

{
  "to": "+11234567890",
  "message": "Your message here"
}

Response:

{
  "success": true,
  "message": "Message sent successfully",
  "messageSid": "SM...",
  "to": "+11234567890",
  "from": "+1234567890"
}

POST /send-greeting

Send a greeting message for special occasions

Request Body:

{
  "to": "+11234567890",
  "occasion": "birthday",
  "customMessage": "Optional custom message"
}

๐Ÿงช Testing the API

Local Testing

# Start the server
npm run start:web

# Test health endpoint
curl http://localhost:3000/health

# Send a test SMS
curl -X POST http://localhost:3000/send-sms \
  -H "Content-Type: application/json" \
  -d '{"to": "+1234567890", "message": "Hello from the API!"}'

# Send a greeting
curl -X POST http://localhost:3000/send-greeting \
  -H "Content-Type: application/json" \
  -d '{"to": "+1234567890", "occasion": "birthday"}'

๐Ÿ’ฌ Example Interactions with Claude (MCP Mode)

Here are some natural ways to interact with the server through Claude:

  1. Simple SMS:
Send a text message to +11234567890 saying "Don't forget about dinner tonight!"
  1. Creative SMS:
Write a haiku about autumn and send it to my number +11234567890
  1. Greeting Messages:
Send a birthday greeting to +11234567890

๐Ÿ“ Scripts Reference

  • npm run build - Build TypeScript to JavaScript
  • npm run start:mcp - Start MCP server mode
  • npm run start:web - Start web API server mode
  • npm run dev:web - Development mode (rebuild + start web server)
  • npm run watch - Watch TypeScript files for changes

โš ๏ธ Important Notes

  1. Phone Number Format: All phone numbers must be in E.164 format (e.g., +11234567890)
  2. Twilio Trial Accounts: Can only send messages to verified phone numbers
  3. Rate Limits: Be aware of your Twilio account's rate limits and pricing
  4. Security: Keep your Twilio credentials secure and never commit them to version control
  5. Environment Variables: Use .env file for local development, set via platform for cloud deployment

๐Ÿค Contributing

Contributions are welcome! Please read our contributing guidelines before submitting pull requests.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ” Security

Please do not include any sensitive information (like phone numbers or Twilio credentials) in GitHub issues or pull requests.