Skip to main content
Glama
whatsapp-export-mcp

whatsapp-export-mcp

README.md
# whatsapp-export-mcp

[![test](https://github.com/samrodrigues/whatsapp-export-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/samrodrigues/whatsapp-export-mcp/actions/workflows/test.yml) [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

An [MCP](https://modelcontextprotocol.io) server that lets **Claude, Cursor and other AI assistants read a WhatsApp chat export**. Point it at the `.zip` you get from **Export chat** and ask questions about the conversation: what was agreed, when someone said something, who sent the most voice messages, which photos are missing.

```text
You:     Open ~/Downloads/WhatsApp Chat with Ana.zip. When did we settle the moving date, and who suggested it?
Claude:  (calls open_export, then search_messages "move")
         Ana suggested Saturday the 20th on 2024-04-02 at 18:31 (#1204); you confirmed it at 18:40 (#1207).
```

- **Six tools**: summarise an export, read messages by date or sender, search (case and accents ignored), list attachments, per-person statistics, and save a file out of the export.
- **Every message line carries its index** (`#1204`), so the assistant can cite the exact message.
- **iPhone and Android exports**, `.zip` or `.txt`, including archives re-zipped by Windows. Parsing comes from [`whatsapp-export-reader`](https://github.com/samrodrigues/whatsapp-export-reader).
- **Runs on your machine.** The server makes no network requests.

> Voice messages are listed, not transcribed, so the assistant can see that a voice message was sent but not what it said. To get every voice message written out inside the conversation, as a PDF, use [Zap2Doc](https://zap2doc.com/) on the same export.

## Install

Requires Node.js 18.17 or newer. No global install needed: clients start it with `npx`.

### Claude Desktop

Settings → Developer → Edit Config, then add to `claude_desktop_config.json`:

```json
{
  "mcpServers": {
    "whatsapp-export": {
      "command": "npx",
      "args": ["-y", "whatsapp-export-mcp"]
    }
  }
}
```

Restart Claude Desktop. The tools appear under the tools icon in a new chat.

### Claude Code

```bash
claude mcp add whatsapp-export -- npx -y whatsapp-export-mcp
```

### Cursor

Add to `~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project):

```json
{
  "mcpServers": {
    "whatsapp-export": {
      "command": "npx",
      "args": ["-y", "whatsapp-export-mcp"]
    }
  }
}
```

### Any other MCP client

Run `npx -y whatsapp-export-mcp` as a stdio server.

## Tools

| Tool | What it does |
| --- | --- |
| `open_export` | Reads the export and summarises it: participants with message counts, period, attachments by kind, files the chat mentions but the export lacks, and notes about the file. |
| `get_messages` | Messages in order, filtered by date range (`from_date`, `to_date`) and/or sender, paged with `offset` and `limit`. |
| `search_messages` | Messages containing a word or phrase, ignoring case and accents, optionally from one sender. |
| `list_attachments` | Photos, voice messages, videos, documents, stickers and contact cards, with sender, time and whether the export contains them. Filter by `kind`. |
| `chat_stats` | Messages, voice messages and other attachments per person, messages per month, busiest days. |
| `save_attachment` | Copies one file (a photo, an `.opus` voice message, a PDF) out of the export into a folder. The only tool that writes to disk. |

Every tool takes `path`, the export file. A file is parsed once and kept in memory until it changes on disk, so follow-up questions are fast.

Messages come back one per line:

```text
#1204 2024-04-02 18:31 Ana Souza: What if we move on Saturday the 20th? The van is free that day
#1205 2024-04-02 18:32 Ana Souza: [voice message: PTT-20240402-WA0057.opus]
#1206 2024-04-02 18:38 Bruno Lima: [image: IMG-20240402-WA0058.jpg] the van's booking page
#1207 2024-04-02 18:40 Bruno Lima: Saturday works, booking it
```

## Things to ask

- "Summarise this chat month by month, citing message numbers."
- "Find every message where we talked about the rent, and list the dates."
- "What did Ana promise, and did she follow up later in the chat?"
- "How many voice messages did each of us send? Which ones are missing from the export?"
- "Save all the photos from March into ~/Desktop/march." (The assistant lists them, then calls `save_attachment` for each.)

## Getting the export

**iPhone:** open the chat → tap the name at the top → **Export Chat** → **With all media** (or **Without media**). **Android:** open the chat → **⋮** → **More** → **Export chat** → **Include media**.

Guides with screenshots: [iPhone](https://zap2doc.com/blog/how-to-export-whatsapp-iphone/) · [Android](https://zap2doc.com/blog/how-to-export-whatsapp-android/).

## Privacy

The server reads the file from your disk and makes no network requests. But **what the tools return goes to the AI assistant you are using**, and from there to its model provider, under that assistant's own terms. Ask about a conversation only if you are comfortable with that provider reading the parts the assistant pulls in. The assistant reads only what the tools return, so a narrow question (one month, one search) sends less than "summarise everything".

## FAQ

**Can the assistant hear the voice messages?**
No. It sees that a voice message was sent, by whom and when. To have them transcribed, save the `.opus` files with `save_attachment` and use a speech-to-text tool, or turn the export into a PDF with every voice message written out at [Zap2Doc](https://zap2doc.com/).

**Does it work with group chats?**
Yes. Notices such as "Ana added Bruno" are marked as notices, not as messages from a person.

**The dates look wrong.**
WhatsApp writes dates in the phone's regional format without saying which one. If `open_export` reports that the date order is a guess, pass `date_order: "dmy"` or `"mdy"`.

**How big an export can it handle?**
The archive is read entry by entry, and only the chat text is held in memory. Years of messages are fine. Each entry is capped at 512 MiB.

## Development

```bash
npm install
npm test        # end-to-end through an in-memory MCP client, synthetic chats only
npm run build
```

## License

MIT © Sam Rodrigues

TDQS

A3.7/5.0

Scored across 6 tools

Disambiguation4/5

Each tool has a distinct role: open_export bootstraps, get_messages reads sequentially, search_messages finds by text, chat_stats aggregates, and the two attachment tools list vs. save. Mild overlap exists between open_export's summary (participants, counts, period) and chat_stats, which could make an agent hesitate on where to get aggregate numbers, but the descriptions steer reasonably well.

Naming Consistency4/5

Five of six names follow a verb_noun snake_case pattern (open_export, get_messages, search_messages, list_attachments, save_attachment). chat_stats deviates by being noun_noun with no verb, a minor inconsistency in an otherwise predictable scheme.

Tool Count5/5

Six tools is well-scoped for a read-only chat-export analyzer: one entry point, one message reader, one search, one stats tool, and two attachment handlers. Nothing appears redundant or missing in terms of surface size.

Completeness4/5

The read-only lifecycle is covered: open, summarize, page through messages, search, list and extract attachments. Minor gaps remain, such as retrieving a single message by index directly or filtering attachments by type/sender, but agents can work around these with offset paging and client-side filtering.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues