lingtai-whatsapp
MCP server for interacting with the official Meta WhatsApp Business Platform/Cloud API, enabling sending messages, managing contacts, templates, and handling webhook callbacks.
README
lingtai-whatsapp
LingTai MCP server for the official Meta WhatsApp Business Platform / Cloud API.
This package intentionally targets the official WhatsApp Cloud API only. It does not implement or recommend unofficial WhatsApp Web bridges (Baileys/whatsmeow style), because those violate WhatsApp's Terms of Service and can ban numbers.
Install
pip install lingtai-whatsapp
For local development before the first PyPI release:
pip install -e .
src/lingtai_whatsapp/licc.py is vendored from the first-party LingTai MCP repos and implements the LICC v1 inbox callback contract. Keep it synchronized with sibling packages (lingtai-telegram, lingtai-feishu, lingtai-wechat, lingtai-imap) when the protocol changes.
What it provides
- MCP stdio server:
python -m lingtai_whatsapp - Omnibus
whatsapptool with actions:send,reply,react,check,read,search,contacts,add_contact,remove_contact,templates,accounts,status - LICC v1 inbox callback for inbound WhatsApp messages
- Local message/contact persistence under the hosted agent directory
- Optional stdlib HTTP webhook receiver for Meta GET verification + signed POST callbacks
- MCP resources for setup/onboarding/status:
lingtai://manifestlingtai://skills/whatsapplingtai://docs/configurationlingtai://docs/troubleshootinglingtai://statuslingtai://onboarding/whatsapplingtai://onboarding/html-template
Configuration
Set LINGTAI_WHATSAPP_CONFIG to a JSON file. LingTai normally wires this through init.json's mcp.whatsapp.env entry.
{
"accounts": [
{
"alias": "main",
"access_token": "EAAG...",
"phone_number_id": "123456789",
"waba_id": "987654321",
"app_secret": "...",
"verify_token": "choose-a-random-webhook-token",
"api_version": "v20.0",
"display_phone_number": "+1 555 0100",
"webhook": {
"public_url": "https://example.com/webhooks/whatsapp",
"host": "127.0.0.1",
"port": 8088,
"path": "/webhooks/whatsapp"
},
"templates": [
{"name": "hello_world", "language": "en_US"}
]
}
]
}
Required per account:
| Field | Purpose |
|---|---|
alias |
Local LingTai account name. Defaults to default if omitted. |
access_token |
Meta system-user/permanent access token with WhatsApp messaging permissions. |
phone_number_id |
Meta phone number id used by /{phone_number_id}/messages. |
waba_id or business_account_id |
WhatsApp Business Account id for operator reference/onboarding. |
app_secret |
Used to verify X-Hub-Signature-256 on webhook POST callbacks. |
verify_token |
Random operator-chosen token used for Meta webhook GET verification. |
Optional:
api_versiondefaults tov20.0.display_phone_numberis informational only.webhookstarts a local HTTP listener whenportis present.templatesis a local list of approved template names/languages the agent can inspect withwhatsapp(action="templates").
Secrets are plaintext by LingTai addon convention, but all tool/resource status results are redacted: access tokens, app secrets, and verify tokens are never echoed.
LingTai activation
When used as a curated LingTai MCP, the agent's init.json should include:
{
"addons": ["whatsapp"],
"mcp": {
"whatsapp": {
"type": "stdio",
"command": "/Users/<you>/.lingtai-tui/runtime/venv/bin/python",
"args": ["-m", "lingtai_whatsapp"],
"env": {
"LINGTAI_WHATSAPP_CONFIG": ".secrets/whatsapp.json"
}
}
}
}
Then create .secrets/whatsapp.json using the schema above and run system(action="refresh") from the agent.
Webhook setup
Meta requires a public HTTPS callback URL for inbound WhatsApp messages and delivery statuses. This MCP can run a local HTTP server if the first account's config includes webhook.port:
"webhook": {
"public_url": "https://example.com/webhooks/whatsapp",
"host": "127.0.0.1",
"port": 8088,
"path": "/webhooks/whatsapp"
}
Expose that local listener with your preferred HTTPS reverse proxy/tunnel (Cloudflare Tunnel, ngrok, Caddy, nginx, etc.), then configure Meta's callback URL to public_url and verify it with the same verify_token stored in config.
Webhook behavior:
GET <path>?hub.mode=subscribe&hub.verify_token=...&hub.challenge=...returns the challenge when the token matches.POST <path>validatesX-Hub-Signature-256whenapp_secretis present, stores incoming messages, and pushes LICC inbox events to the hosting LingTai agent.- For multi-account configs, inbound POSTs are routed by
metadata.phone_number_id; unknown phone ids fall back to the default account.
WhatsApp Cloud API constraints
- Free-form business replies are allowed only within the 24-hour customer-service window after a user's message.
- Outside the 24-hour window, use an approved message template.
- The Cloud API is for WhatsApp Business accounts; ordinary personal WhatsApp Web sessions are intentionally out of scope.
Development
python -m pytest -q
The tests avoid real network calls. The send path uses Meta's Graph API only when credentials are present and the tool action is invoked.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。