WhatsApp MCP Server

WhatsApp MCP Server

A self-hosted Model Context Protocol (MCP) server that bridges WhatsApp Web to Poke via Server-Sent Events (SSE).

Category
访问服务器

README

WhatsApp MCP Server for Poke

A self-hosted Model Context Protocol (MCP) server that bridges WhatsApp Web to Poke via Server-Sent Events (SSE).


Architecture

WhatsApp Web  ──(Puppeteer)──▶  whatsapp-web.js
                                      │
                                 WhatsAppManager
                                      │
                              MCP Tools (4 tools)
                                      │
                            Express SSE Transport
                                      │
                              http://localhost:3000/sse
                                      │
                                  ◀── Poke ──▶

Stack: Node.js · TypeScript · @modelcontextprotocol/sdk · whatsapp-web.js · Puppeteer · Docker


Quick Start

1. Clone and build

git clone <your-repo>
cd whatsapp-mcp-server
docker compose up --build

2. Scan the QR code

Watch the container logs for a terminal QR code:

docker compose logs -f

Open WhatsApp on your phone → Linked DevicesLink a Device → scan the QR.

The session is saved in a Docker volume (whatsapp_session) and persists across restarts.

3. Verify the server is ready

curl http://localhost:3000/health
# {"status":"ok","whatsapp":{"ready":true,"qrPending":false}}

4. Register in Poke

  1. Go to https://poke.com/integrations/new

  2. Choose MCP / SSE integration

  3. Enter the SSE URL:

    http://<your-server-ip>:3000/sse
    
  4. Save. Poke will open the SSE stream and discover all four tools automatically.


MCP Tools

Tool Description Inputs
read_chats List recent chats contact_name? (string), limit? (1–100, default 20)
send_message Send a message recipient_id (string), message_body (string)
search_messages Search message bodies query (string)
list_contacts All contacts with IDs (none)

Recipient ID format

send_message accepts either:

  • Full serialized ID: 923001234567@c.us
  • Plain international number: 923001234567

Endpoints

Endpoint Method Purpose
/health GET Liveness check + WA status
/qr GET Returns QR as JSON (for custom UIs)
/sse GET SSE stream — register this in Poke
/messages?sessionId= POST MCP message endpoint (used by SDK)

Configuration

Set via environment variables or edit docker-compose.yml:

Variable Default Description
PORT 3000 HTTP port
SESSION_PATH /app/session WhatsApp session storage path
NODE_ENV production Node environment

Session Persistence

The WhatsApp session is stored in a named Docker volume:

volumes:
  whatsapp_session:
    driver: local

To back it up:

docker run --rm \
  -v whatsapp-mcp-server_whatsapp_session:/data \
  -v $(pwd):/backup \
  alpine tar czf /backup/session-backup.tar.gz -C /data .

To restore:

docker run --rm \
  -v whatsapp-mcp-server_whatsapp_session:/data \
  -v $(pwd):/backup \
  alpine tar xzf /backup/session-backup.tar.gz -C /data

Production Tips

  • Reverse proxy: Put Nginx/Caddy in front with HTTPS so Poke connects over https://yourdomain.com/sse
  • Firewall: Only expose port 3000 to trusted IPs or hide behind a reverse proxy
  • Logs: docker compose logs -f whatsapp-mcp — structured JSON logs rotated at 10 MB × 3 files
  • Re-authentication: If WhatsApp logs out, delete the session volume and restart to get a fresh QR

Troubleshooting

Container crashes with error while loading shared libraries: libnss3.so → The Dockerfile installs libnss3 automatically. Rebuild: docker compose build --no-cache

QR not appearing in logsdocker compose logs -f — give it 30–60 s to start Chromium

WhatsApp client is not ready → Hit /health to check status, then /qr to retrieve the current QR if pending

Poke can't reach the SSE URL → Make sure port 3000 is accessible from Poke's servers (check firewall / security groups)

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选