MCP Hub
Back to servers

wamcp

WhatsApp MCP Server — Connect AI agents to WhatsApp via Model Context Protocol. 61 tools, 10 resources, 12 real-time events. Supports Baileys (WhatsApp Web) and Cloud API. Built with TypeScript, BullMQ, and Docker.

GitHub
Stars
8
Forks
1
Updated
Mar 3, 2026
Validated
Mar 7, 2026

WhatsApp MCP TypeScript Docker

🟢 WA MCP

The first WhatsApp integration built natively for AI Agents.
Full MCP server exposing WhatsApp as discoverable tools, resources, and real-time notifications.

Quick StartFeaturesToolsArchitectureConfigurationDockerContributing

CI License Node Transport


🤖 What is WA MCP?

WA MCP is a WhatsApp MCP server built with TypeScript that gives AI agents full access to WhatsApp through the Model Context Protocol. It supports both Baileys (WhatsApp Web) and Meta Cloud API as dual-channel backends, deployable with Docker in a single command.

Your agent connects once and auto-discovers 63 tools, 10 resources, and 12 real-time events — zero configuration, zero REST wrappers, zero glue code.

Your AI Agent ←→ MCP Protocol ←→ WA MCP ←→ WhatsApp

Instead of writing HTTP clients, parsing webhook payloads, and mapping endpoints to tools manually — your agent just connects and goes. Works out of the box with Claude, Google ADK, LangChain, and any MCP-compatible AI agent framework.

💡 MCP (Model Context Protocol) is the open standard for connecting AI agents to tools and data. WA MCP speaks MCP natively via Streamable HTTP and stdio transports.


🚀 Quick Start

One command with Docker

docker compose up

That's it. WA MCP + Redis, ready on http://localhost:3000/mcp.

Or run locally

# Prerequisites: Node.js >= 22, Redis running
npm install
cp .env.example .env

# Development (stdio transport)
npm run dev

# Production (HTTP transport)
npm run build && npm start

Connect your agent

🐍 Google ADK (Python)
from google.adk.tools.mcp_tool import McpToolset

tools = McpToolset(url="http://localhost:3000/mcp")

# Agent auto-discovers 63 WhatsApp tools
# wa_create_instance, wa_send_text, wa_send_image, ...
🦜 LangChain
from langchain_mcp import McpToolkit

toolkit = McpToolkit(server_url="http://localhost:3000/mcp")
tools = toolkit.get_tools()
💻 Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "whatsapp": {
      "command": "node",
      "args": ["path/to/wa-mcp/dist/index.js"],
      "env": {
        "WA_TRANSPORT": "stdio",
        "WA_REDIS_URL": "redis://localhost:6379"
      }
    }
  }
}

✨ Features

FeatureDescription
🔌MCP-nativeStreamable HTTP + stdio transports. No REST, no webhooks.
📱Dual-channelBaileys (WhatsApp Web) + Meta Cloud API — same interface.
🔄Multi-instanceRun 1–50 WhatsApp numbers from a single server.
📨Full messagingText, images, video, audio, documents, polls, reactions, replies, forwards, edits, deletes, view-once.
👥GroupsCreate, manage members, promote/demote admins, settings, invite links, join requests, ephemeral messages.
👤Contacts & ProfileNumber check, block/unblock, business profiles, privacy, status updates.
📡Real-time events12 notification types via SSE: messages, typing, groups, calls, connection status.
Rate limitingBullMQ queues prevent WhatsApp bans (20 msg/min Baileys, 80 msg/min Cloud).
🔁Auto-reconnectAutomatic reconnection with exponential backoff.
🗃️PersistentSQLite storage for sessions, messages, contacts, groups.
🐳Single containerdocker compose up — only Redis as external dependency.

🛠️ Tools

WA MCP exposes 63 tools across 9 domains. All tools use the wa_ prefix.

