logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

twilio-sms-gateway-mcp-service

Facilitates outbound SMS transmissions via the Twilio platform and manages delivery receipt webhooks for robust message lifecycle tracking. Seamlessly integrates within Model Context Protocol (MCP) frameworks, such as those powering Claude AI applications.

Author

twilio-sms-gateway-mcp-service logo

deshartman

MIT License

Quick Info

GitHub GitHub Stars 4
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

twiliosmsmessagingtwilio messagingtwilio apiusing twilio

Twilio SMS Gateway MCP Service

An MCP backend designed to interface with the Twilio Messaging API for transactional SMS operations. This service exposes necessary utilities, configuration instructions, and procedural guidance for leveraging Twilio's communication capabilities.

Core Capabilities

  • Execute SMS transmissions through the Twilio infrastructure.
  • Ingest and process delivery status notifications (webhooks) from Twilio, utilizing @deshartman/mcp-status-callback for advanced handling.
  • Designed for interoperability with large language models (LLMs) conforming to the Model Context Protocol (MCP).
  • Deployable immediately using npx without requiring persistent local installation.

Prerequisites Checklist

  • Node.js runtime environment (version 18.0.0 or newer).
  • A provisioned Twilio account, possessing the following credentials:
  • Account SID identifier
  • API Authentication Key and associated Secret
  • An active, provisioned Twilio telephone number
  • An active ngrok account, requiring:
  • An authentication token
  • An optional, user-specified ngrok public domain endpoint

Deployment Instructions

Install via npm registry:

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

Alternatively, execute directly using npx:

bash npx @deshartman/twilio-messaging-mcp-server

Direct Execution with NPX

The package is runnable without prior installation due to its package.json configuration:

bash

Invoke with mandatory configuration parameters

npx @deshartman/twilio-messaging-mcp-server

Utilizing environment variables for ngrok tunneling setup

env NGROK_AUTH_TOKEN=your_token NGROK_CUSTOM_DOMAIN=your_domain.ngrok.dev npx @deshartman/twilio-messaging-mcp-server

Configuration Variables

  • NGROK_AUTH_TOKEN: The authentication key necessary for establishing the secure ngrok tunnel (mandatory for webhook reception).
  • NGROK_CUSTOM_DOMAIN: A specific ngrok subdomain to utilize (optional).

Operational Guide

Server Initialization

Initialization can be managed via an accompanying execution script utilizing a .env configuration file:

bash

Establish a .env file referencing credentials (consult .env.example for structure)

Start the gateway service (arguments are read from .env)

./run-server.sh

The .env file must contain:

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

This environment file approach enhances credential management security and streamlines runtime invocation.

Direct Node Invocation

Execute the compiled JavaScript entry point:

bash env NGROK_AUTH_TOKEN=your_ngrok_auth_token NGROK_CUSTOM_DOMAIN=your_domain.ngrok.dev node build/index.js

MCP Interface Definition

This service exposes the following structured capabilities for MCP consumers:

Available Tools

  • send-sms: Executes SMS transmission via Twilio after verifying server operational status.

Accessible Resources

  • twilio://statuscallback: Retrieves the most recently received raw webhook payload from Twilio, including robust error introspection.

Defined Prompts

  • SendSMS: A structured prompt definition for initiating an SMS message using the Twilio Messaging MCP Service.

Troubleshooting Guidance

ngrok Tunnel Instantiation Failures

If errors resembling the following occur:

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

Remediation steps include:

  1. Terminate the currently active tunnel process.
  2. Configure and use an alternative domain name.
  3. Initiate both endpoints with the --pooling-enabled flag to facilitate load balancing.

NPM Directory Error (ENOTEMPTY)

Should an npm error manifest as:

npm ERR! code ENOTEMPTY npm ERR! syscall rename

It is recommended to bypass the npx wrapper and execute the application directly using the Node runtime interpreter.

Licensing

This project is distributed under the MIT License.

XMLHttpRequest (XHR): XHR constitutes an API implemented as a JavaScript object that facilitates the dispatching of HTTP requests from a web browser to a remote server. Its methods enable web-based applications to submit asynchronous requests post-page load and retrieve resultant data. XHR is fundamental to the implementation of Ajax programming paradigms. Before Ajax, standard URL navigation via hyperlinks and form submissions were the dominant methods for server interaction, usually involving a full page refresh. The concept for XHR originated in 2000 via Microsoft Outlook developers and was first integrated into Internet Explorer 5 (1999), though initial syntax utilized ActiveXObject("Msxml2.XMLHTTP") instead of the standardized XMLHttpRequest identifier. By Internet Explorer 7 (2006), universal browser support for the standard identifier was achieved. It is now the recognized standard across major browser engines, including Mozilla's Gecko (2002), Safari 1.2 (2004), and Opera 8.0 (2005).

== Chronology == The foundational concept for asynchronous web communication via XHR was introduced in 2000 by Microsoft personnel working on Outlook. This concept was realized in Internet Explorer 5 (1999), though initial implementations relied on ActiveX controls rather than the future standard identifier. Widespread adoption of the XMLHttpRequest name followed.

=== Specification Evolution === The World Wide Web Consortium (W3C) formalized the object specification as a Working Draft on April 5, 2006. A Level 2 Working Draft followed on February 25, 2008, introducing advancements like event progress monitoring, facilitation of cross-origin requests, and byte stream management. The Level 2 features were later merged back into the primary specification by late 2011. Development transitioned to WHATWG at the conclusion of 2012, which now maintains the specification as a dynamic document defined using Web IDL.

== Operational Flow == Executing a network request via XMLHttpRequest typically involves a sequence of programming steps:

  1. Instantiation: Create an instance of the XMLHttpRequest object using its constructor.
  2. Configuration: Invoke the "open" method to define the request methodology (GET, POST, etc.), specify the target resource URI, and set the operation mode (synchronous or asynchronous).
  3. Event Binding (Async Only): For asynchronous operations, attach a handler function to monitor state transitions.
  4. Transmission: Commence the request lifecycle by calling the "send" method, optionally providing request body data.
  5. Response Handling: Monitor the event listener. Upon completion, the object's state transitions to 4 ("done"), and the server's response payload is accessible, typically within the "responseText" property.

Beyond these essentials, XHR offers extensive control, permitting the attachment of custom HTTP headers, gradual processing of incoming byte streams, premature request cancellation, and timeout specification. Responses can be immediately parsed from formats like JSON into native JavaScript structures.

See Also

`