whatsapp-cloud-mcp
Provides tools for interacting with the official WhatsApp Cloud API, including sending text, template, media, and interactive button/list messages; marking messages as read; listing message templates; retrieving the business profile; uploading media; and handling webhooks with signature verification and payload normalization.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@whatsapp-cloud-mcp Send a WhatsApp text to +971 50 123 4567 saying the order has shipped"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
whatsapp-cloud-mcp
A Model Context Protocol (MCP) server for the official WhatsApp Cloud API — let Claude, Cursor and any AI agent send WhatsApp text, templates, media and interactive messages.

Why
AI agents are great at deciding what to say — but giving them a safe, typed bridge to a real messaging channel is the hard part. whatsapp-cloud-mcp wraps the official WhatsApp Cloud API as a set of well-described MCP tools so an LLM can:
send messages from natural-language instructions, with phone numbers normalized to E.164 automatically;
use approved templates to legitimately start conversations;
preview every request with dry-run mode before a single message leaves your machine;
receive and react to incoming messages via the included webhook helpers.
It is built to be correct about WhatsApp's rules (the 24-hour customer-service window, template requirements, media limits) and friendly to LLMs (rich tool descriptions, actionable error hints).
Related MCP server: whatsapp-mcp-server
Features
9 MCP tools: text, template, media, interactive buttons, interactive list, mark-as-read, list templates, business profile, upload media.
E.164 phone normalization — accepts
+971 50 123 4567,00971..., national numbers (with a default country code), and WhatsApp JIDs.Dry-run mode — returns the exact request (with the token redacted) without calling the network. Perfect for demos, CI and prompt engineering.
Actionable errors — Graph API error codes are mapped to human hints (expired token, outside 24h window → use a template, rate limits, unapproved template, …).
Webhook toolkit — signature verification, the verification handshake, and a normalizer that flattens WhatsApp's nested payload into a clean discriminated union.
Usable as a library — import the builders, client and webhook helpers directly.
Strict TypeScript, zod schemas, 60+ tests.
Quick start
Run with npx
npx -y whatsapp-cloud-mcpThe npm release is coming soon. Until then, run it straight from GitHub:
npx -y github:workofhaseeb-cyber/whatsapp-cloud-mcp(it builds on install), and use those same args in the configs below.
Claude Desktop
Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"whatsapp": {
"command": "npx",
"args": ["-y", "whatsapp-cloud-mcp"],
"env": {
"WHATSAPP_ACCESS_TOKEN": "EAAG...",
"WHATSAPP_PHONE_NUMBER_ID": "1234567890",
"WHATSAPP_BUSINESS_ACCOUNT_ID": "1234567890",
"WHATSAPP_DEFAULT_COUNTRY_CODE": "971"
}
}
}
}Cursor
Add to .cursor/mcp.json in your project (or the global ~/.cursor/mcp.json):
{
"mcpServers": {
"whatsapp": {
"command": "npx",
"args": ["-y", "whatsapp-cloud-mcp"],
"env": {
"WHATSAPP_ACCESS_TOKEN": "EAAG...",
"WHATSAPP_PHONE_NUMBER_ID": "1234567890",
"WHATSAPP_BUSINESS_ACCOUNT_ID": "1234567890"
}
}
}
}Tip: set
"WHATSAPP_DRY_RUN": "1"inenvwhile you wire things up — no messages will actually be sent.
From source
git clone https://github.com/workofhaseeb-cyber/whatsapp-cloud-mcp.git
cd whatsapp-cloud-mcp
npm install
npm run build
node dist/index.jsGetting credentials
Create an app (type Business) and add the WhatsApp product.
In WhatsApp → API Setup, copy the Phone number ID and the WhatsApp Business Account ID.
Generate an access token. For development the temporary token works; for production, create a System User with a long-lived token and grant it
whatsapp_business_messaging(andwhatsapp_business_managementfor templates).Add and verify a recipient test number, or register your own number to go live.
(Optional) For webhooks, copy the App Secret (App → Settings → Basic) into
WHATSAPP_APP_SECRET.
Tool reference
Tool | What it does | Key parameters |
| Send a plain text message (inside the 24h window) |
|
| Send an approved template (required to start a conversation) |
|
| Send image/video/audio/document/sticker by link or |
|
| Send up to 3 quick-reply buttons |
|
| Send a tappable list menu (≤10 rows) |
|
| Mark an incoming message read (+ optional typing) |
|
| List templates with status/category/language |
|
| Fetch your public business profile | — |
| Upload a file/URL, get back a reusable |
|
Environment variables
Variable | Required | Default | Description |
| to send | — | Cloud API access token |
| to send | — | Sender phone-number ID |
| for templates | — | WABA ID (needed by |
| no |
| Graph API version |
| no | — | Country code for national numbers (e.g. |
| no |
|
|
| no | — | Directory whose files |
| no |
| Per-request timeout in ms |
| no |
| Graph base URL (override for proxies/mocks) |
| webhook | — | App secret for webhook signature verification |
Dry-run demo
With WHATSAPP_DRY_RUN=1, asking the agent "Send a WhatsApp to +971 50 123 4567 saying 'Your order has shipped'" calls send_text_message and returns:
{
"to": "971501234567",
"message_id": null,
"status": "dry_run",
"response": {
"dry_run": true,
"method": "POST",
"url": "https://graph.facebook.com/v27.0/<PHONE_NUMBER_ID>/messages",
"headers": { "Authorization": "Bearer ***" },
"body": {
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "971501234567",
"type": "text",
"text": { "body": "Your order has shipped", "preview_url": false }
}
}
}No network call is made and the token is redacted — safe to run anywhere.
Webhook helper usage
import { createServer as createHttpServer } from "node:http";
import {
loadConfig,
WhatsAppClient,
verifyWebhookSignature,
handleVerificationRequest,
parseWebhookPayload,
buildTextMessage,
buildMarkAsRead,
} from "whatsapp-cloud-mcp";
const client = new WhatsAppClient(loadConfig());
const appSecret = process.env.WHATSAPP_APP_SECRET!;
// GET: echo the challenge during subscription
handleVerificationRequest(new URLSearchParams(req.url!.split("?")[1]), "my-verify-token");
// POST: verify the raw body, then react to events
if (verifyWebhookSignature(rawBody, req.headers["x-hub-signature-256"], appSecret)) {
for (const event of parseWebhookPayload(JSON.parse(rawBody))) {
if (event.kind === "message" && event.text?.toLowerCase() === "ping") {
await client.markAsRead(buildMarkAsRead({ message_id: event.id }));
await client.sendMessage(buildTextMessage({ to: event.from, body: "pong" }));
}
}
}A complete, runnable example lives in examples/webhook-server.ts.
Use as a library
import {
buildTemplateMessage,
WhatsAppClient,
loadConfig,
normalizePhoneNumber,
} from "whatsapp-cloud-mcp";
const client = new WhatsAppClient(loadConfig());
const payload = buildTemplateMessage(
{ to: normalizePhoneNumber("050 123 4567", { defaultCountryCode: "971" }), template_name: "hello_world", language_code: "en_US" },
);
const res = await client.sendMessage(payload);
console.log(res);Security notes
Never commit
.envor tokens. Pass secrets via environment variables (.envis git-ignored).Least privilege: prefer a long-lived System User token scoped to only
whatsapp_business_messaging(andwhatsapp_business_managementfor templates).Use dry-run (
WHATSAPP_DRY_RUN=1) when developing or letting an untrusted prompt drive the tools — nothing is sent and tokens are redacted in output.Sandboxed uploads:
upload_mediacan only read local files insideWHATSAPP_UPLOAD_DIR(symlinks and..are resolved first) and is disabled when that variable is unset. Remote uploads must behttps://, private/loopback/link-local IP hosts are refused and redirects are not followed, which limits SSRF. Hostnames that resolve to private IPs are not checked, so run the server where that matters.Verify webhook signatures with
verifyWebhookSignatureover the raw request body (constant-time compare) before trusting any payload.Respect the rules: free-form messages are only allowed within the 24-hour customer-service window; outside it you must use an approved template. Obtain opt-in and follow the WhatsApp Business Messaging Policy.
Development
npm install
npm run build # compile to dist/
npm run dev # compile in watch mode
npm run typecheck # tsc --noEmit
npm run lint # eslint .
npm test # vitest runRoadmap
Streamable HTTP transport (in addition to stdio)
WhatsApp Flows
Catalog / product messages
Reactions and location messages
Built-in rate-limit retry/backoff
Expose incoming webhooks as MCP resources/notifications
Contributing
Issues and PRs are welcome. Please run npm run lint && npm run typecheck && npm test before opening a PR, and keep changes focused and well-tested.
Pro version
Need an AI auto-reply agent, conversation history and bulk campaigns? whatsapp-cloud-mcp Pro is available for a launch price of AED 399 (one-time, self-install). Buy with Ziina, then send your GitHub username to workofhaseeb@gmail.com to get access, or book a free call first.
License
MIT © Haseeb Ur Rehman
Author
Haseeb Ur Rehman — Applied AI Engineer & Full-Stack Tech Lead, Abu Dhabi.
Website: https://www.lifeofhaseeb.com
This project is an independent, community-built integration and is not affiliated with, endorsed by, or sponsored by Meta or WhatsApp. "WhatsApp" is a trademark of Meta Platforms, Inc.
Available Tools
9 toolsget_business_profileGet WhatsApp business profileARead-only
Fetch the public WhatsApp business profile for your phone number (about, address, description, email, websites, vertical, profile picture).
Inputs: no named parameters.
list_message_templatesList WhatsApp message templatesARead-only
List the message templates for your WhatsApp Business Account, including their approval status, category and language. Use this to find a template name/language to pass to send_template_message.
Inputs: name, limit, status.
mark_as_readMark WhatsApp message as readA
Mark an incoming message as read (blue ticks), optionally also showing a typing indicator. Pass the wamid of the message you received.
Inputs: message_id (required), show_typing.
send_interactive_buttonsSend WhatsApp reply buttonsA
Send up to 3 quick-reply buttons with a message. The user's tap is delivered to your webhook as a button reply (id + title). Requires an open 24-hour customer-service window.
Inputs: to (required), body (required), buttons (required), footer, +2 more.
send_interactive_listSend WhatsApp list messageA
Send a tappable list menu (up to 10 rows total across sections). The user's selection is delivered to your webhook as a list reply (id + title). Requires an open 24-hour customer-service window.
Inputs: to (required), body (required), sections (required), button_text (required), +2 more.
send_media_messageSend WhatsApp media messageA
Send an image, video, audio, document or sticker, either by a public HTTPS link or by a media_id from upload_media. Captions are supported for image/video/document only. Requires an open 24-hour customer-service window.
Inputs: to (required), media_type (required), link, caption, +3 more.
send_template_messageSend WhatsApp template messageA
Send a pre-approved WhatsApp message template. Templates are REQUIRED to start a conversation (or to re-engage a user after the 24-hour customer-service window has closed). Use body_parameters for simple {{1}},{{2}} placeholders, or components for advanced header/button parameters. Discover templates with list_message_templates.
Inputs: to (required), template_name (required), components, language_code, +1 more.
send_text_messageSend WhatsApp text messageA
Send a plain text WhatsApp message to a phone number. Only works inside the 24-hour customer-service window (i.e. the user messaged you in the last 24h). To start a brand-new conversation, use send_template_message instead.
Inputs: to (required), body (required), preview_url, reply_to_message_id.
upload_mediaUpload WhatsApp mediaA
Upload a media file to WhatsApp and get back a media_id you can reuse in send_media_message. Provide exactly one of file_path (a local file) or url (a remote file to fetch). file_path only works when the server is configured with WHATSAPP_UPLOAD_DIR and the file lives inside it; url must be a public https:// URL. The MIME type is inferred from the file extension when not given. Max 100MB.
Inputs: url, file_path, mime_type.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each send_* tool maps to a distinct WhatsApp message type (text, template, media, interactive list, interactive buttons) and the descriptions explicitly state the conditions under which each applies, including the 24-hour window constraint. Even the closely related interactive list vs. buttons pair is clearly separated by payload shape and row/button limits. Read/receipt, template discovery, profile fetch, and media upload tools are each unambiguous.
All nine tools follow a consistent snake_case verb_noun convention (send_*, list_*, get_*, mark_*, upload_*). The verb choice is predictable for each action type, with no camelCase or naming-style mixing.
Nine tools is well within the sweet spot and each earns its place, covering the distinct outbound message types plus the supporting operations agents actually need. Nothing feels redundant or padded.
The messaging lifecycle is well covered: text/template/media/interactive sends, mark-as-read, template discovery, media upload, and profile fetch. Minor gaps remain, such as updating the business profile, downloading/retrieving received media, or reactions, but agents can work around these for the core send/receive flow.
Maintenance
Related MCP Connectors
Send WhatsApp messages and templates, manage chats, contacts, broadcasts and AI agents.
WhatsApp for AI agents — your own number or the official Cloud API: messages, media, templates.
WhatsApp for your AI agent, sent from your own number. Source-available (Elastic License 2.0).
Send WhatsApp messages, templates and media, and manage templates via the WhatsApp Business API.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to send WhatsApp messages, templates, and retrieve media through the WhatsApp Cloud API. Provides webhook handling and seamless integration with Meta's WhatsApp Business platform.23ISC
- FlicenseAqualityDmaintenanceEnables LLMs to interact with WhatsApp via the official WhatsApp Cloud API, providing tools for sending messages, templates, media, and managing conversations.13-

GoWA MCP Serverofficial
AlicenseNot gradedqualityBmaintenanceEnables AI agents and tools to send and manage WhatsApp messages, media, statuses, and scheduled sends across multiple linked devices.MIT- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to send text, media, pre-approved templates, and interactive quick-reply buttons through Meta's official WhatsApp Business Cloud API, check phone quality ratings, list message templates, and call arbitrary Graph API endpoints.MIT