WhatsApp MCP Server
Provides tools for connecting to a personal WhatsApp account via WhatsApp Web QR pairing, reading and searching cached chats/messages, downloading media, fetching message history, and sending text or media to allowlisted chats when outbound sending is explicitly enabled.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WhatsApp MCP Server show my recent chats"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WhatsApp MCP Server
A local stdio-only MCP server for a personal WhatsApp account using WhatsApp Web QR pairing. It provides chat and media reading plus safe opt-in text and media sending. Outbound tools are disabled unless explicitly enabled and limited to an allowlisted set of chats.
Risk: this uses an unofficial WhatsApp Web library. WhatsApp may change its protocol or restrict accounts that use unofficial clients. Use only with your own account, keep session state private, and prefer a separate account for experimentation.
Install
npm install
cp .env.example .env
npm run buildSet WHATSAPP_ALLOWLIST in .env to comma-separated WhatsApp JIDs. It is required for send_message and send_media; read tools remain available with an empty allowlist. Keep outbound files in WHATSAPP_OUTBOUND_MEDIA_DIRS (default: ./outbox).
Related MCP server: whatsapp-mcp
Pair
npm startOn first launch the server writes whatsapp-qr.png locally with mode 0600. Scan it from WhatsApp: Linked devices → Link a device. The local auth directory and media directories are created with mode 0700.
The process speaks MCP over stdin/stdout. Status and errors use stderr only. Do not expose this process behind HTTP or a network socket.
MCP tools
connection_status— pairing/connection state and local QR locationlist_chats— cached chatssearch_messages— text search over the local session cacheread_messages— recent cached messages for an allowlisted chatdownload_media— save a cached allowlisted message attachment locallyfetch_all_chats— list every chat in the local session cachefetch_message_history— page older messages for an allowlisted chat via BaileysfetchMessageHistorysend_message— send text to an allowlisted chat (requiresWHATSAPP_SENDING_ENABLED=true)send_media— send an image, video, audio, document, or sticker from an approved local file (requiresWHATSAPP_SENDING_ENABLED=true)
The cache starts filling after WhatsApp history/message events arrive. It is intentionally not a full archive. fetch_message_history can pull older messages on demand, but only while the WhatsApp socket is connected.
MCP client configuration
{
"mcpServers": {
"whatsapp-local": {
"command": "node",
"args": ["/absolute/path/to/whatsapp-mcp-server/dist/index.js"],
"env": {
"WHATSAPP_ALLOWLIST": "1234567890@s.whatsapp.net",
"WHATSAPP_SENDING_ENABLED": "true",
"WHATSAPP_OUTBOUND_MEDIA_DIRS": "/absolute/path/to/whatsapp-mcp-server/outbox"
}
}
}
}Safety controls
Stdio transport only; no HTTP listener.
Sending is disabled by default.
send_messageandsend_mediarequireWHATSAPP_SENDING_ENABLED=trueand a non-emptyWHATSAPP_ALLOWLIST.Send tools are gated at call time, so a config typo cannot silently enable them.
Outbound media must resolve to a regular file within
WHATSAPP_OUTBOUND_MEDIA_DIRSand stay belowWHATSAPP_MAX_OUTBOUND_MEDIA_BYTES(64 MiB default).Outbound sends have a separate rate limit (default: 10/minute) independent of read limits.
Input validation via Zod on every tool.
Per-process read rate limit (default: 30 tool calls/minute).
Result caps (default: 50) and local allowlist support.
Auth files, QR image, downloaded media, outbound files,
.env, build output, and logs are gitignored.Sensitive files/directories are written with
0600/0700modes where created by this service.
Verify
npm run check
npm testLicense
MIT. See LICENSE.
Viewing the QR code
The QR image is written to the local whatsapp-qr.png path. Attach or upload that image in your MCP client UI after launching the server. The QR expires quickly; call connection_status after scanning to confirm the connection state is connected.
Whatsapp-Mcp
Available Tools
9 toolsconnection_statusB
Show local pairing and connection state. QR is written to the configured local file.
Inputs: no named parameters.
download_mediaB
Download media from a locally cached allowlisted message to the configured local directory.
Inputs: chatId (required), messageId (required).
fetch_all_chatsB
List ALL chats visible in the local session cache (not capped by the default list).
Inputs: limit.
fetch_message_historyA
Pull older messages for an allowlisted chat using Baileys fetchMessageHistory. Use beforeMessageId to page backward.
Inputs: chatId (required), limit, beforeMessageId.
list_chatsC
List chats visible in this local session cache.
Inputs: limit.
read_messagesB
Read recent locally cached messages from one allowlisted chat.
Inputs: chatId (required), limit.
search_messagesB
Search locally cached message text. This never sends messages.
Inputs: query (required), limit, chatId.
send_mediaA
Send an image, video, audio, document, or sticker from a regular file inside WHATSAPP_OUTBOUND_MEDIA_DIRS to an allowlisted chat. Requires WHATSAPP_SENDING_ENABLED=true.
Inputs: chatId (required), filePath (required), mediaType (required), caption.
send_messageB
Send a text message to an allowlisted chat. Requires WHATSAPP_SENDING_ENABLED=true.
Inputs: text (required), chatId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools target distinct operations, but list_chats vs fetch_all_chats and read_messages vs fetch_message_history have overlapping purposes. Their descriptions clarify the differences (default-capped vs all chats, recent vs older history), so misselection is possible but manageable.
Nearly all tools follow a consistent snake_case verb_noun pattern: list_chats, search_messages, read_messages, send_message, etc. Minor deviations are fetch_all_chats vs list_chats for similar listing actions and connection_status lacking a clear verb.
Nine tools is well-scoped for a local WhatsApp MCP server. Each tool covers a distinct capability such as connection status, chat listing, message reading/searching, media handling, and sending.
The server covers core messaging workflows: connection state, chat discovery, message reading/searching/history, media download, and guarded sending. Some gaps remain, such as contact/group metadata, message reactions, or chat creation, but the essential read/send surface is present.
Maintenance
Related MCP Connectors
Drive WhatsApp from any MCP client: pair devices, send text and media, manage contacts and groups.
Your own WhatsApp as an MCP server: read, search and send from any MCP client.
WhatsApp MCP on your own number: read chats, send and schedule messages.
WhatsApp MCP for chats you choose: read/write by default, no daily send quota, voice notes as text.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables connecting a personal or business WhatsApp account via QR pairing and then sending/reading messages, managing chats, contacts, groups, and searching message history through MCP tools.MIT
- AlicenseNot gradedqualityCmaintenanceEnables agents and MCP clients to read and send WhatsApp messages and media, search chats, and manage contacts and groups after a one-time QR pairing.37 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to read, search, and send personal WhatsApp messages and files through a locally linked device.37 npmMIT
- AlicenseNot gradedqualityBmaintenanceRuns locally and pairs an existing WhatsApp account as a linked device, enabling Claude Code, Codex, and other MCP clients to read chats, retrieve media, draft replies, and send messages only after client-enforced human approval.37 npm1MIT