📋 Instance Management (8 tools)
ToolDescription
wa_create_instanceCreate a new WhatsApp connection
wa_connect_instanceConnect (generates QR code)
wa_disconnect_instanceGracefully disconnect
wa_delete_instancePermanently remove instance
wa_restart_instanceDisconnect + reconnect
wa_get_qr_codeGet QR as base64 (Baileys)
wa_get_pairing_codeGet pairing code (Baileys)
wa_set_cloud_credentialsSet Cloud API token
💬 Messaging (17 tools)
ToolDescription
wa_send_textSend text message
wa_send_imageSend image with caption
wa_send_videoSend video with caption
wa_send_audioSend audio / voice note
wa_send_documentSend file / document
wa_send_locationSend GPS location
wa_send_contactSend vCard contact
wa_send_pollCreate a poll
wa_send_reactionReact with emoji
wa_send_link_previewSend URL with preview
wa_forward_messageForward a message
wa_edit_messageEdit sent message
wa_delete_messageDelete message
wa_pin_messagePin a message
wa_send_view_onceSend view-once media
wa_send_presenceShow typing / recording
wa_mark_readMark messages as read
💭 Chat Management (6 tools)
ToolDescription
wa_get_messagesGet chat message history
wa_archive_chatArchive / unarchive
wa_pin_chatPin / unpin chat
wa_mute_chatMute / unmute
wa_delete_chatDelete chat
wa_clear_chatClear chat history
👥 Groups (14 tools)
ToolDescription
wa_create_groupCreate group
wa_group_add_participantsAdd members
wa_group_remove_participantsRemove members
wa_group_promotePromote to admin
wa_group_demoteDemote from admin
wa_group_update_subjectChange group name
wa_group_update_descriptionChange description
wa_group_update_settingsChange settings
wa_group_leaveLeave group
wa_group_get_invite_codeGet invite link
wa_group_revoke_inviteRevoke invite link
wa_group_joinJoin via invite code
wa_group_toggle_ephemeralToggle disappearing messages
wa_group_handle_requestApprove / reject join request
📇 Contacts (5 tools)
ToolDescription
wa_search_contactSearch contacts by name or phone
wa_check_number_existsCheck if number is on WhatsApp
wa_block_contactBlock contact
wa_unblock_contactUnblock contact
wa_get_business_profileGet business profile
👤 Profile (5 tools)
ToolDescription
wa_update_profile_pictureSet profile picture
wa_remove_profile_pictureRemove profile picture
wa_update_profile_nameChange display name
wa_update_profile_statusChange status text
wa_update_privacyUpdate privacy settings
📢 Status / Stories (3 tools)
ToolDescription
wa_send_text_statusPost text status
wa_send_image_statusPost image status
wa_send_video_statusPost video status
📰 Newsletter (3 tools)
ToolDescription
wa_newsletter_followFollow a newsletter
wa_newsletter_unfollowUnfollow a newsletter
wa_newsletter_sendSend to newsletter
📞 Calls (1 tool)
ToolDescription
wa_reject_callReject incoming call

📖 Resources

Resources expose read-only WhatsApp state via whatsapp:// URIs:

URIDescription
whatsapp://instancesList all instances
whatsapp://instances/{id}Instance details + queue stats
whatsapp://instances/{id}/contactsAll contacts
whatsapp://instances/{id}/chatsActive conversations
whatsapp://instances/{id}/groupsAll groups
whatsapp://instances/{id}/groups/{gid}Group metadata
whatsapp://instances/{id}/messages/{chatId}Message history
whatsapp://instances/{id}/profileOwn profile
whatsapp://instances/{id}/privacyPrivacy settings
whatsapp://instances/{id}/blocklistBlocked contacts

📡 Real-time Notifications

Events are pushed to agents via SSE (Server-Sent Events):

EventTrigger
whatsapp/message.receivedNew incoming message
whatsapp/message.updatedStatus change (sent → delivered → read)
whatsapp/message.deletedMessage deleted
whatsapp/message.reactionEmoji reaction added/removed
whatsapp/message.editedMessage edited
whatsapp/presence.updatedTyping / recording / online
whatsapp/chat.updatedChat metadata changed
whatsapp/group.updatedGroup info changed
whatsapp/group.participants_changedMember add/remove/promote/demote
whatsapp/contact.updatedContact info changed
whatsapp/connection.changedInstance status change (includes QR as base64)
whatsapp/call.receivedIncoming call

🏗️ Architecture

┌─────────────────────────────────────────────┐
│              AI Agent Runtime               │
│    (Google ADK, Claude, LangChain, ...)     │
└──────────────────┬──────────────────────────┘
                   │  MCP Streamable HTTP
┌──────────────────▼──────────────────────────┐
│              WA MCP Server                  │
│                                             │
│  ┌────────────────────────────────────────┐ │
│  │  Layer 1 — MCP Transport (HTTP/stdio) │ │
│  ├────────────────────────────────────────┤ │
│  │  Layer 2 — MCP Core                   │ │
│  │  63 Tools │ 10 Resources │ 12 Events  │ │
│  ├────────────────────────────────────────┤ │
│  │  Layer 3 — Services                   │ │
│  │  Instance Manager │ Queue │ Dedup     │ │
│  ├────────────────────────────────────────┤ │
│  │  Layer 4 — Channel Abstraction        │ │
│  │  ┌──────────────┐ ┌────────────────┐  │ │
│  │  │   Baileys    │ │   Cloud API    │  │ │
│  │  │  (WebSocket) │ │    (HTTPS)     │  │ │
│  │  └──────────────┘ └────────────────┘  │ │
│  └────────────────────────────────────────┘ │
│       SQLite (Drizzle)    BullMQ (Redis)    │
└─────────────────────────────────────────────┘
                   │
                   ▼  WebSocket / HTTPS
          WhatsApp Servers

