# whatsapp-mcp [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/meharajM/whatsapp-mcp  
**GitHub Stars:** 0  
**npm Downloads (last month):** 637  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/whatsapp-mcp

## Description
WhatsApp MCP Server - Human-in-the-loop for AI agents via WhatsApp

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "whatsapp-mcp": {
    "command": "npx",
    "args": ["-y","@mhrj/whatsapp-mcp"],
    "env": {
      "WHATSAPP_TARGET_NUMBER": ""
    }
  }
}
```

**Requires environment variables:** `WHATSAPP_TARGET_NUMBER` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What whatsapp-mcp does

whatsapp-mcp gives an AI agent a WhatsApp channel for human-in-the-loop workflows. The agent can notify a user, request a decision before continuing, collect unsolicited inbound messages, and inspect whether the WhatsApp connection is ready. A typical use is asking for approval before a deployment or other significant change, then continuing after the user replies from their phone.

The server communicates with MCP clients through stdio and targets a configured WhatsApp chat. It is intended for clients including Cursor, Claude Desktop, Claude Code, and Codex, as well as other MCP clients that can launch stdio servers.

## How it works

The MCP client starts the server and invokes its WhatsApp tools. If the account is not authenticated, the server begins the linking process automatically. QR authentication returns an image in MCP content and may also create a fallback HTML page at `~/.whatsapp-mcp/qr.html`. Phone-number authentication returns a pairing code instead.

After linking, credentials are stored under `~/.whatsapp-mcp/baileys_auth_info`, allowing later launches to reuse the session. `ask_question` waits for a response and supports queued concurrent questions. Replies are matched using quoted-message references or `[Qn]` labels; when neither is available, the server falls back to first-in, first-out matching.

## Setup and configuration

Install through the published npm package with `npx` in the MCP client configuration:

```json
{
  "mcpServers": {
    "whatsapp-mcp": {
      "command": "npx",
      "args": ["-y", "@mhrj/whatsapp-mcp"],
      "env": {
        "WHATSAPP_TARGET_NUMBER": "1234567890@s.whatsapp.net"
      }
    }
  }
}
```

`WHATSAPP_TARGET_NUMBER` is required and supplies the default chat for `send_message` and `ask_question`. Set `AGENT_WHATSAPP_PHONE_NUMBER` to use phone-number pairing by default; otherwise, QR linking is used. `WHATSAPP_PAIRING_PHONE_NUMBER` is a deprecated compatibility alias. For group targets ending in `@g.us`, configure `WHATSAPP_ALLOWED_NUMBERS` with the individual sender JIDs permitted to answer.

GUI applications may not inherit the terminal `PATH`. If the client cannot find `npx` or `node`, add an explicit `PATH` entry to the server environment. Start authentication by calling `connect`, or invoke another WhatsApp tool and let it trigger authentication.

## Tools and capabilities

- `connect` links the WhatsApp account and returns a QR image or pairing code when authentication is needed. It accepts optional `phoneNumber` or `phone_number` arguments for a one-off pairing request.
- `disconnect` logs out and invalidates the stored session credentials.
- `send_message` sends a one-way notification and supports limited WhatsApp markdown mapping such as `*bold*`.
- `ask_question` sends a prompt, waits for a reply, and applies a timeout. Multiple pending questions are queued and tagged with references.
- `get_incoming_messages` polls inbound messages that were not replies to a pending question.
- `get_status` reports connection and authentication states including `connected`, `connecting`, `qr_pending`, and `pairing_pending`.

The server also exposes workflow instructions and a `whatsapp-autopilot` prompt to encourage connect-first and WhatsApp-first agent behavior.

## Limitations and notes

WhatsApp linking is required before messaging can work. Group chats require an allowlist through `WHATSAPP_ALLOWED_NUMBERS`; the server refuses to start without one when the target is a group. Agents must be instructed to use `ask_question` at decision points if approvals should happen in WhatsApp rather than in the client interface. When several questions are pending, users should quote the relevant message or include its question label to avoid ambiguous reply matching.

_Full upstream README: https://allmcps.com/mcp/whatsapp-mcp/readme_

