AI NewsDev toolsAnnouncement

WhatsApp MCP server runs for free on Cloudflare Workers, read-only

finereli posted whatsapp-mcp to Show HN, a read-only MCP server that lets an AI agent search and read your WhatsApp messages, with the server running inside a single Cloudflare Worker in the owner's own account.

AI News

Editorial3 min read

LinkedInX
GitHub social card for finereli/whatsapp-mcp

Image: GitHub

Why it mattersAn MCP server that fits in one Worker with one Durable Object and no outside storage lowers the bar for giving an agent read access to a messaging account, and the author shows what the hard parts of that port actually were.

A developer who posts under finereli opened a Show HN thread with a working MCP server that lets a Claude Code or Claude Desktop session read a personal WhatsApp account. The server runs inside a single Cloudflare Worker in the owner's own account, holds the messages in SQLite inside one Durable Object, and sends nothing to a third party. The repository, finereli/whatsapp-mcp, had 87 stars seven hours after it was created and 57 points on Hacker News at the time of writing.

What the server does

The README lists seven tools an agent can call. list_chats returns chats most recent first with a name or number filter, get_messages pages through one chat by date, and search_messages runs full-text search across the full history or inside one chat. unnamed_chats returns the busiest chats WhatsApp exposes only by phone number, set_contact_names saves a name for a number, and sync_now and link_status run and inspect a pull. There is no tool that sends a message. The author writes that was deliberate, since a read-only linked device is a lower risk under WhatsApp's rules than one that can send on the owner's behalf.

How it stays small

The link to WhatsApp uses Baileys, the open-source library for the same protocol WhatsApp Web speaks, so no WhatsApp Business account is involved. One Durable Object named owner holds everything: the Baileys credentials, the message rows, an FTS5 index kept in sync by triggers, and a jid-to-phone alias table that handles WhatsApp's new anonymous @lid identifiers. A cron entry runs once a day at 04:00 UTC to pull whatever WhatsApp queued since the last session, and each read tool tops up from WhatsApp if the stored copy is more than ten minutes old. The author notes the first history import needs the Cloudflare Workers Paid plan, because the default CPU limit is too small for the one-shot decode.

What the port cost

A long "what to know before changing things" section in the README is the useful part for anyone building something similar. Baileys needs three shims to run on workerd, Cloudflare's runtime: a WebSocket wrapper that opens through a fetch() with an upgrade header so the Origin header reaches WhatsApp, a vendoring step that writes the Rust bridge's wasm to a file so workerd will load it, and a polyfills.ts that adds .unref() to timers. Baileys' use of lru-cache with ttlAutopurge: true also had to be turned off, because one setTimeout per cache entry went above workerd's 10,000-timer limit on the first history sync. The pairing session outlives the HTTP request through a Durable Object alarm, which is how the import keeps going after the owner closes the page.

The author's own HN comment says that in his setup Claude connects both to the Worker and to a Google account to turn phone-number chats into names. The README gives a different account: the server never calls a contacts service, and the agent uses whatever contacts tool it already has to fill in names through set_contact_names. The two can live together, since the server is still only the storage, so a reader following the README should plan to connect their own contacts tool, which the server itself will not provide.

Source

Show HN: WhatsApp MCP running free on Cloudflare and the finereli/whatsapp-mcp repository.

This item was written by an AI system from the linked source. Reveneau is responsible for what it publishes.

Share
LinkedInX
Start a project