loading…
Search for a command to run...
loading…
An MCP server that wraps the wacli tool to enable AI clients to read, search, and send WhatsApp messages through a personal account. It provides comprehensive t
An MCP server that wraps the wacli tool to enable AI clients to read, search, and send WhatsApp messages through a personal account. It provides comprehensive tools for managing chats, groups, and contacts using an existing authenticated WhatsApp session.
MCP (Model Context Protocol) server that wraps wacli — a WhatsApp CLI built on whatsmeow. Lets any MCP-compatible AI client (Claude Code, Claude Desktop, Cursor, Cline, etc.) read, search, and send WhatsApp messages through your personal account.
Instead of reimplementing the WhatsApp Web protocol, mcp-wacli delegates everything to wacli's --json mode. This means:
Two transport modes are supported:
┌─────────────────────────────────┐
│ AI Client │
│ Claude / Cursor / GPT / Gemini │
└──────┬────────────┬──────────────┘
│ │
SSH+stdio │ │ HTTP/SSE
▼ ▼
┌──────────────────────────┐
│ server.py (FastMCP) │
│ 27 tools │
│ Bearer token auth (HTTP) │
└──────────┬───────────────┘
│ subprocess
▼
┌──────────────────────┐
│ wacli --json │
│ (Go / whatsmeow) │
└──────────┬───────────┘
│
▼
WhatsApp servers
All data stays local. Messages are only sent to the AI when it explicitly invokes a tool.
| Dependency | Version | Notes |
|---|---|---|
| wacli | dev+ | Must be authenticated (wacli auth) |
| Python | >= 3.11 | Managed by uv |
| uv | >= 0.10 | Python package manager |
# 1. Clone
git clone https://github.com/grrek/mcp-wacli.git
cd mcp-wacli
# 2. Install dependencies
uv sync
# 3. Verify wacli is authenticated
wacli doctor --json
# 4. Test the MCP server (stdio mode)
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | uv run server.py
Best for Claude Code and Claude Desktop when accessing a remote server via SSH.
uv run server.py
Best for network access from any MCP client, including non-Anthropic LLMs. Can run as a persistent systemd service.
uv run server.py --http
On first run, a random 32-character token is generated and saved to ~/.mcp-wacli-token (mode 0600). The server prints the token to stderr on startup. All HTTP requests must include Authorization: Bearer <token>.
Customize with environment variables:
MCP_HOST — bind address (default: 0.0.0.0)MCP_PORT — port (default: 9800)Note: The MCP library's built-in DNS rebinding protection (TrustedHostMiddleware) is disabled in mcp-wacli because it rejects connections from non-localhost IPs. Authentication is handled instead by the ASGI Bearer token middleware, which validates every request at the transport level before it reaches the MCP handler.
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/mcp-wacli.service << 'EOF'
[Unit]
Description=mcp-wacli HTTP/SSE server
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/home/YOUR_USER/mcp-wacli
ExecStart=/home/YOUR_USER/.local/bin/uv run server.py --http
Environment=MCP_HOST=0.0.0.0
Environment=MCP_PORT=9800
Restart=on-failure
RestartSec=10
[Install]
WantedBy=default.target
EOF
systemctl --user daemon-reload
systemctl --user enable mcp-wacli
systemctl --user start mcp-wacli
# Allow service to run without an active SSH session
loginctl enable-linger YOUR_USER
Useful commands:
systemctl --user status mcp-wacli — check statussystemctl --user restart mcp-wacli — restart after updatesjournalctl --user -u mcp-wacli -f — follow logsUse the Claude CLI to add the MCP server:
claude mcp add --transport sse -s user whatsapp http://YOUR_SERVER:9800/sse \
--header "Authorization: Bearer YOUR_TOKEN_HERE"
This writes the config to ~/.claude.json. Alternatively, add it manually:
{
"mcpServers": {
"whatsapp": {
"type": "sse",
"url": "http://YOUR_SERVER:9800/sse",
"headers": {
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
}
}
}
claude mcp add -s user whatsapp -- ssh \
-o LogLevel=ERROR \
-o ClearAllForwardings=yes \
your-server \
"export PATH=\$HOME/.local/bin:\$PATH && cd ~/mcp-wacli && uv run server.py"
Important SSH caveats:
- Use
-o LogLevel=ERRORto suppress SSH warnings on stderr (they break the MCP JSON-RPC handshake)- Use
-o ClearAllForwardings=yesif your~/.ssh/confighasLocalForwardentries for this host (port-forward bind warnings also break the handshake)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"whatsapp": {
"type": "sse",
"url": "http://YOUR_SERVER:9800/sse",
"headers": {
"Authorization": "Bearer YOUR_TOKEN_HERE"
}
}
}
}
{
"mcpServers": {
"whatsapp": {
"command": "ssh",
"args": [
"-o", "LogLevel=ERROR",
"-o", "ClearAllForwardings=yes",
"your-server",
"export PATH=$HOME/.local/bin:$PATH && cd ~/mcp-wacli && uv run server.py"
]
}
}
}
If wacli and mcp-wacli are on the same machine:
{
"mcpServers": {
"whatsapp": {
"command": "uv",
"args": ["run", "server.py"],
"cwd": "/path/to/mcp-wacli"
}
}
}
Start the HTTP server and point the client to http://YOUR_SERVER:9800/sse with the Bearer token from ~/.mcp-wacli-token.
| Tool | Description |
|---|---|
list_chats |
List chats with optional name search |
show_chat |
Show details of a single chat by JID |
| Tool | Description |
|---|---|
list_messages |
List recent messages with date/chat filters |
search_messages |
Full-text search (FTS5 or LIKE fallback) |
show_message |
Show a single message by ID |
message_context |
Show surrounding messages for context |
| Tool | Description |
|---|---|
search_contacts |
Search contacts by name or phone |
show_contact |
Show contact details by JID |
set_contact_alias |
Set a local nickname for a contact |
remove_contact_alias |
Remove a local nickname |
refresh_contacts |
Re-import contacts from session store |
| Tool | Description |
|---|---|
send_message |
Send a text message |
send_file |
Send image, video, audio, or document |
| Tool | Description |
|---|---|
list_groups |
List groups with optional search |
group_info |
Fetch live group info |
group_rename |
Rename a group |
group_leave |
Leave a group |
group_join |
Join a group by invite code |
group_participants_add |
Add members to a group |
group_participants_remove |
Remove members from a group |
group_participants_promote |
Promote members to admin |
group_participants_demote |
Demote admins |
| Tool | Description |
|---|---|
download_media |
Download media from a message |
| Tool | Description |
|---|---|
sync_once |
Sync new messages (connect, fetch, exit) |
history_backfill |
Request older messages from primary device |
| Tool | Description |
|---|---|
doctor |
Check store, auth, and search status |
auth_status |
Show authentication status |
Once configured, you can ask your AI client things like:
| Type | Format | Example |
|---|---|---|
| Individual | {country}{number}@s.whatsapp.net |
[email protected] |
| Group | {id}@g.us |
[email protected] |
| Phone number | {country}{number} |
573001234567 |
~/.wacli/send_message and send_file tools require the AI client to request permission before executionsecrets.token_urlsafe(32)) stored with mode 0600wacli authwacli sync should be running or sync_once must be calledMIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-wacli": {
"command": "npx",
"args": []
}
}
}Web content fetching and conversion for efficient LLM usage.
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also