Zappy MCP

Zappy MCP

Enables sending, reading, and deleting WhatsApp messages through Claude Desktop and other MCP clients with granular per-chat permissions. Built on whatsapp-web.js using a headless browser to automate WhatsApp Web.

Category
访问服务器

README

zappy-mcp

WhatsApp MCP server for Claude Desktop, OpenCode, and other MCP clients. Send, read, and delete messages with granular per-chat permissions.

Built on whatsapp-web.js and the Model Context Protocol.

Table of Contents

Quick Start

git clone https://github.com/yourname/zappy-mcp.git
cd zappy-mcp
npm install
node src/index.js  # Opens browser with QR code

Scan the QR with WhatsApp (Settings > Linked Devices > Link a Device).

How It Works

This server uses whatsapp-web.js, which runs a headless Chromium browser via Puppeteer to connect to WhatsApp Web. There's no official WhatsApp API for personal accounts, so this library automates the web interface.

Authentication Flow

  1. First run: The server launches headless Chromium and opens WhatsApp Web
  2. QR code: A browser window opens showing a QR code (auto-opens on an available port)
  3. Scan: Open WhatsApp on your phone -> Settings -> Linked Devices -> Link a Device -> Scan the QR
  4. Session saved: After successful scan, session credentials are stored locally
  5. Future runs: The server reconnects automatically using saved credentials - no QR needed

Session Storage

~/.config/zappy-mcp/
  auth/           # WhatsApp session data (shared across all configs)

The auth is stored globally, so you only authenticate once per machine. Different projects can use different permission configs while sharing the same WhatsApp session.

Re-authenticating

If you need to switch accounts or fix auth issues:

rm -rf ~/.config/zappy-mcp/auth
node src/index.js  # Opens QR code again

Security Notes

  • Session data in ~/.config/zappy-mcp/auth/ grants full access to your WhatsApp - protect it like a password
  • The QR code is only shown locally in your browser, never transmitted
  • Each config file controls which chats the AI can access - use minimal permissions

MCP Setup

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "zappy-mcp": {
      "command": "node",
      "args": ["/path/to/zappy-mcp/src/index.js", "--config", "/path/to/config.json"]
    }
  }
}

OpenCode

Project-level (.mcp.json in project root):

{
  "mcpServers": {
    "zappy-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/zappy-mcp/src/index.js", "--config", ".zappy-mcp.json"]
    }
  }
}

User-level (~/.config/opencode/mcp.json):

{
  "mcpServers": {
    "zappy-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/zappy-mcp/src/index.js", "--config", "~/.config/zappy-mcp/config.json"]
    }
  }
}

Permissions

By default, no chats are allowed. The AI cannot send, read, or delete messages until you explicitly grant access. This is a safety feature - you control exactly which conversations the AI can interact with.

Finding Chat IDs

First, connect WhatsApp and use the list_chats tool to discover your chat IDs:

list_chats()              # All chats
list_chats(groupsOnly: true)   # Only groups

Chat IDs look like:

  • Groups: 120363295812730408@g.us
  • Contacts: 14155551234@c.us (country code + phone number)

Config File

Create a config file (e.g., .zappy-mcp.json) with the chats you want to allow:

{
  "allowed": [
    {
      "id": "120363295812730408@g.us",
      "name": "Work Group",
      "canSend": true,
      "canRead": true,
      "canDelete": false
    },
    {
      "id": "14155551234@c.us",
      "name": "Alice",
      "canSend": true,
      "canRead": true,
      "canDelete": true
    }
  ]
}

Permission Options

Field Description Default
id Chat ID from list_chats (required) -
name Human-readable label for your reference -
canSend Allow AI to send messages to this chat true
canRead Allow AI to read messages from this chat true
canDelete Allow AI to delete its own messages (safety: off by default) false

Example Use Cases

Scenario canSend canRead canDelete
Full access true true true
Announcements only (no reading) true false false
Monitoring only (no sending) false true false
Send with ability to unsend mistakes true true true

Global Options

At the root level of your config:

{
  "suppressWarnings": true,
  "allowed": [...]
}
Option Description
suppressWarnings Hide "no recipients configured" warnings at startup

Tools

Status & Discovery

Tool Description
get_status Check WhatsApp connection status, shows config path and auth location
list_allowed Show all permitted chats with their current permissions
list_chats List all WhatsApp chats with IDs - use this to find chat IDs for setup

Messaging

send_message

Send a message to a chat. Requires canSend permission.

Parameter Description
to Chat ID (from list_chats) or phone number with country code
message Text content to send

get_messages

Fetch recent messages from a chat. Requires canRead permission.

Parameter Description
chatId Chat ID or phone number
limit Number of messages to fetch (default: 20)

delete_message

Delete a message you sent. Requires canDelete permission. Only works on messages where fromMe: true.

Parameter Description
chatId Chat ID where the message exists
messageId Message ID (get this from get_messages response)
forEveryone If true, deletes for all participants. If false, only hides it for you. (default: true)

Troubleshooting

Messages not delivering

The WhatsApp client needs about 5 seconds after connecting to sync with the server. This is handled automatically, but if messages stay stuck in "pending" state, try restarting the MCP server.

Session/auth issues

If you're having trouble connecting, try clearing the auth data and scanning the QR code again:

rm -rf ~/.config/zappy-mcp/auth
node src/index.js

Linux: Puppeteer/Chromium dependencies

whatsapp-web.js uses Puppeteer to run headless Chromium. On Linux, you may need to install system dependencies:

sudo apt-get install -y libgbm-dev libasound2 libatk1.0-0 libcups2 libxss1 libnss3 libgtk-3-0

Account restrictions

WhatsApp does not officially support automation or bots on personal accounts. Excessive or abusive use may result in temporary or permanent account restrictions. Use responsibly and respect rate limits.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选