wa-web-mcp
MCP server that lets Claude read and send WhatsApp messages using a genuine WhatsApp Web client behind a code-enforced human-behavior middleware for safety.
README
wa-web-mcp
MCP server that lets Claude read and send WhatsApp for your team's personal number, driving the genuine WhatsApp Web client (via WPPConnect) behind a code-enforced human-behavior middleware.
Setup / template note: this is a shareable copy with infrastructure specifics replaced by placeholders —
YOUR_TAILNET_IP,your-host,your-tailnet.ts.net, unix useryouruser, bundle idcom.example.wa-web-mcp. Search-and-replace those (or drive them viaWA_WEB_URL/ env) for your own host before deploying. Config lives inconfig.sample.json(copy toconfig.json); nothing sensitive ships in the repo.
Built after two WhatsApp restrictions from an unofficial whatsmeow bridge. Two principles (see SPEC.md):
- Real client, not forged. WPPConnect runs actual WhatsApp Web, so the on-sight fingerprint ban vector that killed the whatsmeow bridge is closed.
- Guards in code, not in the prompt. Every limit is service-side middleware the model cannot talk past.
Status
| Layer | State |
|---|---|
| Human-behavior middleware (all gates, reciprocity governor, warm-up) | built + unit-tested (38 tests) |
| WPPConnect client wrapper, outbound ritual executor | built, compiles; runtime-validated on the host |
| MCP HTTP server + tools + override header | built, compiles; runtime-validated on the host |
| Deploy (m2 LaunchDaemon) | artifacts ready in deploy/; needs SSH + one QR scan |
The safety-critical core is proven with deterministic tests. The WPPConnect + MCP-transport glue compiles and follows the verified v2.2.1 / SDK 1.29 APIs, but end-to-end behavior is validated on first deploy (needs a browser + a linked session + a live MCP client — none reproducible in CI here).
Layout
src/
config.ts defaults (SPEC §6) + JSON override loader; dryRun starts TRUE
core/ clock (injectable), logger (decision log), tz helpers
state/db.ts SQLite: messages, new_contact_log (reciprocity), kv singletons
middleware/
ratelimit.ts interval + hourly + usync (peek/commit)
text.ts normalize + token-set-Jaccard similarity (dedup)
pipeline.ts the 9 gates + reciprocity governor + warm-up ramp + health
wa/
jids.ts @c.us / @g.us normalisation
client.ts WPPConnect wrapper: send/read/typing/presence + inbound/ack events
outbound.ts dry-run + serialised read→type→send ritual
mcp/server.ts tools + Streamable HTTP transport (bearer) + override header
index.ts wiring
Run locally (dry-run, no send)
npm install # local: set PUPPETEER_SKIP_DOWNLOAD=true (browser only needed on the host that links)
npm run build
npm test # 38 unit tests
Deploy (m2)
rsyncthis repo tom2:~/wa-web-mcp/(exclude node_modules/dist/store).- Put
deploy/token.txt(a bearer, e.g.openssl rand -hex 32) andconfig.json(fromconfig.sample.json) in place. ssh -t m2 "bash ~/wa-web-mcp/deploy/install-m2.sh"— installs deps (incl. Chromium), builds, starts the LaunchDaemon.tail -f ~/wa-web-mcp/store/daemon.log, scan the QR once.- Watch decisions in dry-run. When satisfied, set
config.jsondryRun:falseand re-run the installer. Reads/warm replies first; new-contact outreach ramps from 2/day.
Point Claude Code at http://YOUR_TAILNET_IP:8765/mcp with the bearer.
Safety controls
dryRun(config): evaluate + log, never send. Default true.halt_outbound/resume_outboundtools: persisted kill switch, never bypassable.X-Rate-Limit-Overrideheader: operator bypass of pacing gates (not kill switch, not dedup). LLM cannot set it.get_send_healthtool: live posture (caps, reply rate, warm-up, cooldown).
Sending a local file — from any Claude Code machine
Text sends are just the send_message tool. Sending a local file needs the
bytes to reach the daemon first, so bin/wa-send-file does upload (POST /media) + send_file in one shot, entirely over the daemon's HTTP endpoint
(no scp/SSH). Every send still passes the full server-side pipeline.
wa-send-file <local-file> <recipient> [caption]
recipient is a chat id — E.164 digits, <digits>@c.us, <id>@lid, or a
<id>@g.us group. Resolve a contact name to its id with the list_chats
tool first. A bare number only works if a chat already exists (WPPConnect's
sendFile returns "Chat not found" for a number with no chat — see Limitations).
Set up a new machine (any Mac on the tailnet with Claude Code):
# 1. put the script on PATH
install -m 0755 bin/wa-send-file /usr/local/bin/wa-send-file
# 2. drop the bearer token where the script looks for it
mkdir -p ~/.config/wa-web && printf '%s' '<TOKEN>' > ~/.config/wa-web/token && chmod 600 ~/.config/wa-web/token
Token lookup order: WA_WEB_TOKEN env → ~/.config/wa-web/token →
./deploy/token.txt. Base URL override: WA_WEB_URL. Operator bypass for one
call: WA_WEB_OVERRIDE=1. Exit codes: 0 sent, 3 held by a gate, 1 error.
The controls are the same everywhere because they live in the one daemon — every machine is a thin client of it. Don't run a second daemon/linked device.
Limitations / follow-ups
- First-contact to a brand-new number fails "Chat not found." WPPConnect
won't
sendFile/sendTextto a number with no existing chat. Sends to existing contacts (by their@c.us/@lidchat id) work. A fix (resolve viacheckNumberStatusand open the chat first) is needed for cold vendor outreach. list_chatsreturns full WPPConnect chat objects (large — can exceed a tool-output budget). Should be slimmed to{id, name, isGroup}server-side.- Staged uploads accumulate under
store/uploads/; add a TTL sweep.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。