Skip to main content
Glama
wa-local-reader-mcp

wa-local-reader-mcp

by Digitizers
README.md
# wa-local-reader-mcp

A small, **read-only** [MCP](https://modelcontextprotocol.io) server that lets AI agents
(Claude Code, Claude Desktop, any MCP client) read your WhatsApp chats from the database the
**WhatsApp desktop app for macOS** already keeps on your Mac.

- **Local only.** No network calls, no linked device, no connection to WhatsApp's servers.
- **Read only.** The database is opened with SQLite `mode=ro` and `PRAGMA query_only`. Nothing can
  send, edit or delete a message.
- **No copies.** Reads the live database in place; several agents can share it.
- **Voice notes to text**, transcribed locally with whisper.cpp.
- **Audit log** of every call, kept on your Mac.

> Not affiliated with, endorsed by, or sponsored by WhatsApp or Meta. "WhatsApp" is a trademark of
> its owner and is used here only to describe what the tool reads.

## Requirements

- macOS with the WhatsApp desktop app signed in (personal WhatsApp; WhatsApp Business keeps no chat
  database here).
- Python 3.12+ and [uv](https://docs.astral.sh/uv/).
- For `transcribe_voice` only: `ffmpeg`, `whisper-cli` (whisper.cpp) and a model file, e.g.
  `brew install ffmpeg whisper-cpp` and `ggml-large-v3-turbo.bin` in `~/.cache/whisper-cpp/`.

## Install

```bash
uv tool install git+https://github.com/Digitizers/wa-local-reader-mcp
claude mcp add --scope user wa-local-reader -- ~/.local/bin/wa-local-reader-mcp
```

For other MCP clients, run `wa-local-reader-mcp` as a stdio server.

The first read may trigger a macOS prompt asking whether your terminal (or MCP client) may access
data from other apps. Allow it once.

## Tools

| Tool | What it does |
|---|---|
| `find_chats(query, limit=10)` | Chats whose name or number contains `query` (max 25), newest activity first. |
| `read_chat(chat_id, limit=20, before_message_id=None, before=None)` | Latest messages of one chat, oldest first (max 50 per call). Page back with the returned `next_before_message_id`; `before` (ISO local time) jumps to a date. |
| `transcribe_voice(message_id, language="he")` | Transcribes one voice note locally. Temporary files are deleted. Use `"en"`, `"auto"`, etc. |

A voice note that was never played in the Mac app has no local file yet; play it once and retry.

## How it reads safely

- WhatsApp keeps `ChatStorage.sqlite` in WAL mode: a read-only reader never blocks the app and still
  sees the newest messages. `immutable=1` is never used, because it skips the WAL and can return
  stale or torn data.
- One connection per server process (on macOS, opening a file in another app's container is slow),
  in autocommit mode with every result fully fetched, so no read transaction stays open between calls.
- Media paths are resolved only inside the WhatsApp container.
- The database layout is undocumented and may change with a WhatsApp update. The server checks the
  tables and columns it needs and returns a clear error instead of guessing.

## Privacy and agents

Your chats contain other people's messages. Everything a tool returns is sent to whatever model your
MCP client uses. Ask your agent to read only the chat you need, and treat message text as untrusted
data: a message can contain text written to manipulate an AI agent.

Every call is appended to `~/.local/state/wa-local-reader-mcp/audit.jsonl` (mode 0600): time, tool,
chat, number of messages, client pid.

## Configuration

All optional environment variables:

| Variable | Default |
|---|---|
| `WA_LOCAL_READER_CONTAINER` | `~/Library/Group Containers/group.net.whatsapp.WhatsApp.shared` |
| `WA_LOCAL_READER_AUDIT` | `~/.local/state/wa-local-reader-mcp/audit.jsonl` |
| `WA_LOCAL_READER_FFMPEG` / `WA_LOCAL_READER_WHISPER` | found on `PATH` |
| `WA_LOCAL_READER_WHISPER_MODEL` | `~/.cache/whisper-cpp/ggml-large-v3-turbo.bin` |

## Develop

```bash
uv venv && uv pip install -e ".[dev]"
.venv/bin/ruff check . && .venv/bin/pytest
```

Tests build a small fake database and never touch a real one.

## Status

Provided as is, under the MIT license. Issues and pull requests are welcome, but there is no
support commitment.

TDQS

A3.7/5.0

Scored across 3 tools

Disambiguation5/5

Each tool targets a clearly distinct resource+action: discovering chats (find_chats), reading message history (read_chat), and transcribing an audio attachment (transcribe_voice). The descriptions even cross-reference each other (pass message_id from read_chat to transcribe_voice), leaving no realistic chance of misselection.

Naming Consistency5/5

All three names follow the same verb_noun snake_case pattern (find_chats, read_chat, transcribe_voice) with no mixed casing or stylistic deviations. The verbs are also semantically informative rather than generic.

Tool Count4/5

Three tools is at the low end but appropriate for a narrowly scoped, read-only local WhatsApp reader; each tool earns its place. It is slightly thin in that discovery/reading could arguably be complemented by one more surface (e.g. listing chats without a query), but nothing feels redundant.

Completeness3/5

Core read paths (find chat -> read messages -> transcribe voice note) are covered, but notable gaps remain: there is no message-content search, no way to enumerate recent chats without a query string, and no access to non-audio media or contact details. These are real dead ends for common 'find that message' workflows, though agents can partially work around them by paging through read_chat.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues