MCP ExplorerExplorer

Mcpwhatsapp

@Nirsisron 10 months ago
2 MIT
FreeCommunity
AI Systems
WhatsApp MCP Assistant (Client-Server)

Overview

What is Mcpwhatsapp

MCPWhatsApp is a client-server application designed to send and schedule WhatsApp messages using natural language processing. It utilizes Mistral’s LLM for interpreting user intent and Twilio’s API for message delivery.

Use cases

Use cases for MCPWhatsApp include sending reminders to clients, automating responses to frequently asked questions, and scheduling messages for specific times to enhance communication efficiency.

How to use

To use MCPWhatsApp, run the server using mcp_server.py and the client using mcp_client.py. You can type commands in natural language, such as ‘Send a message to [contact]’, and the server will process the request and send the message via WhatsApp.

Key features

Key features of MCPWhatsApp include natural language processing for user input interpretation, integration with Twilio for WhatsApp messaging, and the ability to schedule messages. It also handles the 24-hour messaging window limitation imposed by WhatsApp.

Where to use

MCPWhatsApp can be used in various fields such as customer support, automated notifications, and personal reminders where WhatsApp messaging is beneficial.

Content

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:

💡 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

  1. Install dependencies:

    pip install twilio requests fastapi
    
  2. Update config.py with real values.

  3. Run the server:

    python mcp_server.py
    
  4. In another terminal, run the client:

    python mcp_client.py
    

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers