whatsapp-business-mcp

whatsapp-business-mcp

MCP server for the WhatsApp Business API that enables managing business accounts, phone numbers, message templates, sending template messages, and tracking message status via the Meta Graph API.

Category
访问服务器

README

WhatsApp Business MCP Server

MCP server for the WhatsApp Business / Meta Graph API. List business accounts and phone numbers, manage message templates, send template messages, and look up message status.

Supports two transports:

  • stdio — default; for local Claude Desktop / Claude Code / Cursor.
  • HTTP (Streamable / SSE) — for remote deployment (Railway, Fly.io, Render, your own container).

Tools

Tool Read-only Description
wa_get_business_accounts yes Discovery — start here. List WABAs owned by a Meta Business.
wa_get_phone_numbers yes List phone numbers on a WABA (returns phone_number_id for sending).
wa_get_templates yes List templates with filters (status, language, name) and pagination.
wa_create_template no Create a new message template (goes through Meta review).
wa_delete_template destructive Delete a template by name (all languages).
wa_send_template no Send an approved template message. Validates phone (E.164), template name, locale.
wa_get_message_status yes Look up a message by wamid.
wa_api_call restricted Escape hatch — only whitelisted WhatsApp Business paths.

Resources

The server also exposes the same inventory as MCP resources so the host can cache them:

  • whatsapp://business-accounts/{business_id}
  • whatsapp://phone-numbers/{waba_id}
  • whatsapp://templates/{waba_id}

Environment variables

Variable Required Default Description
WHATSAPP_TOKEN yes Meta Graph API access token (system user token recommended).
WHATSAPP_API_VERSION no v23.0 Graph API version.
MCP_TRANSPORT no stdio stdio or http.
PORT no 3000 HTTP transport port.
HOST no 0.0.0.0 HTTP transport bind address.
MCP_HTTP_PATH no /mcp HTTP transport endpoint path.
MCP_BEARER_TOKEN no If set, HTTP requests must send Authorization: Bearer <token>.

Install

npm install
npm test

Run locally (stdio)

WHATSAPP_TOKEN=... npm start

Run as an HTTP server

WHATSAPP_TOKEN=... MCP_BEARER_TOKEN=... npm run start:http
# → MCP listening on http://0.0.0.0:3000/mcp
# → Health check at GET /health

Configure in Claude Code / Desktop (stdio)

Once published to npm:

{
  "mcpServers": {
    "whatsapp-business": {
      "command": "npx",
      "args": ["-y", "whatsapp-business-mcp-server"],
      "env": { "WHATSAPP_TOKEN": "your-token-here" }
    }
  }
}

Or from a local checkout:

{
  "mcpServers": {
    "whatsapp-business": {
      "command": "node",
      "args": ["/absolute/path/to/whatsapp-business-mcp/src/server.mjs"],
      "env": { "WHATSAPP_TOKEN": "your-token-here" }
    }
  }
}

Configure as a remote HTTP MCP

{
  "mcpServers": {
    "whatsapp-business": {
      "url": "https://your-host.example.com/mcp",
      "headers": { "Authorization": "Bearer your-bearer-token" }
    }
  }
}

Docker

docker build -t whatsapp-business-mcp .
docker run --rm -p 3000:3000 \
  -e WHATSAPP_TOKEN=... \
  -e MCP_BEARER_TOKEN=... \
  whatsapp-business-mcp

Deployment

Railway

  1. New project → Deploy from GitHub.
  2. Railway detects the Dockerfile. Set service variables:
    • WHATSAPP_TOKEN
    • MCP_BEARER_TOKEN (shared secret for the HTTP endpoint)
  3. PORT is provided automatically by Railway; the server respects it.
  4. Public URL → https://<service>.up.railway.app/mcp.

Fly.io

fly launch --no-deploy
fly secrets set WHATSAPP_TOKEN=... MCP_BEARER_TOKEN=...
fly deploy

Ensure the [http_service] block in fly.toml uses internal_port = 3000.

Render

  1. New → Web Service → connect repo. Render detects the Dockerfile.
  2. Add environment variables WHATSAPP_TOKEN and MCP_BEARER_TOKEN.
  3. Health check path: /health.

Security notes

  • Always set MCP_BEARER_TOKEN when exposing the HTTP transport publicly. Without it, anyone who reaches the endpoint can use your WhatsApp Business token.
  • The token is read from the server's environment, never accepted from MCP clients.
  • wa_api_call is restricted to a whitelist of WhatsApp Business paths; arbitrary Graph endpoints are rejected.
  • Inputs are validated before requests reach Meta: phone numbers must be E.164, template names match [a-z0-9_]+, locales match xx or xx_YY.

Error handling

The server classifies Graph API failures and returns structured hints to the LLM:

  • token_expired / token_invalid (HTTP 401, code 190) — refresh credentials.
  • permission_denied (HTTP 403, code 10/200) — scopes/asset access missing.
  • rate_limited (HTTP 429, code 4) — back off and retry.
  • not_found (HTTP 404).
  • upstream_error (5xx).
  • network_error — fetch failed before reaching Meta.

推荐服务器

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

官方
精选