Repository avatar
AI Tools
v0.1.1
active

whatsapp-export-mcp

io.github.samrodrigues/whatsapp-export-mcp

Lets Claude, Cursor and other AI assistants read a WhatsApp chat export, locally.

Documentation

whatsapp-export-mcp

test license: MIT npm

samrodrigues/whatsapp-export-mcp MCP server

An MCP 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.

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.
  • 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 on the same export.

Install

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

Claude Desktop

One click: download whatsapp-export-mcp.mcpb and open it (or drag it onto Settings → Extensions), then click Install. Claude Desktop runs it with its own Node.js, so nothing else needs installing.

Or by hand: Settings → Developer → Edit Config, then add to claude_desktop_config.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

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

Cursor

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

{
  "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

ToolWhat it does
open_exportReads 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_messagesMessages in order, filtered by date range (from_date, to_date) and/or sender, paged with offset and limit.
search_messagesMessages containing a word or phrase, ignoring case and accents, optionally from one sender.
list_attachmentsPhotos, voice messages, videos, documents, stickers and contact cards, with sender, time and whether the export contains them. Filter by kind.
chat_statsMessages, voice messages and other attachments per person, messages per month, busiest days.
save_attachmentCopies 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:

#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 · 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.

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

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

Related

License

MIT © Sam Rodrigues

NPM
whatsapp-export-mcp
Install Command
npm install whatsapp-export-mcp