
Whatsapp Mcp
io.github.meharajM由 GitHub 账号 meharajM 发布v2.0.1更新于 Oct 24, 2026
WhatsApp MCP Server - Human-in-the-loop for AI agents via WhatsApp
概览
WhatsApp MCP 让 AI 代理通过 WhatsApp 给你发消息并等待回复,从而在你离开电脑时请求确认或推送状态更新。
- 可以做什么
- 连接与断开 WhatsApp 会话,首次使用通过二维码登录
- 发送单向 WhatsApp 通知,可选支持 markdown 格式
- 提出问题并阻塞等待回复,并发问题会排队处理
- 轮询主动发来的入站消息,并查看连接与认证状态
- 适用场景
- 适合在 Cursor、Claude Desktop、Claude Code 等客户端中运行长时间或自主代理任务时使用,把审批、权限请求或提醒推送到手机,而不必守在 IDE 前。
- 运行要求
- 以 stdio 方式在本机运行,通常通过 npx 启动,因此 PATH 中需要有 Node.js 和 npm。需要设置 WHATSAPP_TARGET_NUMBER(默认接收方 JID),并需用手机扫描二维码关联 WhatsApp 账号,会话保存在用户主目录。可选设置 WHATSAPP_ALLOWED_NUMBERS 限制可回复的人。
安装
在 SourceWeft 中
- 打开 控制台中的 Whatsapp Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
This is an MCP (Model Context Protocol) server that enables AI agents (like Claude or Cursor) to interact directly with you via WhatsApp. It bridges the gap between your autonomous AI and your phone, allowing for runtime confirmations, permission requests, or simple status updates while you are away from your computer.
- AI agent messaging
- AI agent confirmations
- Agent interrupt system
- AI alerts
- MCP server
- Cursor MCP
- Claude Desktop MCP
- AI notifications
Perfect for
- Cursor
- Claude Desktop
- Claude Code
- OpenCode
- Codex
- Autonomous AI workflows
Example
AI: Deploy to production?
WhatsApp: [YES] [NO]
You: YES
Agent continues.
🚀 Quick Start (NPX)
Since this package is published to NPM, you can run it directly via npx in your MCP configuration.
Cursor / Claude Configuration
Add this to your MCP configuration file:
Note about Allowed Numbers:
WHATSAPP_TARGET_NUMBERis the default recipient for all messages. However, if your target is a Whatsapp Group, any member of the group would be able to answer the AI by default. To restrict replies only to specific numbers (to prevent unauthorized people from answering), you can optionally add a comma-separated list of numbers as an environment variable:"WHATSAPP_ALLOWED_NUMBERS": "[email protected],[email protected]". If set, the AI will ONLY honor responses from these specific matching users.
Troubleshooting
npx: executable file not found in $PATHorenv: node: No such file or directory: If your IDE/Agent complains it cannot findnpxornode, it's because GUI apps (like Cursor) don't inherit your terminal's$PATH. To fix this, explicitly pass yourPATHin the MCPenvconfig.
Authentication (First time only)
The very first time you use the MCP server, it needs to authenticate with WhatsApp Web:
- Call the
connecttool via your Agent, or just use any WhatsApp tool normally. If the session is not authenticated yet, the server will trigger authentication automatically. - The tool result will return the QR code image directly in MCP content so modern clients can render it inline.
- If your client does not render inline images, the server also tries to write a local fallback HTML page under
~/.whatsapp-mcp/qr.html. - Open WhatsApp on your phone -> Linked Devices -> Link a Device, and scan the QR.
- The authentication session is saved to your home directory (
~/.whatsapp-mcp/baileys_auth_info), so you don't need to scan it again across restarts.
Remote "Auto-Pilot" Workflow (Skip IDE Prompts)
To make your AI agent run fully autonomously and only ask for permissions/guidance via WhatsApp (allowing you to step away from your computer):
- Remove IDE Security Blockers: When your agent (like Cursor or Claude) asks for permission to run a command or read a file, select
Always Allow(or enable "yolo" mode in settings). This gives the agent the mechanical freedom to operate without pausing indefinitely for a UI click. - Add a
.cursorrules(or system prompt) file: You must explicitly instruct the AI to use WhatsApp whenever it reaches a logical decision point. Create a.cursorrulesfile in your project root with this exact prompt:
With these two steps, the AI will proactively proactively use the ask_question tool to beam its logical permission requests directly to your phone instead of freezing in the IDE.
Features & Tools
connect: Connects to the WhatsApp network. If not logged in, returns a native QR image in the tool result and may also provide a local HTML fallback.disconnect: Completely logs out of WhatsApp and invalidates the session credentials.send_message: Sends a one-way notification. Supports optional WhatsApp markdown mapping (*bold*). If the server is not connected yet, it auto-triggers authentication first.ask_question: Sends a prompt and blocks execution until a reply is received (with a timeout). Concurrent questions are smartly queued and tagged with references. If the server is not connected yet, it auto-triggers authentication first.get_incoming_messages: Polls unsolicited inbound WhatsApp messages so agents that do not support server-side sampling can still retrieve them.get_status: Provides agent connection state monitoring, including auth state such asconnected,connecting, orqr_pending.- Server instructions + prompt: The server exports built-in workflow instructions and a
whatsapp-autopilotprompt so clients can guide agents toward connect-first and WhatsApp-first behavior.
Local Development
If you'd like to run it locally from source:
- Clone the repository and
npm install npm run build- Link via absolute path instead of
npx.
License
This project is licensed under the ISC License.
Third-Party Licenses
This project utilizes the following open-source libraries:
- @modelcontextprotocol/sdk - MIT License
- @whiskeysockets/baileys - MIT License
- Other dependencies (express, pino, qrcode, etc.) are licensed under permissive licenses (MIT/BSD).
Discoverability keywords
- Human in the loop AI
- AI approvals
- Runtime approvals
- Agent notifications
- Agent approval workflow
- Cursor WhatsApp integration
- Claude WhatsApp integration
- Autonomous agents
- Cursor power users
- Remote workers
What problem does this solve?
- AI agents often get blocked waiting for approvals/questions when you step away from the IDE.
- WhatsApp MCP notifies you and collects confirmations from your phone so agents can continue safely.
Who it's for
- Cursor agent / Claude Desktop users
- Solo builders shipping agentic workflows
- DevOps & automation teams needing runtime approvals
来源:README.md,提交 e8629a2
工具
0版本历史
1- v2.0.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分