WhatsApp MCP
Human-in-the-loop approvals and notifications for AI agents via WhatsApp. Enables Cursor, Claude Code, and autonomous AI agents to reach users away from their computers.
README
<div align="center"> <img src="assets/logo.png" width="160" alt="WhatsApp MCP Logo"> <h1>WhatsApp MCP</h1> <p><b>Human-in-the-Loop for AI Agents via WhatsApp</b></p>
<br/>
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:
{
"mcpServers": {
"whatsapp-mcp": {
"command": "npx",
"args": [
"-y",
"@mhrj/whatsapp-mcp"
],
"env": {
"WHATSAPP_TARGET_NUMBER": "1234567890@s.whatsapp.net"
}
}
}
}
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": "123@s.whatsapp.net,456@s.whatsapp.net". 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."env": { "PATH": "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin", "WHATSAPP_TARGET_NUMBER": "1234567890@s.whatsapp.net" }
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:
# Human-in-the-Loop via WhatsApp
You 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 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
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。