WA-MCP
<p align="center">
<img src="docs/hero.jpg" alt="VYLUX WA-MCP — WhatsApp for AI agents" width="100%" />
</p>
<h1 align="center">VYLUX WA-MCP</h1>
<p align="center"><b>Give your AI agent real, safe access to a WhatsApp account.</b></p>
<p align="center">
<a href="https://github.com/VYLUXTECH/WA-MCP/releases"><img src="https://img.shields.io/github/v/release/VYLUXTECH/WA-MCP?color=%232DD4BF&label=version&logo=github" alt="Release"/></a>
<a href="https://github.com/VYLUXTECH/WA-MCP/stargazers"><img src="https://img.shields.io/github/stars/VYLUXTECH/WA-MCP?color=%23A855F7&logo=github" alt="Stars"/></a>
<a href="https://github.com/VYLUXTECH/WA-MCP/blob/main/LICENSE"><img src="https://img.shields.io/github/license/VYLUXTECH/WA-MCP?color=%233B82F6" alt="MIT License"/></a>
<img src="https://img.shields.io/badge/tools-84-%2322D3EE?logo=visualstudio&logoColor=white" alt="84 tools"/>
<img src="https://img.shields.io/badge/numbers-multi--number%20(v3)-%23F472D0" alt="Multi-number"/>
<img src="https://img.shields.io/badge/calls-real%20voice%20(zapo--js)-%23EC4899" alt="Real calls"/>
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-20%2B-339933?logo=nodedotjs&logoColor=white" alt="Node 20+"/></a>
<a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/MCP-compatible-black?logo=anthropic" alt="MCP"/></a>
</p>
<p align="center">
<a href="https://render.com/deploy?repo=https://github.com/VYLUXTECH/WA-MCP"><img src="https://render.com/images/deploy-to-render-button.svg" alt="Deploy to Render" height="26"/></a>
<a href="https://railway.app/new/template?template=https://github.com/VYLUXTECH/WA-MCP"><img src="https://railway.app/button.svg" alt="Deploy on Railway" height="26"/></a>
</p>
An [MCP](https://modelcontextprotocol.io) server that connects through a normal
linked-device session (the same mechanism as WhatsApp Web), powered by
[Baileys](https://github.com/WhiskeySockets/Baileys) — the complete WhatsApp
Web protocol library. Pair once with a QR code or a pairing code; the session
is stored locally and reused. **Your session never leaves your machine.**
> Built by **VYLUX TECH** ([vyluxtech.com](https://vyluxtech.com)) — *Engineering Digital Realities*.
> Based on the original [whatsapp-baileys-mcp](https://github.com/Jalalkhan96/whatsapp-baileys-mcp) by Jalal Khan (MIT). Thank you for the foundation. 🇺🇬
---
## What's upgraded in v2.0
| Upgrade | What it does |
|---|---|
| **AI auto-reply** | Point it at any OpenAI-compatible endpoint (`WA_AI_URL`) and incoming DMs get intelligent replies — with a human "typing…" indicator first. Falls back to static text |
| **Anti-ban send pacing** | Every send is automatically paced (`WA_SEND_MIN_GAP_MS`, default 1.2s) with a daily cap (`WA_DAILY_SEND_CAP`, default 1000). Protects your number |
| **Tool allowlist** | `WA_ALLOWED_TOOLS` exposes only the tools you choose — give an agent read-only access, or send-only, or everything |
| **Message store** | Every incoming message is persisted on disk (last 200 per chat) — readable anytime via `wa_read_messages` |
| **`wa_read_messages`** | Real implementation — read recent messages per chat with sender, text and media flags *(advertised upstream, now it exists)* |
| **`wa_forward_message`** | Native WhatsApp forward, no download/re-upload *(advertised upstream, now it exists)* |
| **`wa_typing`** | Typing / recording indicators on demand |
| **`wa_send_sticker`** | Send any local image as a sticker |
| **`wa_download_media`** | Download media from any stored message |
| **`wa_privacy`** | View/change last-seen, online, photo, status, read-receipts and group-add privacy |
| **`wa_update_profile`** | Set profile name, about and photo programmatically |
| **`wa_autoreply`** | Business auto-responder: business hours (inside/outside texts), per-sender cooldown, DMs only |
| **`wa_health`** | Uptime, send/receive counters, pacing state — for monitoring |
| **Webhooks** | `wa_webhook` — every incoming message POSTed to your URL as JSON. Build your own bots on top |
| **Rules engine** | Keyword→reply rules with owner alerts — a real FAQ bot without any AI key |
| **Owner notify + VIPs** | First-time contacts and VIPs ping the owner instantly |
| **Human handoff** | When the owner replies manually, automation pauses for that chat (default 2h) — no double-replying |
| **URL media** | Send images/videos/audio/documents straight from a URL — "generate a logo and WhatsApp it to me" just works |
| **Multi-number (v3)** | Run **several WhatsApp numbers in one server** — each with its own session, pacing budget, stats and store. `wa_profile_add` pairs a new number, `wa_profile_switch` moves all tools to it, everything stays connected in parallel |
| **Scheduled broadcasts** | One message → up to 60 chats, once/daily/weekly, paced and cancellable |
| **Status posting** | Post text/image/video stories to your status |
| **E2EE poll voting** | Vote on polls with the exact WhatsApp key derivation |
| **Live location** | Start, update and stop moving-location sharing |
| **Docker** | One `docker compose up` with a persistent volume |
| **Custom pairing code** | Pair with a memorable code — default `VYLUXMCP` |
| **REAL voice calls** | Optional `zapo-js` layer answers/rejects/ends **actual WhatsApp calls** (WebRTC, MLow codec) — the one thing Baileys can't do. Auto-policy or manual `wa_call_action` |
## The tools (84)
**Messaging** — `wa_status` · `wa_send_text` · `wa_send_image` · `wa_send_video` · `wa_send_audio` (voice notes) · `wa_send_document` · `wa_send_poll` · `wa_send_location` · `wa_send_contact` · `wa_send_sticker` · `wa_forward_message` · `wa_delete_message` · `wa_edit_message` · `wa_pin_message` · `wa_react` · `wa_read_messages` · `wa_search_messages` · `wa_typing`
**Broadcasts** — `wa_broadcast_chats` (≤60, paced) · `wa_broadcast_groups` (≤60, paced) · `wa_broadcast_channels` (≤20, paced)
**Groups** — `wa_list_groups` · `wa_group_metadata` · `wa_group_create` · `wa_group_rename` · `wa_group_set_description` · `wa_group_settings` · `wa_group_participants` · `wa_group_ephemeral` · `wa_group_join` · `wa_group_leave` · `wa_group_requests` · `wa_group_invite_link`
**Channels (Newsletters)** — `wa_channel_info` · `wa_create_channel` · `wa_update_channel` · `wa_set_channel_picture` · `wa_channel_remove_picture` · `wa_post_channel` · `wa_channel_subscription` · `wa_channel_subscribers` · `wa_channel_fetch_messages` · `wa_channel_admins` · `wa_channel_delete`
**Rules & handoff** — `wa_rule_add` · `wa_rule_list` · `wa_rule_delete` · `wa_vip_add` · `wa_handoff`
**Status, polls & location** — `wa_post_status` · `wa_poll_list` · `wa_poll_vote` (E2EE) · `wa_live_location`
**Multi-number (v3)** — `wa_profile_list` · `wa_profile_add` · `wa_profile_switch` · `wa_profile_remove`
**Broadcasts** — `wa_broadcast_schedule` · `wa_broadcast_list` · `wa_broadcast_cancel`
**Automation & account** — `wa_schedule_send` · `wa_list_scheduled` · `wa_cancel_scheduled` · `wa_autoreply` · `wa_update_profile` · `wa_privacy` · `wa_profile_picture` · `wa_download_media` · `wa_chat_modify` · `wa_block_user` · `wa_blocklist` · `wa_contacts_check` · `wa_business_profile` · `wa_fetch_status` · `wa_dm_ephemeral` · `wa_export_session_zip` · `wa_health` · `wa_qr` · `wa_logout`
**Calls (optional, via zapo-js)** — `wa_calls` · `wa_calls_pair` · `wa_call_action` · `wa_call_policy`
**Integrations** — `wa_webhook` (POST every incoming message to your own URL — build anything on top)
## Claude Code plugin / Skills pack
Prefer skills over MCP tools? This repo ships **`plugins/vylux-wa/`** — a
Claude Code plugin with 5 task-oriented skills (send-messages,
customer-service, groups-channels, voice-calls, automation-broadcasts) that
teach any agent to drive WhatsApp properly, including the guardrails.
```bash
claude plugin add VYLUXTECH/WA-MCP # or copy plugins/vylux-wa into ~/.claude/plugins
```
## Install from npm
```bash
npx vx-wa-mcp # run the server directly
# or
npm i -g vx-wa-mcp # install globally → `vx-wa-mcp` + `vx-wa-mcp-pair` commands
```
## Quick start
```bash
git clone https://github.com/VYLUXTECH/vylux-wa-mcp.git
cd vylux-wa-mcp
npm install
cp .env.example .env # set your number
npm run pair # shows pairing code VYLUXMCP — enter it on the phone
npm start # MCP server on stdio
```
### Pair by code (no QR scanning)
Set `WA_PHONE_NUMBER` and run `npm run pair` — you'll see:
```
=== PAIRING CODE for +256700000000: VYLUXMCP ===
```
On the phone: **WhatsApp → Settings → Linked devices → Link a device →
"Link with phone number instead"** → type the code.
### Claude Desktop / any MCP client
```json
{
"mcpServers": {
"whatsapp": {
"command": "node",
"args": ["/path/to/vylux-wa-mcp/src/index.js"]
}
}
}
```
### Docker (HTTP transport)
```bash
docker compose up -d # MCP on http://localhost:3930/mcp
docker compose exec wa-mcp node src/pair.js # pair inside the container
```
## AI auto-reply in 3 lines
```env
WA_AI_URL=https://your-endpoint/v1
WA_AI_KEY=your-key
WA_AI_MODEL=deepseek-v4.1-flash-abliterated
```
Then enable it once: ask your AI to call `wa_autoreply` with `enabled: true`.
Incoming DMs get an intelligent reply with a typing indicator, paced and
cooldown-protected. Works with any OpenAI-compatible endpoint — local models,
OpenRouter, or your own gateway.
## Real voice calls (the zapo layer)
Baileys can see calls but cannot answer them. **zapo-js** can — it's a full WA
Web client with a WebRTC voip plugin. Enable it and this server runs a second
linked device dedicated to calls:
```env
WA_ENABLE_CALLS=true
WA_CALL_POLICY=reject # reject (default) | ignore | accept — auto-handling
```
```bash
npm i zapo-js @zapo-js/voip @zapo-js/store-sqlite # native deps, one-time
```
Then pair the calls device once: ask your AI to call `wa_calls_pair` with your
number, enter code `VYLUXMCP` on the phone, done. Now:
- `wa_calls` — live call status + last 10 calls
- `wa_call_action` — `accept` / `reject` / `end` any call (or `"latest"`)
- Incoming calls are auto-handled per `WA_CALL_POLICY`
Messaging stays on Baileys (one linked device), calls on zapo (the second) —
clean separation, no interference.
## Multi-number (v3.0)
One server, many WhatsApp numbers:
```
wa_profile_add { name: "sales", phone: "2567..." } → pairing code → enter on that phone
wa_profile_add { name: "support", phone: "2567..." } → pairing code → enter on that phone
wa_profile_switch { name: "sales" } → all 84 tools now act on "sales"
```
- Every profile = its own linked device, session dir, anti-ban pacing budget, stats and message store
- All profiles stay connected in parallel — auto-reply, rules and webhooks fire per profile
- `wa_status` shows the whole registry; `wa_profile_remove` logs out and cleans up
## Safety model
- **Session stays local** — creds live in `WA_SESSION_DIR`, nothing phones home
- **Pacing by default** — 1.2s minimum between sends, 1000/day cap (both tunable)
- **Allowlist** — expose only what your agent needs
- **DMs only for auto-reply** — never groups, never status, owner number exempt
- **Audit log** — every mutating action is appended to `audit.log`
## Honest limits
- Baileys is an unofficial library — **ban risk is real**, especially for broadcasts. Only message people who expect to hear from you
- Messages are stored from pairing time onward — no deep history backfill
- Encrypted (paid) WhatsApp features are out of scope — this is for your own account
## License
MIT — see [LICENSE](LICENSE). Original server by [Jalalkhan96](https://github.com/Jalalkhan96);
v2.0 upgrades by **VYLUX TECH**.
TDQS
Scored across 84 tools
Most tools target a clearly distinct resource+action (send_text vs send_image vs post_channel vs group_participants). A few boundaries blur: wa_schedule_send/wa_list_scheduled/wa_cancel_scheduled sit alongside wa_broadcast_schedule/wa_broadcast_list/wa_broadcast_cancel, and wa_read_messages vs wa_channel_fetch_messages vs wa_search_messages overlap conceptually. Also 'profile' is overloaded across wa_profile_add/switch/remove (account profiles), wa_update_profile (own profile), and wa_business_profile (contact business card).
All tools share a wa_ prefix with snake_case, and most are verb_noun (wa_send_text, wa_create_channel, wa_group_rename). A notable minority are bare nouns or ambiguous verbs (wa_status, wa_health, wa_qr, wa_privacy, wa_autoreply, wa_handoff, wa_typing), which breaks the pattern slightly but stays readable and predictable.
84 tools is far beyond a workable surface for an agent; even for a broad WhatsApp automation domain this forces constant tool-selection overhead and near-duplicate families (six broadcast tools, four profile tools, six channel-admin tools). The scope does justify many capabilities, but it should have been consolidated (e.g. one broadcast tool with a target type) rather than expanded to this size.
Coverage is near-exhaustive: messaging, media, groups lifecycle and admin, channels, statuses, polls, calls, contacts, privacy, scheduling, broadcasting, auto-reply rules, webhooks, multi-profile and session export. Lifecycle operations (create/update/delete/leave/join/pin/revoke) exist for essentially every resource, leaving no obvious dead ends.