Dual-Channel Design

BaileysCloud API
ProtocolWhatsApp Web (WebSocket)Meta Official (HTTPS)
AuthQR Code / Pairing CodeAccess Token
CostFreePer-conversation pricing
ComplianceUnofficialMeta-approved
Best forDev, testing, low volumeProduction, enterprise

Both backends implement the same ChannelAdapter interface. Your agent doesn't know or care which one is active — the tools work identically.


⚙️ Configuration

Copy .env.example to .env and configure:

VariableDefaultDescription
WA_TRANSPORThttphttp (Streamable HTTP) or stdio
WA_MCP_API_KEYBearer token auth. Unset = no auth (dev)
WA_MCP_PORT3000HTTP server port
WA_REDIS_URLredis://localhost:6379Redis for BullMQ queues
WA_LOG_LEVELinfodebug | info | warn | error
WA_BAILEYS_RATE_LIMIT20Messages/min per Baileys instance
WA_CLOUD_RATE_LIMIT80Messages/min per Cloud API instance
WA_MESSAGE_RETENTION_DAYS30Auto-delete old messages
WA_AUTO_RECONNECTtrueAuto-reconnect on disconnect
WA_MEDIA_CACHE_MAX_MB500Media cache size limit
WA_CLOUD_WEBHOOK_SECRETMeta webhook verification
WA_CLOUD_WEBHOOK_PORT3001Webhook receiver port
WA_VERSION_CHECKtrueDaily WhatsApp Web version check

🐳 Docker

Production

docker compose up -d

Services:

  • wa-mcp — The MCP server on port 3000
  • redis — BullMQ backend with AOF persistence

Health Check

curl http://localhost:3000/health
{
  "status": "ok",
  "uptime": 3600,
  "instances": { "total": 3, "connected": 2, "disconnected": 1 },
  "version": "1.0.0"
}

Resource Requirements

InstancesRAMCPUDisk
1–5256 MB0.5 vCPU1 GB
5–20512 MB1 vCPU5 GB
20–501 GB2 vCPU10 GB

📁 Project Structure

src/
├── index.ts                     # Entry point (HTTP/stdio)
├── constants.ts                 # Defaults and limits
├── server/mcp.ts                # MCP server setup
├── tools/                       # 🔧 63 MCP tools (9 files)
├── resources/                   # 📖 10 MCP resources (8 files)
├── notifications/events.ts      # 📡 12 event types
├── channels/
│   ├── channel.interface.ts     # ChannelAdapter contract
│   ├── baileys/                 # Baileys implementation
│   └── cloud-api/               # Cloud API implementation
├── services/
│   ├── instance-manager.ts      # Instance lifecycle
│   ├── message-queue.ts         # BullMQ rate limiting
│   ├── dedup.ts                 # Message deduplication
│   └── media.ts                 # Media handling
├── db/
│   ├── schema.ts                # Drizzle table definitions
│   └── client.ts                # SQLite connection
├── schemas/                     # Zod validation (9 files)
└── types/                       # TypeScript definitions

🗺️ Roadmap

  • Phase 1 — Foundation: Baileys adapter, text messaging, QR auth, instance management
  • Phase 2 — Full messaging: all media types, dedup, reactions, edits, forwards
  • Phase 3 — Groups, contacts, profile, status/stories, newsletters
  • Phase 4 — Cloud API adapter: dual-channel unified interface
  • Phase 5 — Hardening: error recovery, CI/CD, tests, docs, v1.0 release
  • Phase 6 — Baileys v7 upgrade, LID support, contact sync, message persistence

🤝 Contributing

Contributions are welcome! Here's how the codebase is organized:

  1. One file per domain — tools, resources, schemas, and channels each have domain-specific files
  2. Zod schemas for everything — all tool inputs are validated with strict Zod schemas in src/schemas/
  3. Both adapters — new features should be implemented in Baileys and stubbed in Cloud API
  4. Layered architecture — tools → services → channels. No cross-layer imports.
  5. Structured logging — use Pino, never console.log
# Development
npm run dev          # Start with stdio transport
npm run build        # Type-check + compile
npx tsc --noEmit     # Type-check only

📄 License

MIT — do whatever you want.


Built for the agentic era.
Stop writing REST wrappers. Let your agent discover WhatsApp.

Reviews

No reviews yet

Sign in to write a review