$git clone https://github.com/lharries/whatsapp-mcpThis is a Model Context Protocol (MCP) server for WhatsApp.
| 1 | # WhatsApp MCP Server |
| 2 | |
| 3 | This is a Model Context Protocol (MCP) server for WhatsApp. |
| 4 | |
| 5 | With this you can search and read your personal Whatsapp messages (including images, videos, documents, and audio messages), search your contacts and send messages to either individuals or groups. You can also send media files including images, videos, documents, and audio messages. |
| 6 | |
| 7 | It connects to your **personal WhatsApp account** directly via the Whatsapp web multidevice API (using the [whatsmeow](https://github.com/tulir/whatsmeow) library). All your messages are stored locally in a SQLite database and only sent to an LLM (such as Claude) when the agent accesses them through tools (which you control). |
| 8 | |
| 9 | Here's an example of what you can do when it's connected to Claude. |
| 10 | |
| 11 |  |
| 12 | |
| 13 | > To get updates on this and other projects I work on [enter your email here](https://docs.google.com/forms/d/1rTF9wMBTN0vPfzWuQa2BjfGKdKIpTbyeKxhPMcEzgyI/preview) |
| 14 | |
| 15 | > *Caution:* as with many MCP servers, the WhatsApp MCP is subject to [the lethal trifecta](https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/). This means that project injection could lead to private data exfiltration. |
| 16 | |
| 17 | ## Installation |
| 18 | |
| 19 | ### Prerequisites |
| 20 | |
| 21 | - Go |
| 22 | - Python 3.6+ |
| 23 | - Anthropic Claude Desktop app (or Cursor) |
| 24 | - UV (Python package manager), install with `curl -LsSf https://astral.sh/uv/install.sh | sh` |
| 25 | - FFmpeg (_optional_) - Only needed for audio messages. If you want to send audio files as playable WhatsApp voice messages, they must be in `.ogg` Opus format. With FFmpeg installed, the MCP server will automatically convert non-Opus audio files. Without FFmpeg, you can still send raw audio files using the `send_file` tool. |
| 26 | |
| 27 | ### Steps |
| 28 | |
| 29 | 1. **Clone this repository** |
| 30 | |
| 31 | ```bash |
| 32 | git clone https://github.com/lharries/whatsapp-mcp.git |
| 33 | cd whatsapp-mcp |
| 34 | ``` |
| 35 | |
| 36 | 2. **Run the WhatsApp bridge** |
| 37 | |
| 38 | Navigate to the whatsapp-bridge directory and run the Go application: |
| 39 | |
| 40 | ```bash |
| 41 | cd whatsapp-bridge |
| 42 | go run main.go |
| 43 | ``` |
| 44 | |
| 45 | The first time you run it, you will be prompted to scan a QR code. Scan the QR code with your WhatsApp mobile app to authenticate. |
| 46 | |
| 47 | After approximately 20 days, you will might need to re-authenticate. |
| 48 | |
| 49 | 3. **Connect to the MCP server** |
| 50 | |
| 51 | Copy the below json with the appropriate {{PATH}} values: |
| 52 | |
| 53 | ```json |
| 54 | { |
| 55 | "mcpServers": { |
| 56 | "whatsapp": { |
| 57 | "command": "{{PATH_TO_UV}}", // Run `which uv` and place the output here |
| 58 | "args": [ |
| 59 | "--directory", |
| 60 | "{{PATH_TO_SRC}}/whatsapp-mcp/whatsapp-mcp-server", // cd into the repo, run `pwd` and enter the output here + "/whatsapp-mcp-server" |
| 61 | "run", |
| 62 | "main.py" |
| 63 | ] |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | ``` |
| 68 | |
| 69 | For **Claude**, save this as `claude_desktop_config.json` in your Claude Desktop configuration directory at: |
| 70 | |
| 71 | ``` |
| 72 | ~/Library/Application Support/Claude/claude_desktop_config.json |
| 73 | ``` |
| 74 | |
| 75 | For **Cursor**, save this as `mcp.json` in your Cursor configuration directory at: |
| 76 | |
| 77 | ``` |
| 78 | ~/.cursor/mcp.json |
| 79 | ``` |
| 80 | |
| 81 | 4. **Restart Claude Desktop / Cursor** |
| 82 | |
| 83 | Open Claude Desktop and you should now see WhatsApp as an available integration. |
| 84 | |
| 85 | Or restart Cursor. |
| 86 | |
| 87 | ### Windows Compatibility |
| 88 | |
| 89 | If you're running this project on Windows, be aware that `go-sqlite3` requires **CGO to be enabled** in order to compile and work properly. By default, **CGO is disabled on Windows**, so you need to explicitly enable it and have a C compiler installed. |
| 90 | |
| 91 | #### Steps to get it working: |
| 92 | |
| 93 | 1. **Install a C compiler** |
| 94 | We recommend using [MSYS2](https://www.msys2.org/) to install a C compiler for Windows. After installing MSYS2, make sure to add the `ucrt64\bin` folder to your `PATH`. |
| 95 | → A step-by-step guide is available [here](https://code.visualstudio.com/docs/cpp/config-mingw). |
| 96 | |
| 97 | 2. **Enable CGO and run the app** |
| 98 | |
| 99 | ```bash |
| 100 | cd whatsapp-bridge |
| 101 | go env -w CGO_ENABLED=1 |
| 102 | go run main.go |
| 103 | ``` |
| 104 | |
| 105 | Without this setup, you'll likely run into errors like: |
| 106 | |
| 107 | > `Bin |