whatsapp-mcp-server
Leverages the official Meta WhatsApp Cloud API to provide secure, production-ready business messaging capabilities, template management, and business profile updates.
Provides comprehensive tools for sending text, media, and template messages, managing conversation history, and handling real-time webhook updates for incoming messages and delivery statuses.
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-mcp-server Send 'Your order #12345 is ready for pickup' to +15550198765"
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-mcp-server
A production-ready Model Context Protocol (MCP) server that connects AI assistants like Claude to the WhatsApp Cloud API (Meta). Send messages, manage conversations, handle media, send template messages, and receive real-time webhooks — all through natural language.
Why this MCP server?
This is the only WhatsApp MCP server built on the official Meta WhatsApp Cloud API.
Most WhatsApp tools for developers rely on unofficial browser automation libraries (whatsapp-web.js) or reverse-engineered protocols (whatsmeow, Baileys). These approaches violate WhatsApp's Terms of Service and carry a real risk of account bans. This project is different.
whatsapp-mcp-server (this project) | Unofficial libraries ( | |
API type | ✅ Official Meta WhatsApp Cloud API | ❌ Unofficial / reverse-engineered |
Account ban risk | ✅ None — Meta-approved | ⚠️ High — violates WhatsApp ToS |
Account type | ✅ WhatsApp Business account | Personal account only |
Uptime reliability | ✅ Meta SLA-backed infrastructure | ❌ Breaks when WhatsApp updates |
Scalability | ✅ Business-grade, multi-agent ready | ❌ Limited to one session |
Template messages | ✅ Full support | ❌ Not available |
Media handling | ✅ Native Cloud API media endpoints | ⚠️ Workarounds required |
Webhook support | ✅ Official Meta webhook events | ❌ Polling / fragile listeners |
Production use | ✅ Built for production | ❌ Recommended for personal/hobby use only |
Long-term viability | ✅ Stable, versioned API | ❌ Depends on reverse engineering staying current |
Bottom line: if you are building anything beyond a personal experiment — customer support, automated notifications, business workflows — use the official API. This server gives you that, packaged as a drop-in MCP server.
Related MCP server: WAHA MCP Server
Features
Send all message types — text, images, videos, audio, documents, reactions
Template messages — send and list approved WhatsApp Business templates with full component support
Media management — upload, retrieve, and delete media files
Conversation history — in-memory store of recent conversations via webhook
Real-time webhooks — receive incoming messages and delivery status updates
Business profile — read and update your WhatsApp Business profile
Contact lookup — validate phone numbers against WhatsApp
Rate limit handling — automatic exponential backoff retry logic
Type-safe — fully typed TypeScript with Zod input validation
Docker ready — multi-stage Dockerfile and docker-compose included
Works without webhook — send-only mode with no webhook server required
Architecture
┌─────────────────────────────────────────────────────────────┐
│ AI Assistant (Claude) │
└──────────────────────────┬──────────────────────────────────┘
│ MCP Protocol (stdio)
│
┌──────────────────────────▼──────────────────────────────────┐
│ whatsapp-mcp-server │
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌───────────────────┐ │
│ │ MCP Server │ │ Tools │ │ WhatsApp Client │ │
│ │ (stdio) │◄─┤ messages ├─►│ (Axios + retry) │ │
│ │ │ │ contacts │ └────────┬──────────┘ │
│ └─────────────┘ │ media │ │ │
│ │ templates │ │ HTTPS │
│ ┌─────────────┐ └──────────────┘ │ │
│ │ Webhook │ ▼ │
│ │ Server │ ◄──── Incoming ┌─────────────────────┐ │
│ │ (Express) │ messages │ WhatsApp Cloud API │ │
│ └──────┬──────┘ & statuses │ graph.facebook.com │ │
└─────────│───────────────────────────┼─────────────────────┘ │
│ │ │
│ HTTP POST (Meta webhooks) │ HTTPS (send messages) │
│ │ │
┌────▼──────────────────────────▼──────────────┐
│ WhatsApp Users │
└────────────────────────────────────────────────┘
Webhook flow for incoming messages:
WhatsApp User → Meta Servers → POST /webhook → WhatsAppWebhook
→ in-memory conversation store → EventEmitter → MCP toolsPrerequisites
Node.js 20+ — download
Meta Developer Account — create one
WhatsApp Business App configured in Meta App Dashboard
Phone Number ID and Access Token from your WhatsApp app settings
(Optional) A public HTTPS URL for receiving webhooks (use ngrok for local dev)
Quick Start
Option A — Run with npx (no clone required)
The package ships a whatsapp-mcp-server binary, so the fastest way to use it is
to let your MCP client launch it via npx and pass credentials through env
(see the client config blocks below):
npx -y @fredshred7/whatsapp-mcp-servernpx downloads and runs the published package on demand — point your MCP client
at it and you are done. Jump to Usage with Claude Desktop
or Usage with Claude Code.
Option B — Clone and build from source
Step 1 — Clone and install:
git clone https://github.com/FredShred7/whatsapp-mcp-server.git
cd whatsapp-mcp-server
npm installStep 2 — Configure credentials:
cp .env.example .env
# Edit .env with your WhatsApp credentialsStep 3 — Build:
npm run buildStep 4 — Add to Claude Desktop or Claude Code (see sections below)
Step 5 — Test it: Ask Claude: "Send a WhatsApp message to +15551234567 saying Hello from Claude!"
Configuration
All configuration is via environment variables. Copy .env.example to .env and fill in the values.
Variable | Required | Description |
| Yes | Your WhatsApp phone number ID (from Meta App Dashboard > WhatsApp > API Setup) |
| Yes | Permanent access token for your app (generate in Meta App Dashboard) |
| Webhook | Random secret string — must match what you enter in Meta App Dashboard |
| Recommended | Meta App Secret (App Dashboard > Settings > Basic). Used to verify the |
| Optional | WhatsApp Business Account ID — required for listing phone numbers and templates |
| Optional | WhatsApp Cloud API version (default: |
| Optional | Port for incoming webhook server (default: off). Set to |
| Optional | HTTP path for webhooks (default: |
| Optional | Logging verbosity: |
Available Tools
Tool | Description | Key Parameters |
| Send a text message |
|
| Send an image with optional caption |
|
| Send a video with optional caption |
|
| Send an audio message |
|
| Send a document/file |
|
| React to a message with emoji |
|
| Mark a message as read |
|
| List recent conversations (webhook required) |
|
| Get messages with a contact (webhook required) |
|
| Get delivery/read status (webhook required) |
|
| ⚠️ Legacy/unsupported — validate a phone number on WhatsApp (see note below) |
|
| Get your WhatsApp Business profile | — |
| Update business profile info |
|
| Upload media from URL, get media ID |
|
| Get temporary download URL for media |
|
| Delete uploaded media |
|
| Send an approved template message |
|
| List available message templates |
|
⚠️
whatsapp_get_contactis legacy and not expected to work on the Cloud API. It relies on thePOST /{phone-number-id}/contacts"contact check", which was a feature of the legacy WhatsApp On-Premises API — not a Cloud API endpoint that was later removed. Per Meta's On-Premises API Sunset, the final On-Premises client version expired on 2025-10-23. The contact-check never existed in the WhatsApp Cloud API (the API this server uses), and the Cloud API has no contact-validation equivalent. (Even on On-Premises, Meta had degraded it to always returnvalid, so the result could not be trusted.) To determine whether a number can receive messages, send the message and inspect the message-status webhooks / error codes (e.g.131026"message undeliverable") instead. The tool is retained only for backwards compatibility.
Usage with Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
Recommended — run the published package via npx (no local build needed):
{
"mcpServers": {
"whatsapp": {
"command": "npx",
"args": ["-y", "@fredshred7/whatsapp-mcp-server"],
"env": {
"WHATSAPP_PHONE_NUMBER_ID": "your_phone_number_id",
"WHATSAPP_ACCESS_TOKEN": "your_access_token",
"WHATSAPP_WEBHOOK_VERIFY_TOKEN": "your_verify_token",
"WHATSAPP_APP_SECRET": "your_app_secret",
"WHATSAPP_BUSINESS_ACCOUNT_ID": "your_business_account_id",
"WEBHOOK_PORT": "3000"
}
}
}
}Alternatively — run a local build (after cloning and npm run build):
{
"mcpServers": {
"whatsapp": {
"command": "node",
"args": ["/absolute/path/to/whatsapp-mcp-server/dist/index.js"],
"env": {
"WHATSAPP_PHONE_NUMBER_ID": "your_phone_number_id",
"WHATSAPP_ACCESS_TOKEN": "your_access_token",
"WHATSAPP_WEBHOOK_VERIFY_TOKEN": "your_verify_token",
"WHATSAPP_APP_SECRET": "your_app_secret",
"WHATSAPP_BUSINESS_ACCOUNT_ID": "your_business_account_id",
"WEBHOOK_PORT": "3000"
}
}
}
}Restart Claude Desktop after saving. You should see the WhatsApp tools available in the tools panel.
Usage with Claude Code
Add to your Claude Code MCP settings (~/.claude/settings.json or project-level .claude/settings.json). Using the published package via npx:
{
"mcpServers": {
"whatsapp": {
"command": "npx",
"args": ["-y", "@fredshred7/whatsapp-mcp-server"],
"env": {
"WHATSAPP_PHONE_NUMBER_ID": "your_phone_number_id",
"WHATSAPP_ACCESS_TOKEN": "your_access_token",
"WHATSAPP_WEBHOOK_VERIFY_TOKEN": "your_verify_token",
"WHATSAPP_APP_SECRET": "your_app_secret",
"WHATSAPP_BUSINESS_ACCOUNT_ID": "your_business_account_id",
"WEBHOOK_PORT": "3000"
}
}
}
}Or use the CLI to add it:
claude mcp add whatsapp npx -y @fredshred7/whatsapp-mcp-serverWebhook Setup
Webhooks allow you to receive incoming messages and delivery status updates. They are optional — the MCP server works without them for sending messages only.
Local development with ngrok
# 1. Install ngrok: https://ngrok.com/download
# 2. Start your webhook server
WEBHOOK_PORT=3000 npm run dev
# 3. In another terminal, expose it publicly
ngrok http 3000
# 4. Copy the HTTPS URL (e.g. https://abc123.ngrok.io)Configure in Meta App Dashboard
Go to Meta App Dashboard > Your App > WhatsApp > Configuration
Set Callback URL to:
https://your-ngrok-url.ngrok.io/webhookSet Verify Token to match your
WHATSAPP_WEBHOOK_VERIFY_TOKENClick Verify and Save
Subscribe to the messages webhook field
Production
For production, deploy this server behind a reverse proxy (nginx, Caddy, etc.) with a valid TLS certificate. Set WEBHOOK_PORT to your internal port and expose it via HTTPS on port 443.
Docker Deployment
Build and run with docker-compose
# Copy and fill in your credentials
cp .env.example .env
# Build and start
docker-compose up -d
# View logs
docker-compose logs -f
# Stop
docker-compose downBuild manually
# Build image
docker build -t whatsapp-mcp-server .
# Run (send-only, no webhook)
docker run --rm -i \
-e WHATSAPP_PHONE_NUMBER_ID=xxx \
-e WHATSAPP_ACCESS_TOKEN=xxx \
whatsapp-mcp-server
# Run with webhook server
docker run --rm -i \
-p 3000:3000 \
--env-file .env \
whatsapp-mcp-serverNote: When using Docker with Claude Desktop/Code, the MCP transport uses stdio. Make sure to pass -i (interactive) so stdin/stdout remain connected. The webhook port is separate from the MCP transport.
Development
# Install dependencies
npm install
# Run with auto-reload
npm run dev
# Type-check only (no build)
npm run typecheck
# Build
npm run build
# Lint
npm run lint
# Run the test suite
npm test
# Re-run tests on change
npm run test:watchProject structure
src/
├── index.ts # Entry point — loads env, wires up components
├── server.ts # MCP server — registers tools, handles requests
├── whatsapp/
│ ├── client.ts # WhatsApp Cloud API client with retry logic
│ ├── types.ts # TypeScript types and interfaces
│ └── webhook.ts # Express webhook server + in-memory store
└── tools/
├── shared.ts # Shared helpers: formatError + Zod->JSON Schema
├── messages.ts # Send/receive message tools
├── contacts.ts # Contact and business profile tools
├── media.ts # Media upload/download/delete tools
└── templates.ts # Template message tools
test/ # Vitest unit tests (schema, errors, webhook)Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting pull requests.
License
MIT — Copyright (c) 2025 FredShred7
Available Tools
18 toolswhatsapp_delete_mediaA
Delete a previously uploaded media file from WhatsApp servers using its media ID. This frees up storage and removes the file permanently.
Inputs: media_id (required).
whatsapp_get_business_profileA
Retrieve the WhatsApp Business profile for your connected phone number, including about text, address, description, email, and website.
Inputs: no named parameters.
whatsapp_get_contactA
[LEGACY / UNSUPPORTED] Look up a phone number to check if it has a WhatsApp account and retrieve the WhatsApp ID. This relies on the POST /{phone-number-id}/contacts 'contact check' feature of the legacy WhatsApp On-Premises API, whose final client version expired on 2025-10-23 (per Meta's On-Premises API Sunset). It was never part of the WhatsApp Cloud API used by this server and has no Cloud API equivalent, so it is not expected to work; it is retained only for backwards compatibility. To check deliverability, send the message and inspect message-status webhooks / error codes instead.
Inputs: phone_number (required).
whatsapp_get_conversationA
Get the message history for a conversation with a specific phone number. Requires webhook server.
Inputs: phone_number (required), limit.
whatsapp_get_media_urlA
Get the download URL for a WhatsApp media file using its media ID. The URL is temporary and expires after 5 minutes. Use this to download received media.
Inputs: media_id (required).
whatsapp_get_message_statusA
Get the delivery/read status of a previously sent message. Requires webhook server for live updates.
Inputs: message_id (required).
whatsapp_list_conversationsA
List recent WhatsApp conversations. Only available when the webhook server is running and has received messages.
Inputs: limit.
whatsapp_list_templatesA
List available WhatsApp message templates for your business account. Shows template name, status (APPROVED/PENDING/REJECTED), category, and language. Requires WHATSAPP_BUSINESS_ACCOUNT_ID to be configured.
Inputs: limit.
whatsapp_mark_readA
Mark an incoming WhatsApp message as read. This sends a read receipt to the sender.
Inputs: message_id (required).
whatsapp_send_audioB
Send an audio message to a WhatsApp phone number. Provide a publicly accessible audio URL.
Inputs: to (required), audio_url (required), reply_to_message_id.
whatsapp_send_documentA
Send a document or file to a WhatsApp phone number. Supports PDF, Word, Excel, and other common formats.
Inputs: to (required), document_url (required), caption, filename, +1 more.
whatsapp_send_imageB
Send an image message to a WhatsApp phone number. Provide a publicly accessible image URL.
Inputs: to (required), image_url (required), caption, reply_to_message_id.
whatsapp_send_reactionB
React to a WhatsApp message with an emoji.
Inputs: to (required), emoji (required), message_id (required).
whatsapp_send_templateA
Send an approved WhatsApp message template. Templates are pre-approved messages used for business-initiated conversations. Supports header, body, and button components with dynamic variable substitution.
Inputs: to (required), language_code (required), template_name (required), components, +1 more.
whatsapp_send_textA
Send a text message to a WhatsApp phone number. Supports up to 4096 characters and optional URL preview.
Inputs: to (required), text (required), preview_url, reply_to_message_id.
whatsapp_send_videoC
Send a video message to a WhatsApp phone number. Provide a publicly accessible video URL.
Inputs: to (required), video_url (required), caption, reply_to_message_id.
whatsapp_update_business_profileA
Update your WhatsApp Business profile. You can update the about text, address, description, email, website URLs, and business vertical.
Inputs: about, email, address, vertical, +2 more.
whatsapp_upload_mediaA
Upload a media file from a URL to WhatsApp and get back a media ID. The media ID can then be used to send media messages. Supports images (JPEG, PNG, WebP), videos (MP4, 3GPP), audio (AAC, MP4, MPEG, AMR, OGG), and documents (PDF, Word, Excel, PowerPoint, plain text).
Inputs: media_url (required), mime_type (required), filename.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Each tool targets a distinct operation: sending different media types, managing profiles, listing conversations/templates, etc. There is no ambiguity between tools even for similar actions like sending different media types because the tool names clearly specify the media type.
All tools follow a consistent 'whatsapp_verb_noun' pattern using snake_case. For example, 'whatsapp_send_text', 'whatsapp_get_conversation', 'whatsapp_list_templates'. This makes the tool set predictable and easy to navigate.
With 18 tools, the set is well-scoped for a WhatsApp Business API server. It covers sending, receiving, media management, profile updates, and template listing without being overwhelming or too sparse.
The tool set covers core CRUD operations for sending messages, managing media, and updating profiles. However, template management is limited to listing only (no create/update/delete), and there is no support for group chats or webhook configuration, which are notable gaps for a complete WhatsApp integration.
Maintenance
Related MCP Connectors
WhatsApp for AI agents — your own number or the official Cloud API: messages, media, templates.
Send WhatsApp messages and templates, manage chats, contacts, broadcasts and AI agents.
Official WhatsApp Business API for AI agents: customer chats, templates, campaigns and Meta prices.
Run WhatsApp Business campaigns from any AI assistant: contacts, segments, and broadcasts.
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
- AlicenseBqualityBmaintenanceBridges the WhatsApp HTTP API with AI assistants to enable full control over messaging, chat management, and interactive workflows through 63 specialized tools. It allows users to automate WhatsApp tasks and receive real-time AI feedback directly on their mobile devices.638 npm6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with WhatsApp by sending messages, triaging urgent conversations, scheduling messages, and managing automated replies with safety controls and human approval.12 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to manage WhatsApp instances, send messages and campaigns, handle incoming messages, webhooks, members, and metrics through 30 authenticated tools, with an optional WhatsApp-to-assistant bridge.Apache 2.0