WhatsApp MCP for macOS
适用于 macOS 的 WhatsApp MCP
一个将 Claude 连接到你的 WhatsApp 的 模型上下文协议 (Model Context Protocol) 服务器。通过自然对话即可读取消息、搜索联系人、发送回复。
功能
搜索联系人 — 通过姓名或电话号码查找任何人
读取消息 — 获取带有日期过滤和搜索功能的聊天记录
列出聊天 — 查看带有未读计数的近期对话
发送消息 — 直接通过 Claude 回复(需 QR 码验证)
实时接收 — 在消息到达时获取通知
Related MCP server: whatsapp-mcp
要求
macOS,且已安装并登录 WhatsApp 桌面版应用
Python 3.10+
Node.js 18+(用于发送消息)
安装
使用 pip
pip install whatsapp-mcp-macos从源码安装
git clone https://github.com/kalki-kgp/whatsapp-mcp.git
cd whatsapp-mcp
pip install -e .连接到 Claude Desktop
打开配置文件:
open ~/Library/Application\ Support/Claude/claude_desktop_config.json如果文件不存在,请创建它。
添加 WhatsApp MCP 服务器:
{ "mcpServers": { "whatsapp": { "command": "python3", "args": ["-m", "whatsapp_mcp"] } } }重启 Claude Desktop(Cmd+Q,然后重新打开)
在聊天输入框中查找 MCP 工具图标 (🔨) — 点击它以验证是否列出了 "whatsapp"
开始聊天:
"Show my recent WhatsApp chats" (显示我最近的 WhatsApp 聊天)
"Search messages for dinner plans" (搜索关于晚餐计划的消息)
连接到 Cursor
添加到项目中 .cursor/mcp.json:
{
"mcpServers": {
"whatsapp": {
"command": "python3",
"args": ["-m", "whatsapp_mcp"]
}
}
}重启 Cursor 并在 AI 聊天中使用 WhatsApp 工具。
使用方法
读取消息(立即生效)
只需询问 Claude:
"Show my recent WhatsApp chats" (显示我最近的 WhatsApp 聊天)
"Search for messages about dinner" (搜索关于晚餐的消息)
"What did John say yesterday?" (John 昨天说了什么?)
"Catch me up on unread messages" (帮我查看未读消息)
发送消息(需要桥接)
启动 WhatsApp 桥接:
cd bridge && npm install && npm start让 Claude 检查连接:
"Check WhatsApp status" (检查 WhatsApp 状态)
如果显示 QR 码,请在浏览器中打开数据 URL 并用手机扫描
连接后,你可以发送:
"Send a message to Mom saying I'll be late" (给妈妈发消息说我会迟到)
"Reply to John with 'sounds good'" (回复 John 说 'sounds good')
工具
工具 | 描述 | 需要桥接 |
| 检查连接,必要时获取 QR 码 | 否 |
| 按姓名/电话搜索联系人 | 否 |
| 列出近期对话 | 否 |
| 获取聊天中的消息 | 否 |
| 在所有聊天中搜索 | 否 |
| 获取未读消息摘要 | 否 |
| 发送消息 | 是 |
| 获取实时传入消息 | 是 |
工作原理
Claude ──MCP──▶ WhatsApp MCP Server
│
├──▶ Local SQLite DBs (read messages)
│ ~/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/
│
└──▶ WhatsApp Bridge (:3010) ──▶ WhatsApp Web
(for sending)读取操作直接查询本地 WhatsApp 数据库 — 速度快且可离线工作。
发送操作通过桥接程序进行,该程序使用 Baileys 连接到 WhatsApp Web。
开发
# Clone
git clone https://github.com/kalki-kgp/whatsapp-mcp.git
cd whatsapp-mcp
# Install in dev mode
pip install -e ".[dev]"
# Run server
python -m whatsapp_mcp隐私
所有数据保留在本地 — 消息是从你自己的 WhatsApp 数据库中读取的
不会向外部服务器发送任何数据(发送时连接 WhatsApp Web 除外)
MCP 服务器在你的机器上本地运行
许可证
MIT
Available Tools
8 toolswhatsapp_get_messagesARead-only
Get messages from a specific WhatsApp chat.
Args: chat_jid: JID of the chat (from whatsapp_search_contacts or whatsapp_list_chats). after: Only messages after this datetime (ISO 8601). Defaults to 24h ago. before: Only messages before this datetime (ISO 8601). Defaults to now. limit: Max messages to return (max 200). search_text: Optional text to filter messages.
Inputs: chat_jid (required), after, limit, before, +1 more. Returns: result
whatsapp_incomingARead-only
Get recent incoming WhatsApp messages from the live connection.
These are real-time messages, not from the local database. Useful for checking new messages that just arrived.
Args: since_minutes: Look back N minutes (default 5, max 60).
Inputs: since_minutes. Returns: result
whatsapp_list_chatsARead-only
List recent WhatsApp chats ordered by last message time.
Args: limit: Number of chats to return (max 50). chat_type: Filter by 'dm', 'group', or 'all'.
Inputs: limit, chat_type. Returns: result
whatsapp_search_contactsARead-only
Search WhatsApp contacts by name or phone number.
Returns matching contacts with their JID, display name, and phone number. Use this to find a contact before reading their messages or sending them a message.
Args: query: Name or phone number to search for (partial match supported).
Inputs: query (required). Returns: result
whatsapp_search_messagesARead-only
Search for messages containing specific text across all chats.
Args: query: Text to search for (case-insensitive). chat_jid: Optional - restrict search to a specific chat. limit: Max results (max 50).
Inputs: query (required), limit, chat_jid. Returns: result
whatsapp_sendA
Send a WhatsApp message.
IMPORTANT:
First use whatsapp_status to ensure WhatsApp is connected.
Use whatsapp_search_contacts to get the correct JID.
Always confirm with the user before sending.
Args: recipient_jid: The JID from whatsapp_search_contacts. message: The text message to send.
Inputs: message (required), recipient_jid (required). Returns: result
whatsapp_statusARead-only
Check WhatsApp connection status.
Returns current status: 'connected', 'qr_pending', 'disconnected', or 'bridge_offline'. If QR code is needed, returns a data URL you can open in a browser to scan.
Call this before sending messages to ensure WhatsApp is connected.
Inputs: no named parameters. Returns: result
whatsapp_unreadARead-only
Get a summary of all unread WhatsApp messages.
Returns chats with unread messages and recent message previews. Great for "catch me up" or "what did I miss" requests.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have distinct purposes, but whatsapp_get_messages and whatsapp_search_messages could cause confusion as both retrieve messages with text filtering. whatsapp_get_messages focuses on a specific chat with time filters, while whatsapp_search_messages searches across all chats, but the overlap in functionality might lead to misselection by agents.
All tools follow a consistent 'whatsapp_verb_noun' pattern with snake_case throughout. The naming is predictable and clear, making it easy for agents to understand the action and target resource without ambiguity.
With 8 tools, this server is well-scoped for managing WhatsApp interactions on macOS. It covers essential operations like checking status, listing chats, searching contacts, retrieving messages, and sending messages, which is appropriate for the domain without being overly complex or sparse.
The toolset provides good coverage for core WhatsApp workflows, including status checks, contact search, message retrieval, and sending. However, there are minor gaps such as the inability to delete messages or manage group settings, which agents might need to work around, but the surface supports most common use cases effectively.
Maintenance
Related MCP Connectors
Your own WhatsApp in Claude and ChatGPT: read chats, draft replies, send messages you approve.
Your own WhatsApp in Claude, ChatGPT and other AI apps. Not affiliated with WhatsApp or Meta.
WhatsApp for Claude, ChatGPT or any AI agent: search, reply and send. Personal or Business API.
Let Claude or ChatGPT search, read and send your WhatsApp messages over MCP. OAuth sign-in.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables Claude to interact with WhatsApp: read chats, search messages, send messages with a mandatory confirmation step, and transcribe voice notes locally, all with encrypted storage and prompt-injection scrubbing.9MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to read, search, and reply to your personal WhatsApp messages by linking as an extra device, with support for chat history, full-text search, media downloads, and sending messages or files.MIT
- AlicenseAqualityBmaintenanceEnables Claude Desktop to read, search, send, and broadcast WhatsApp messages and files, and manage groups and communities through a linked personal WhatsApp account.221MIT
- AlicenseAqualityBmaintenanceEnables Claude to read WhatsApp Desktop chats on a Mac, including messages, images, documents, and locally transcribed audio, through a local MCP server. Everything runs on the Mac with read-only access and no messages sent.64MIT