
WhatsApp MCP Assistant (Client-Server)
WhatsApp MCP Assistant (Client-Server)
What is WhatsApp MCP Assistant?
WhatsApp MCP Assistant is a client-server application that allows users to send and schedule WhatsApp messages using natural language processing. The server interprets user intent with Mistral's LLM and utilizes Twilio's API for messaging.
How to use WhatsApp MCP Assistant?
To use the assistant, install the required dependencies, configure your API keys in config.py
, run the server and client scripts, and then interact with the client by typing commands like "Send a message to Nir".
Key features of WhatsApp MCP Assistant?
- Natural language processing for message scheduling and sending.
- Client-server architecture for efficient message handling.
- Integration with Twilio for WhatsApp messaging.
Use cases of WhatsApp MCP Assistant?
- Sending automated reminders via WhatsApp.
- Scheduling messages for future delivery.
- Interacting with users through natural language commands.
FAQ from WhatsApp MCP Assistant?
- Can I send messages outside the 24-hour window?
No, freeform messages can only be sent within a 24-hour window after the last user message. Use pre-approved Message Templates for messages sent after this period.
- Is there a way to test the application locally?
Yes, ensure you have sent a message to the Twilio number from your WhatsApp to reset the 24-hour window for testing.
WhatsApp MCP Assistant (Client-Server)
This project builds a client-server pipeline to send and schedule WhatsApp messages using natural language. The server interprets user intent with Mistral's LLM and uses Twilio to perform the actual WhatsApp messaging.
Files
mcp_server.py
: The main MCP server that uses Mistral for interpreting user input and calls Twilio to send messages.mcp_client.py
: Simple CLI client for interacting with the server using free-form natural language.config.py
: Stores API keys and constants including phone number config.
Server-Client Idea
The server parses your intent using Mistral's LLM and converts it into actionable instructions (like sending a message). The client is a CLI interface where you type prompts like "Send a message to Nir", and the backend handles the rest.
Twilio:
Twilio provides a programmable WhatsApp messaging API. It's used here to send messages or simulate scheduling via WhatsApp.
⚠️ WhatsApp 24-Hour Window Limitation (Twilio)
If you're using Twilio's WhatsApp API, note that freeform messages (i.e., regular text messages) are only allowed within a 24-hour window after the user last messaged your WhatsApp number.
If you attempt to send a message outside of that window, you'll see this error in your Twilio dashboard: "Failed to send freeform message because you are outside the allowed window. If you are using WhatsApp, please use a Message Template"
✅ To fix this:
- You must use a pre-approved Message Template for messages sent after the 24-hour window.
- You can create templates in your Twilio Console > Messaging > Templates.
💡 For local testing:
If you’re just testing this with your own number and it’s failing, make sure you’ve sent a message to the Twilio number from your own WhatsApp recently — that resets the 24-hour window.
MCP Idea:
The MCP Server wraps a function-calling capable LLM (Mistral) to dynamically route user intent to appropriate tools (send/schedule WhatsApp messages). The client allows CLI-based prompt entry.
How to Run
-
Install dependencies:
pip install twilio requests fastapi
-
Update
config.py
with real values. -
Run the server:
python mcp_server.py
-
In another terminal, run the client:
python mcp_client.py