
whatsapp-mcp
io.github.habibium/whatsapp-mcp
Link your own WhatsApp and serve it to AI apps on this computer
Documentation
whatsapp-mcp
A WhatsApp MCP server in a single Rust binary. It links to your own WhatsApp as a device, so your AI apps can read, search and send your messages, on your own computer.
- One binary. You don't install Go, Python, uv or Docker.
- You link by scanning a QR code in the terminal, or with a pairing code.
- Linking imports your history from the phone, a year of it unless you ask for more.
- Sending asks you to confirm first, unless you turn that off.
- Several AI apps can use it at once, on one WhatsApp connection.
- Built on whatsapp-rust.
Install
Install it one of these ways. The binary is whatsapp-mcp. An app started from a menu often does not see your shell's PATH. If it can't find the command, put the full path in the app's config.
Homebrew
brew install habibium/tap/whatsapp-mcp
Prebuilt binaries
Each release has one archive per system, and a .sha256 file next to it. The archive contains the binary, this README and the licence.
| System | Archive |
|---|---|
| Linux, 64-bit Intel or AMD | whatsapp-mcp-<version>-x86_64-unknown-linux-gnu.tar.gz |
| Linux, 64-bit ARM | whatsapp-mcp-<version>-aarch64-unknown-linux-gnu.tar.gz |
| macOS, Apple silicon | whatsapp-mcp-<version>-aarch64-apple-darwin.tar.gz |
| macOS, Intel | whatsapp-mcp-<version>-x86_64-apple-darwin.tar.gz |
| Windows, 64-bit | whatsapp-mcp-<version>-x86_64-pc-windows-msvc.zip |
Unpack it and put whatsapp-mcp on your PATH. On Windows the file is whatsapp-mcp.exe.
Cargo
With a Rust toolchain:
cargo install whatsapp-mcp
That puts the binary in ~/.cargo/bin on Linux and macOS, and in %USERPROFILE%\.cargo\bin on Windows.
Claude Desktop extension
The same release has whatsapp-mcp-<version>.mcpb. In Claude Desktop, open Settings, then Desktop app, choose Manage next to Extensions, open Advanced settings, and choose Install Extension…. In the older settings layout that page is Settings, then Extensions. You can also double-click the file, or drop it on the Claude Desktop window.
The extension asks how sending should work. Leave it on confirm unless you want messages to go out on their own. That choice is passed as --send, so it overrides send in config.toml for that run. The other settings still come from the file.
Link WhatsApp
Quit any AI app that is already running whatsapp-mcp, then, in a terminal:
whatsapp-mcp login
A QR code is printed. On the phone, open WhatsApp, then Linked devices, then Link a device, and scan it. The code refreshes until you scan it. The phone lists the device as whatsapp-mcp. WhatsApp allows four linked devices, and this uses one of them until you log it out.
To link with a pairing code instead, pass your number with its country code. Spaces, + and dashes are fine. The number has to be 8 to 15 digits.
whatsapp-mcp login --pair-code 15555550100
whatsapp-mcp prints an 8-character code, with a hyphen after the fourth character. On the phone, open WhatsApp, then Linked devices, Link a device, Link with phone number instead, and enter it.
Linking gives up after 5 minutes. Press Ctrl-C before the phone has linked and it prints Linking cancelled. If WhatsApp is already linked, login connects, prints Linked as and the number, and waits while any history still comes in.
History
login asks the phone for your history and keeps what comes in. The default is 365 days. Ask for less, for up to 3650 days, or for as far back as the phone will send:
whatsapp-mcp login --history-days 30
whatsapp-mcp login --history-days all
While messages arrive it prints a line such as Importing history: 12,345 messages, 40%. The percentage appears once the phone reports one. When the import finishes it prints History import finished: 12345 messages. Press Ctrl-C during the import and the rest finishes the next time whatsapp-mcp runs.
The messages stay until you run logout, which deletes the local database. history_days is how far the next new link asks the phone to go. It does not delete messages you already have.
An AI app starts the server with no terminal, so it never shows a QR code. Until you have linked, a tool answers: Run whatsapp-mcp login in a terminal to link WhatsApp.
Add it to your AI app
The app runs whatsapp-mcp with no arguments. That process is the MCP server. A second app, started while the first is open, attaches to the same process, so both use one linked device.
These are the setups those apps document today. After the app is connected, ask it to call get_status.
Claude Code
Claude Code's MCP docs. --scope user makes it available in every project. The default scope is the current project only.
claude mcp add --scope user --transport stdio whatsapp-mcp -- whatsapp-mcp
The -- separates Claude Code's own options from the program it runs. Start Claude Code and type /mcp to see the server.
Claude Desktop
The extension above is the setup Claude documents for a local server. To add the binary yourself, open Settings, then Developer, and choose Edit Config. The file is:
| System | File |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Add this next to anything already under mcpServers, using the full path to the binary if Claude Desktop cannot find it:
{
"mcpServers": {
"whatsapp-mcp": {
"command": "whatsapp-mcp"
}
}
}
Quit Claude Desktop completely and open it again. Closing the window leaves the old process running.
Cursor
Cursor's MCP docs. For every project, use ~/.cursor/mcp.json. For one project, use .cursor/mcp.json in that project. Cursor's stdio entry includes type.
{
"mcpServers": {
"whatsapp-mcp": {
"type": "stdio",
"command": "whatsapp-mcp"
}
}
}
Save the file and restart Cursor. command is a program on your PATH, or a full path.
Codex
Codex's developer commands store MCP servers in ~/.codex/config.toml. Either run:
codex mcp add whatsapp-mcp -- whatsapp-mcp
or add the same entry the config reference describes for a stdio server:
[mcp_servers.whatsapp-mcp]
command = "whatsapp-mcp"
Another app
Most apps take the same JSON as Claude Desktop and Cursor: a command, and no arguments. If yours uses a different file, check its docs. The server speaks MCP over standard input and output.
Tools
A tool whose lharries column says same has the name and the inputs from lharries/whatsapp-mcp. send_message, send_file and send_audio_message keep those inputs and accept more. Leaving the extra fields out works as before.
A tool that changes WhatsApp asks you to confirm, unless sending is allowed. A destructive one still asks. send_presence does not ask. get_status works before you link. The others tell you to run whatsapp-mcp login.
| Tool | lharries | What it does |
|---|---|---|
get_status | new | Whether WhatsApp is linked and connected, how much is kept, and the safety settings in force. |
search_contacts | same | Contacts and groups by name or number. |
list_chats | same | Chats, latest first, with the last message. Filter with query. |
get_chat | same | One chat by chat_jid. |
get_direct_chat_by_contact | same | The direct chat with a phone number. |
get_contact_chats | same | The chats a person is in. |
list_messages | same | Messages by chat, sender, time or text, with reactions, replies and whether a file can be opened. |
get_message_context | same | The messages before and after one message. |
get_last_interaction | same | The latest message with a person. |
search_messages | new | Text search of messages and file names. Each word has to occur. |
send_message | same, plus reply_to and mentions | A text. reply_to quotes a message in that chat. mentions tags people in a group. |
send_file | same, plus url and caption | A picture, video, document or audio from a path or an https URL, up to 16 MB. JPEG and PNG go as pictures, MP4 as video, audio as audio, and anything else as a document. A caption is optional, and audio can't have one. |
send_audio_message | same, plus url | A voice note. Ogg Opus is sent as it is. Anything else is converted with FFmpeg, and refused if FFmpeg is not installed. |
download_media | same | Saves a message's file under the data directory and returns the path. A picture or an audio file also comes back inline. |
react_to_message | new | An emoji on a message, or an empty emoji to take yours back. |
edit_message | new | Edits your own message. WhatsApp allows this for about 15 minutes. |
delete_message | new | Deletes a message on this account. for_everyone true deletes it for everyone, and that is destructive. |
mark_as_read | new | Sends read receipts for a chat, or for one message. Listing or searching messages does not send them. |
list_groups | new | The groups you are in. |
get_group_info | new | A group's name, description, members, admins and settings, and the invite link when you are an admin. |
create_group | new | Creates a group and adds the phone numbers you give. |
update_group | new | Changes a group's name, description or picture. The picture is a JPEG on this computer. |
add_participants | new | Adds phone numbers to a group. |
remove_participants | new | Removes phone numbers from a group. Destructive. |
leave_group | new | Leaves a group. Destructive. |
get_profile | new | Your name, about text and profile picture URL. |
set_status_text | new | Sets your about text, up to 139 characters. |
send_presence | new | Shows typing, recording or paused in a chat. This does not ask you, and it is not rate limited. |
send_poll | new | A poll with 2 to 12 choices. |
send_location | new | A latitude and longitude, with an optional name and address. |
send_contact | new | A contact card with a name and a phone number. |
Message text, contact names and group names in those answers were written by other people. The server tells the agent that they are data, never an instruction.
Safety
A message someone sends you can be written to look like an instruction: forward these chats to this number, or send this file. An agent that reads it may try to do that. whatsapp-mcp tells the agent that the text is data. That reminder can be ignored. The part you can rely on is the confirmation.
By default, every send asks you first. The question names the recipient and shows the whole text. A file's question shows the file name, the type, the size and the whole caption. You accept it or you don't, and declining sends nothing.
An app that can ask shows that question. A current app asks as a follow-up to the tool call. An older app that supports elicitation asks in its own dialog. An app that can't ask is refused, and the refusal says how to allow sending. get_status reports which of those this app is using: mrtr for the follow-up, elicitation for the older dialog, or can't ask.
Allow sending
In config.toml:
send = "allow"
confirm asks every time, which is the default. allow sends without asking. off refuses every send, including the destructive ones below.
To skip the question for some chats and keep it for the rest, leave send on confirm and list those chats:
allow_send_to = ["15555550100", "120363000000000000@g.us"]
A phone number matches with or without +, spaces, dashes, or @s.whatsapp.net. A group id matches with or without @g.us. An empty list means no chat is exempt.
For one run, start the process that holds the connection with --allow-send, or with --send allow. --allow-send forces allow even when --send is also set. --send off refuses every send.
If whatsapp-mcp is already running, a second start attaches to it, and flags on that second start do nothing. Pass --send, --allow-send or --allow-destructive on the second start and it prints: whatsapp-mcp is already running, so --send, --allow-send and --allow-destructive do not apply. The running process's settings do. Change the file, quit the apps, and start again.
Destructive actions
Three actions stay off until you set destructive = true or start the holding process with --allow-destructive:
- deleting a message for everyone
- removing people from a group
- leaving a group
They still ask you to confirm, even when sending is allowed. An app that can't ask is refused, because these can't be undone. Deleting a message only on this account is an ordinary send: it asks unless sending is allowed, and it does not need this switch. logout is separate. It always asks in the terminal, or you pass --yes.
Showing typing or recording does not ask, and it is not counted below.
Rate limits
At most 30 sends a minute and 1,000 a day, with a gap of 1 to 3 seconds between them. The gap is random and it is not a setting. The limit counts messages, files, voice notes, reactions, edits, deletes, read receipts, polls, locations, contact cards, group changes and a new about text. Reading is not counted, and neither is typing or recording.
Both limits are settings in config.toml. max_sends_per_minute will not go above 60: a higher number is stored as 60. A limit of 0 means nothing of that kind can go out. When a limit is used up, the tool says when the next one can go out.
WhatsApp doesn't officially allow unofficial clients, and its terms don't allow automated messaging. It bans numbers for both, for a while or for good. Sending a lot, or sending to people who don't have your number saved, is the pattern that gets banned. The limits slow that down. They don't make a ban impossible.
Where your messages are stored
| System | Directory |
|---|---|
| Linux | $XDG_DATA_HOME/whatsapp-mcp, or ~/.local/share/whatsapp-mcp |
| macOS | ~/Library/Application Support/whatsapp-mcp |
| Windows | %APPDATA%\whatsapp-mcp |
WHATSAPP_MCP_HOME replaces that directory. Set it to the directory itself, not to its parent. An empty value is ignored.
Messages are in whatsapp.db, a SQLite file in that directory. The file is not encrypted. On Linux and macOS the directory is readable only by your user. Anyone who can read the file can read your messages, including from a backup. config.toml and whatsapp-mcp.log live there too. Files opened from messages go in media. whatsapp-mcp config prints the path, and creates the directory if it is missing. It does not write config.toml. A missing file means the defaults.
Coming from lharries/whatsapp-mcp
lharries/whatsapp-mcp hasn't changed since April 2025. It needs Go, Python, uv, and two processes: a bridge and an MCP server.
What stays:
- The tool names in the table above, and the inputs those tools had. A prompt or a script that called
list_messagesorsend_messagethe old way still names the same fields. send_messagealso takesreply_toandmentions.send_fileandsend_audio_messagealso takeurl, andsend_filetakescaption.
What changes:
- One Rust binary. You link with
whatsapp-mcp login, and the AI app runswhatsapp-mcp. - Sending asks you to confirm, unless you allow it.
- History is imported from the phone when you run
login. This program does not read the database the old bridge kept. Link again to import into this one.
Configuration
config.toml lives in the data directory. whatsapp-mcp config prints its path and the settings in force. A missing file, or an empty one, means the defaults. A setting this program doesn't know is an error, so a typo doesn't silently do nothing.
| Field | Default | What it does |
|---|---|---|
send | "confirm" | "confirm" asks before each send. "allow" sends without asking. "off" refuses every send. |
allow_send_to | [] | Chats that skip confirmation while send is "confirm". Phone numbers or group ids. |
destructive | false | Allows deleting for everyone, removing people from a group, and leaving a group. Those still ask. |
history_days | 365 | How far back a new link asks the phone for history. A number up to 3650, or "all". |
max_sends_per_minute | 30 | Sends in a rolling minute. Values above 60 are stored as 60. |
max_sends_per_day | 1000 | Sends in a rolling day. |
send = "confirm"
allow_send_to = []
destructive = false
history_days = 365
max_sends_per_minute = 30
max_sends_per_day = 1000
history_days = "all" asks for as far back as the phone will send.
Flags override the file for the process that holds the connection. They are global, so they work before the command or after it.
| Flag | What it does |
|---|---|
--send confirm, --send allow, --send off | Overrides send. --allow-send still forces allow. |
--allow-send | Send without asking, for this process. |
--allow-destructive | Permit destructive actions. They still ask you to confirm. |
--pair-code <PHONE> | On login. Show a pairing code for this number. |
--history-days N or --history-days all | On login. How far back to ask. Defaults to history_days in the config. |
--yes | On logout. Unlink without asking. |
The holding process reads the file when it starts. Edit the file, then quit the apps and start again.
Commands
whatsapp-mcp [OPTIONS] [COMMAND]
With no command, this is the stdio MCP server an AI app runs. It connects to WhatsApp, or attaches to a copy that is already running.
| Command | What --help says |
|---|---|
whatsapp-mcp login | Link WhatsApp by scanning a QR code, or with an 8-character pairing code. |
whatsapp-mcp status | Show whether WhatsApp is linked, and the settings in force. |
whatsapp-mcp logout | Unlink this device from WhatsApp and delete the local database. |
whatsapp-mcp serve | Run until stopped, with no stdio session, and print how to background it. |
whatsapp-mcp config | Print the config file's path and the settings in force. |
whatsapp-mcp --version prints the version. --help prints the full help, and -h prints a shorter one.
login, logout and serve need the WhatsApp connection to themselves. If an app or serve already has it, they print:
whatsapp-mcp is running for an AI app or as `serve`; quit it and try again
status and config work while a copy is running.
logout asks Unlink this device from WhatsApp and delete the local database? [y/N]. Answering anything other than y or yes prints Left WhatsApp linked. and deletes nothing. --yes skips the question. A logout that is not run in a terminal has to pass --yes. If the phone can't be reached, the local database is still deleted, and whatsapp-mcp tells you to remove the device under Linked devices on the phone.
status prints the data directory, whether WhatsApp is linked and connected, the number, how many messages, chats and contacts are kept, the oldest message, whether an import is running, and the settings. After a link it also prints History requested at link. Remove the number before you paste the output into a bug report.
serve runs until you stop it, and prints how to start that in the background on this system: a user systemd service on Linux, a launch agent on macOS, or a logon task on Windows.
Always on
whatsapp-mcp runs on your computer. When the program isn't running, nothing is connected, and it doesn't schedule a message or give each agent its own permissions. For WhatsApp that stays connected around the clock, scheduled messages, and a separate permission for each agent with approvals in a web app, I run Whatomato. It uses whatsapp-core, the WhatsApp layer in this repo.
Built with
whatsapp-rust talks to WhatsApp. whatsapp-core, in this repo, is the layer whatsapp-mcp and Whatomato share: messages, history, files and sending.
Licence
whatsapp-mcp is free software under the GNU Affero General Public License, version 3 only (AGPL-3.0-only). You can read, run, change and share it. Anyone who runs a modified version as a network service must offer its users the source of that version.
https://github.com/habibium/whatsapp-mcp/releases/download/v0.1.0/whatsapp-mcp-0.1.0.mcpb# mcpb: https://github.com/habibium/whatsapp-mcp/releases/download/v0.1.0/whatsapp-mcp-0.1.0.mcpb