rajtilak-2020/whatsaap-mcp-server
3.2
If you are the rightful owner of whatsaap-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
WhatsApp-MCP is a streamable messaging server that leverages FastMCP and Twilio API to facilitate real-time WhatsApp messaging.
๐ฌ WhatsApp-MCP: Streamable Messaging Server
A powerful, event-stream-based WhatsApp messaging server built with FastMCP and Twilio API.
Send messages programmatically or from a browser using Server-Sent Events โ perfect for agents, automation, or dashboards.
๐ Features
- โ FastMCP 2.x support (streamable HTTP transport)
- โ Real-time messaging using Twilio WhatsApp Sandbox
- โ Dynamic phone & message input (via HTML or CLI)
- โ
Streaming response with
text/event-stream
- โ Works with AI agents, CLI, or browser UI
- โ Optional: deployable to Render, Railway, Replit
๐ Usage Guide
๐ง 1. Setup
git clone https://github.com/your-username/whatsapp-mcp.git
cd whatsapp-mcp
python -m venv venv
venv\Scripts\activate # or source venv/bin/activate
pip install -r requirements.txt
Create a .env
file:
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_WHATSAPP_FROM=whatsapp:+14155238886
๐ง 2. Start the Server
python server.py
Youโll see:
๐ Server URL: http://localhost:8000/mcp
๐ฆ Transport: Streamable-HTTP
๐ 3. Use the Browser UI
Open index.html
in your browser.
Enter:
- ๐ฑ Phone number (e.g.,
+91xxxxxxxxxx
) - ๐ฌ Message
Click Send WhatsApp Message โ and receive it instantly!
๐งช 4. Test with curl
curl -X POST http://localhost:8000/mcp ^
-H "Content-Type: application/json" ^
-H "Accept: text/event-stream" ^
-d "{\"tool\":\"send_whatsapp_message\", \"inputs\":{\"to\":\"+91xxxxxxxxxx\", \"body\":\"Hello from curl!\"}}"
โ Replace
+91xxxxxxxxxx
with your verified WhatsApp number
๐ System Flow (Mermaid Diagram)
graph TD
A[๐ง User] -->|Enters message & number| B[๐ HTML UI]
B -->|POST /mcp| C[๐ FastMCP Server]
C -->|calls| D[๐ฒ Twilio API]
D -->|sends| E[๐ฑ WhatsApp Message]
C -->|streams response| B
๐งฉ Tech Stack
- ๐ง FastMCP v2.x
- ๐งช Twilio WhatsApp API
- โ๏ธ Python 3.11+
- ๐ HTML + JS (Fetch API)
- ๐ Server-Sent Events (SSE)
๐ก๏ธ Security Notes
- Never commit
.env
secrets - Sandbox can only message verified users
- Upgrade to Twilio Business for full sending capabilities
๐ค Agent-Ready Example (Python)
from fastmcp import Client
from server import mcp
async with Client(mcp) as client:
await client.call_tool("send_whatsapp_message", {
"to": "+91xxxxxxxxxx",
"body": "Triggered from an agent ๐"
})
๐ Author
Made with โค๏ธ by K Rajtilak