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

已验证STDIO仅桌面效率与工作流沟通与协作

概览

AI 生成的概览

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 限制可回复的人。
安装前请注意
该服务器会关联你的个人 WhatsApp 账号,并把会话凭据保存在本地磁盘;断开连接会登出并使凭据失效。消息与提问都经由 WhatsApp 传输。在群聊中,除非设置 WHATSAPP_ALLOWED_NUMBERS,否则任何成员都能回复。README 建议开启 always allow 或 yolo 模式让代理无人值守运行,这会取消 IDE 的审批提示,只剩 WhatsApp 一道确认关卡。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Whatsapp Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[WhatsApp MCP Logo]

WhatsApp MCP

Human-in-the-Loop for AI Agents via WhatsApp

[npm version] [License: ISC] [MCP] [Smithery]


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:

json
{  "mcpServers": {    "whatsapp-mcp": {      "command": "npx",      "args": [        "-y",        "@mhrj/whatsapp-mcp"      ],      "env": {        "WHATSAPP_TARGET_NUMBER": "[email protected]"      }    }  }}

Note about Allowed Numbers: WHATSAPP_TARGET_NUMBER is 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 $PATH or env: node: No such file or directory: If your IDE/Agent complains it cannot find npx or node, it's because GUI apps (like Cursor) don't inherit your terminal's $PATH. To fix this, explicitly pass your PATH in the MCP env config.

json
      "env": {        "PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin",        "WHATSAPP_TARGET_NUMBER": "[email protected]"      }

Authentication (First time only)

The very first time you use the MCP server, it needs to authenticate with WhatsApp Web:

  1. Call the connect tool via your Agent, or just use any WhatsApp tool normally. If the session is not authenticated yet, the server will trigger authentication automatically.
  2. The tool result will return the QR code image directly in MCP content so modern clients can render it inline.
  3. If your client does not render inline images, the server also tries to write a local fallback HTML page under ~/.whatsapp-mcp/qr.html.
  4. Open WhatsApp on your phone -> Linked Devices -> Link a Device, and scan the QR.
  5. 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):

  1. 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.
  2. 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 .cursorrules file in your project root with this exact prompt:
markdown
# Human-in-the-Loop via WhatsAppYou are connected to the user via the `whatsapp-mcp` server. Whenever you are about to make significant/destructive changes, run a deployment, or whenever you need the user's permission/opinion to proceed with a plan, you MUST use the `ask_question` tool to ask the user on WhatsApp. DO NOT simply ask for confirmation in the IDE chat interface. You must wait for the `ask_question` tool to return the user's WhatsApp reply before proceeding with your task.

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 as connected, connecting, or qr_pending.
  • Server instructions + prompt: The server exports built-in workflow instructions and a whatsapp-autopilot prompt so clients can guide agents toward connect-first and WhatsApp-first behavior.

Local Development

If you'd like to run it locally from source:

  1. Clone the repository and npm install
  2. npm run build
  3. 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:


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
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v2.0.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分