Hacker News AI · 2026/10/19 05:36:10

WhatsApp MCP 服务器上线,支持 AI 读取本地聊天记录

原标题:Show HN: WhatsApp MCP running free on Cloudflare
68AI 研判分
核心综述

开发者推出开源 WhatsApp MCP 服务器,允许 Claude 等 AI 客户端通过 Model Context Protocol 搜索和读取用户聊天记录。该工具部署在 Cloudflare Workers 上,采用“手机为真源、定期同步至 SQLite”的架构,仅支持只读操作以保障隐私,解决了即时通讯数据难以被智能体直接调用的痛点。

报道全文原始报道全文

本文目录6 个章节

Let your AI agent read your WhatsApp messages.

This is a small server that runs in your own Cloudflare account. You link your phone to it once, the way you'd link WhatsApp Web, and from then on any MCP client (Claude Code, Claude Desktop, anything that speaks MCP) can search and read your chats. It can read and search your messages, and remember names you give it for phone numbers. It can't send anything.

Ask your agent things like:

  • "What did Dana say about the flights?"
  • "Find every message where someone mentioned the lease, across all my chats."
  • "Summarize what I missed in the family group this week."

How it works

Your phone stays the source of truth. The server is a linked device that your agent talks to.

It doesn't stay connected to WhatsApp. When your agent asks for something, and once a day, it connects, collects whatever WhatsApp queued for it since last time, writes that to its own database, and hangs up. Your phone keeps working normally and keeps getting notifications.

Your messages live in a SQLite database inside a Durable Object in your Cloudflare account. Nothing goes anywhere else.

Set it up

You need a Cloudflare account on the Workers Paid plan (see the note below), Node 20 or later, and your phone.

SH
git clone https://github.com/finereli/whatsapp-mcp
cd whatsapp-mcp
npm install

# 1. A place for the sign-in tokens. Paste the id it prints into wrangler.jsonc.
npx wrangler kv namespace create OAUTH_KV

# 2. A password for the page that links your phone. 12+ characters.
npx wrangler secret put OWNER_PASSWORD

# 3. Deploy.
npm run deploy

Wrangler prints your URL, something like https://whatsapp-mcp.your-name.workers.dev. Open it. The front page has the two remaining steps:

  1. Link WhatsApp. Scan the QR code with WhatsApp (Settings, Linked Devices, Link a Device). If you're on the phone itself and can't scan a screen, use the phone number option instead. The first link imports your history. The page shows progress, and you can close it.
  2. Connect your agent. In Claude Code:
SH
   claude mcp add --transport http whatsapp https://your-url/mcp

Then type /mcp and sign in with the password. Other clients: point them at the same /mcp URL.

If you want your own domain, see the comments at the bottom of wrangler.jsonc.

The Workers Paid note

Importing a large history decodes a lot of data in one go, and the default CPU limit on Workers is too small for it. wrangler.jsonc raises it, and raising it needs the paid plan, which is a few dollars a month. I haven't tried the free plan. If you're on it, remove the limits block and expect the first import to be fragile.

Things to know

This isn't official. WhatsApp has no API for reading your own personal messages. This uses the same protocol WhatsApp Web uses, through an open source library (Baileys). That's against WhatsApp's terms. For a linked device that only reads, the practical risk is low, but it isn't zero. Use it on your own account, and don't use it to send messages.

You get what WhatsApp sends. The first link imports whatever history WhatsApp decides to hand a new device. It may not be everything. It only does this once per link. To import again, relink (your stored messages are kept, and a re-import fills in anything missing).

Some chats show up as phone numbers. WhatsApp doesn't give a linked device every contact name, and most of these are one-off messages from people you never saved. For the ones that matter, your agent can fix it: it lists the unnamed chats, looks the numbers up in your contacts with whatever contacts tool it already has (a Google Contacts or Gmail connector, for example), and saves the names. The server never connects to a contacts service itself. See "Naming chats" below.

Media isn't downloaded. Photos, voice notes and documents appear as labels like [image] or [voice note 12s], with the caption if there was one. Nothing is transcribed.

It's for one person. One deployment is one WhatsApp account and one owner. That's deliberate: each deployment holds a full message history and a live login to the account, so everyone should run their own.

Relinking. If your phone says the device was removed, or you want to start over, ask your agent to run relink, or open /setup and choose "Unlink and scan again". You scan a new QR code. Stored messages are kept.

What your agent can do

ToolWhat it does
list_chatsChats, most recent first. Filter by name or number.
get_messagesRead one chat. Page back or forward by date.
search_messagesFull-text search across everything, or within one chat.
unnamed_chatsChats known only by phone number, busiest first, with the last thing the other person said.
set_contact_namesSave names for phone numbers, in any format. Names stick to the number, so they also show up in groups.
sync_nowPull new messages right now.
link_statusIs it linked, when did it last pull, how much is stored.
relinkUnlink and start over. A human has to scan the new QR code.

Every read tool first tops up from WhatsApp if the stored copy is more than ten minutes old.

Naming chats

WhatsApp only gives this server the names it knows. The rest show up as phone numbers. Rather than have the server log in to a contacts service (which means a cloud project, consent screens and, for Google, an app review), it hands the job to your agent, which usually already has a way to reach your contacts.

Say "find names for my unnamed chats". The agent calls unnamed_chats, matches the numbers against your contacts, and saves what it finds with set_contact_names. It won't find everyone: most unnamed chats are a single message from a stranger.

Agents get nudged toward this on their own. The server's instructions mention it, and so does every "no chat found" and "no matches" result, because that's the moment an agent is stuck on a name. link_status also says how many chats are unnamed.


For agents, and people adapting this

Everything below is for whoever is changing the code, including an AI agent working on a fork. The top of this file is for the person who owns the deployment.

(注:更多技术实现细节与完整 API 文档请查阅原项目 README)


作者发帖说明(HN):

I wanted my humble Claude on mobile to access my WhatsApp messages but the only options I could find either required WhatsApp Business or an actual server to run Baileys on.

I wanted to run it for free on ClaudeFlare and with my personal WhatsApp account, so I built this.

Important feature - it connects to your Google account as well as WhatsApp to grab the names of all your WhatsApp contacts, otherwise you get only phone numbers for many of them and search doesn't work properly.

This is a single user install because it's both gray area and very private - so point your agent at the repo and let it set things up.