WhatsApp MCP
Connects to a personal WhatsApp account as a linked device, allowing agents to read and search chat history, monitor unread messages, send messages and files, and download or view received media.
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 MCPWhat are my unread WhatsApp messages?"
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
An MCP server that connects Claude, or any other MCP client, to your personal WhatsApp account. It links to your account as a device, the way WhatsApp Web does, and keeps a searchable copy of your chats on your own computer. From there the assistant can read and search your history, send messages and files, and open the photos and documents people send you.
Things you can ask once it's set up:
"What are my unread WhatsApp messages?"
"Summarise what the book club group talked about this week."
"Find the invoice Alex sent me in August."
"Tell Sam I'm running ten minutes late."
"What's in the photo Zoe sent this morning?"
This usesBaileys, an unofficial WhatsApp client, and using it breaks WhatsApp's terms of service. Accounts that behave like a normal linked device (reading, sending the odd message) are rarely affected. Bulk or automated sending is what gets numbers banned, so don't use this for either. Use it at your own risk.
The data/ folder it creates holds your session keys. Anyone with a copy can read and
send as you, so never commit, sync or share it.
Requirements
Node.js 22.16 or newer (24 recommended). Older versions' built-in SQLite lacks the full-text search this uses.
Windows, macOS or Linux
The phone with the WhatsApp account you want to link
Related MCP server: whatsapp-mcp
Install
git clone https://github.com/ionutsss1/whatsapp-mcp.git
cd whatsapp-mcp
npm installnpm install also builds the server into dist/.
Link your WhatsApp
Use whichever of these is most convenient:
From your MCP client: once it's connected (next section), ask it to check the WhatsApp connection. The
connection_statustool returns a QR code.In a browser: run
npm run statusto start the bridge, then open http://127.0.0.1:47620/link. The page keeps the QR code fresh and also offers linking by phone number.In a terminal:
npm run loginprints the QR code. For an 8-character pairing code instead, runnpm run login -- --phone 15555550123with your own number and country code.
On the phone, go to Linked devices (under Settings on iPhone, the ⋮ menu on Android), then Link a device. This computer then appears in the list as "WhatsApp MCP", and your history syncs over the next few minutes; large accounts take longer.
Connect it to your MCP client
Every client needs the absolute path to dist/mcp.js. Run pwd (macOS/Linux) or cd
(Windows) inside the folder to find it.
Claude Code
claude mcp add --scope user whatsapp -- node /absolute/path/to/whatsapp-mcp/dist/mcp.jsClaude Desktop. Add the server to claude_desktop_config.json, which lives in
~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on Windows:
{
"mcpServers": {
"whatsapp": {
"command": "node",
"args": ["/absolute/path/to/whatsapp-mcp/dist/mcp.js"]
}
}
}Quit Claude Desktop completely and reopen it. Closing the window isn't enough, because the
app keeps running in the tray or menu bar. If the server doesn't start, Claude Desktop
probably can't find node: replace "node" with its full path, which which node or
where node prints. On Windows that is something like "C:\\Program Files\\nodejs\\node.exe",
with the backslashes doubled as JSON requires.
Other clients. Any client that runs local (stdio) servers works: the command is node,
and its one argument is the path to dist/mcp.js.
Tools
Tool | What it does |
| Shows whether you're linked and connected, and how much is synced. Returns a QR code (or pairing code) when you're not linked. |
| Recent chats with unread counts and the last message. Can filter to unread, direct or group chats. |
| A chat's messages, oldest first. Page back with |
| Full-text search, across all chats or one, ignoring case and accents: "cafe" finds "café". Covers captions and document names too. |
| Finds a person or group by name or number and returns the ID the other tools take. |
| Sends text, optionally as a reply to a message. |
| Sends a photo, video, audio file, voice note ( |
| Saves an attachment. Photos and stickers are also shown to the assistant, so it can describe them. |
Sending is deliberately strict about the recipient. It accepts a chat ID, a phone number with country code, an exact contact or group name, or "myself". A partial or ambiguous name is refused with a list of candidates, so a message never goes to a best guess.
How it works
MCP client ──stdio──> dist/mcp.js ──reads──> data/whatsapp.db (SQLite + full-text index)
│ ^
└──HTTP 127.0.0.1──> dist/bridge.js ──WebSocket──> WhatsAppThe bridge is a single background process. It holds the WhatsApp connection, mirrors chats, contacts and messages into SQLite, and does all sending and downloading. The MCP server starts it when needed, and it keeps running after your client exits, so messages keep syncing.
The MCP server is what the client talks to. It reads straight from SQLite and passes everything else to the bridge over localhost.
The two are separate on purpose. Clients start one MCP server per session, and two connections using the same session keys knock each other offline. However many sessions and apps you run, they all share the one bridge.
Privacy and safety
Your data stays local. History lives in
data/whatsapp.db. The only other connections the bridge makes are to WhatsApp itself and to GitHub, to check which WhatsApp Web version Baileys currently supports.It stays quiet. The bridge doesn't mark you as online, so your phone keeps its notifications, and it never sends read receipts (blue ticks).
Deletions are respected. Messages deleted for everyone are wiped locally too. View-once media is only ever delivered to the phone, so it can't be opened here.
The local API is locked down. The bridge only listens on
127.0.0.1and needs a random token, which is stored indata/bridge-token. It also rejects foreignHostandOriginheaders, so no web page can send messages through it.Messages are data, not instructions. Messages are written by other people. The server tells the assistant never to act on instructions inside them, and every result that contains message text repeats that warning. Most clients also ask you before each send.
Day to day
npm run status # connection state and sync counts
npm run stop # stop the bridge (you stay linked; it restarts when needed)
npm run logout # unlink this computer from WhatsApp and delete the session keysLog: the bridge writes to
data/bridge.log, rotated at 5 MB.Downloads: saved to
data/media/<chat>/unless you passsave_to_dir.Removing everything: run
npm run logout, then delete thedata/folder.
Configuration
Set these for both processes; with an MCP client, set them in its server config (env).
Variable | Default | Notes |
|
| The bridge's port, which also stops a second bridge from starting. |
|
| Session keys, database, media and log. |
|
| Baileys log level: |
Troubleshooting
No QR code, and the log says
428 Connection Terminated. WhatsApp now drops clients that claim to be the native Windows or Mac desktop app (Browsers.windows('Desktop')in Baileys). The bridge identifies as['WhatsApp MCP', 'Desktop', …], which still gets the full history. Keep it that way if you fork this.State
logged_out. The device was removed on the phone. Link it again.State
replaced. Something else connected with the same keys, usually a second copy ofdata/. Stop that copy, then runnpm run stopso the bridge starts fresh.Old media won't download. WhatsApp expires media after a while. The bridge asks the phone to upload it again, which only works if the phone is online and still has the file.
Contacts show as
~Name. A name with~is the one the person set for themselves. Linked devices only get the names your phone chooses to share; WhatsApp Web shows the same thing.
Development
npm test # builds, then runs the offline test suite; no WhatsApp account needed
npm run smoke # checks every tool against your own linked account; prints only headersFile | Role |
| The WhatsApp connection, local HTTP API and linking page ( |
| Writes Baileys events to SQLite, and merges each LID into its phone number (see |
| Turns a WhatsApp message into a type, text and media details. |
| The MCP tools. |
| Queries, name resolution and the text the assistant sees. |
|
|
WhatsApp is moving people from phone numbers to LIDs, private per-account IDs
(…@lid). The store keeps each person under their phone number once the LID↔phone mapping
is known, and moves anything filed under a LID as soon as the mapping arrives.
License
MIT. This project is not affiliated with, endorsed by or connected to WhatsApp or Meta.
This server cannot be deployed
Maintenance
Related MCP Connectors
Drive WhatsApp from any MCP client: pair devices, send text and media, manage contacts and groups.
Let Claude or ChatGPT search, read and send your WhatsApp messages over MCP. OAuth sign-in.
Your own WhatsApp as an MCP server: read, search and send from any MCP client.
WhatsMCP connects Claude and other MCP-compatible AI agents directly to WhatsApp. Send and receive text, images, documents, and voice notes; manage groups (create, add/remove members, promote admins); look up contacts and profiles; follow channels; and read call and message history — all through a standard MCP interface. For voice use cases, WhatsMCP offers SIP-based calling plans (inbound-only, or full inbound/outbound) so AI voice agents can answer and place WhatsApp calls, plus low-latency WebSocket integrations with voice agent providers like ElevenLabs. Multiple WhatsApp accounts can be paired and managed per workspace, with webhook support for real-time inbound message delivery to your own infrastructure.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients to list, read, search, and send WhatsApp messages via a persistent WebSocket connection with local SQLite storage.35 npmAGPL 3.0
- AlicenseNot gradedqualityBmaintenanceEnables sending WhatsApp messages from MCP clients using a personal WhatsApp account via WebSocket protocol, without needing the Business API or browser automation.35 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP clients to read, search, and send WhatsApp messages with a server-enforced send gate for safety.2MIT
- AlicenseNot gradedqualityAmaintenanceEnables connecting a personal WhatsApp number to any MCP client, providing tools to send, search, and manage WhatsApp messages, with an optional auto-reply feature.4MIT