An intelligent WhatsApp Agent built with Google ADK and the Model Context Protocol (MCP).
Send messages, search chats, and interact with WhatsApp directly from your AI agent environment.
- 📩 Send WhatsApp messages (with AI-crafted text + disclaimers).
- 🔍 Search chats & messages using MCP tools.
- 🧩 Schema sanitization for Gemini compatibility.
- ⚡ Powered by Google ADK, MCP Toolsets, and WhatsApp bridge.
- ☁️ Deployment-ready with environment configs.
+-------------------+ +-----------------+ +---------------------+
| User / Agent | <----> | MCP Toolset | <----> | WhatsApp MCP Server |
+-------------------+ +-----------------+ +---------------------+
(Python) (Go + SQLite)
- Go Bridge → connects to WhatsApp multi-device API.
- Python MCP Server → exposes standardized tools (send, search, list).
- Google ADK Agent → orchestrates message crafting + disclaimer + sending.
- WhatsApp MCP Server (repo) → lharries/whatsapp-mcp
- Go
- Python 3.9+
- UV (Python package manager)
- WhatsApp mobile app (for QR authentication)
-
Clone this repository
git clone https://github.com/B4K2/WhatsApp-agent.git cd WhatsApp-agent -
Install dependencies
uv sync
-
Set environment variables (in
.env)UV_EXECUTABLE_PATH=/usr/local/bin/uv PYTHON_MCP_SERVER_DIRECTORY=./multi_tool_agent
-
Run the WhatsApp MCP bridge
cd whatsapp-bridge go run main.go📲 Scan the QR code with WhatsApp mobile to authenticate.
-
Run the Python MCP server
uv run main.py
Here’s how the agent works:
from google.adk.agents import Agent
agent = Agent(
name="WhatsApp_Orchestrator",
model="gemini-2.0-flash",
)
# Example: Send a message
agent("Send 'On my way!' to +91XXXXXXXXXX")✅ Agent crafts the message
✅ Appends disclaimer
✅ Sends via send_message tool
As with many MCP servers, be cautious of prompt injection attacks. Messages and metadata are stored locally in SQLite.
Pull requests are welcome! If you’d like to extend the toolset (media sending, chat search), fork and submit a PR.