Skip to main content
Glama

wuzapi-mcp

A small Model Context Protocol server that lets an AI agent (Claude Code, opencode, or any MCP client) send WhatsApp messages through a WuzAPI server.

It is deliberately narrow: it only sends messages and reads history, every send is checked against a recipient allowlist, and it never exposes session management (logout, disconnect, QR code or pairing).

Requirements

  • Node.js 22 or newer

  • A running WuzAPI server with at least one connected user session

Related MCP server: WAHA MCP Server

Install

git clone <this repository> wuzapi-mcp
cd wuzapi-mcp
npm install
npm test   # local tests with a fake HTTP server, no network

Configuration

All configuration comes from environment variables:

Variable

Required

Description

WUZAPI_URL

yes

Base URL of the WuzAPI server, e.g. https://wuzapi.example.com

WUZAPI_TOKENS

yes

JSON object mapping a session name (your choice) to a WuzAPI user token, e.g. {"main":"YOUR_USER_TOKEN"}. A value of the form "env:VAR_NAME" reads the token from another environment variable, e.g. {"main":"env:WUZAPI_MAIN_TOKEN"}

WA_ALLOW

yes, to send

Comma-separated phone numbers or JIDs that may receive messages, e.g. 15551234567,120363000000000000@g.us. * allows every recipient. Empty means no sends are allowed

WA_ENV_FILE

no

Path to a dotenv file to load. Variables already present in the environment take precedence

Example wuzapi.env (keep it out of version control; *.env is git-ignored):

WUZAPI_URL=https://wuzapi.example.com
WUZAPI_TOKENS={"main":"YOUR_USER_TOKEN"}
WA_ALLOW=15551234567

Client setup

Claude Code

claude mcp add wuzapi -e WA_ENV_FILE=/path/to/wuzapi.env -- node /path/to/wuzapi-mcp/server.mjs

opencode

In opencode.json:

{
  "mcp": {
    "wuzapi": {
      "type": "local",
      "command": ["node", "/path/to/wuzapi-mcp/server.mjs"],
      "environment": { "WA_ENV_FILE": "/path/to/wuzapi.env" },
      "enabled": true
    }
  }
}

Tools

Tool

WuzAPI endpoint

Notes

sessions

GET /session/status

Status of every configured session

send_text

POST /chat/send/text

Optional reply_to message id

send_media

POST /chat/send/{image,video,document,audio}

URL or base64 data URL

send_buttons

POST /chat/send/buttons

Button types reply, url, call, copy, voice_call; optional envelope (original, fork, viewonce)

send_list

POST /chat/send/list

Sections with selectable rows

send_poll

POST /chat/send/poll

Single choice only

send_carousel

POST /chat/send/carousel

2+ image cards; buttons reply, url, call

history

GET /chat/messages

Requires message history to be enabled on the server

All tools target the routes of upstream WuzAPI. Interactive messages (buttons, the envelope modes, voice-call buttons, carousel) were added to WuzAPI relatively recently: older releases or other forks may lack those endpoints or fields, so check the routes of the version you run. Whether WhatsApp actually renders buttons, lists and carousels depends on the recipient's client (phone, desktop, web) and can change without notice.

Not included on purpose:

  • Status (stories) posting: limiting the audience requires a field that upstream WuzAPI does not support; without it a status would go to all contacts.

  • Product catalog management: the endpoints exist only in some forks, and WhatsApp currently does not answer those catalog queries for most accounts, so it is experimental and may not work.

Safety notes

  • Every send_* call is checked against WA_ALLOW before any HTTP request is made. With an empty allowlist nothing can be sent. Use * only on test numbers.

  • Sending to status@broadcast is refused.

  • No logout, disconnect, QR code or pairing tools are exposed, so an agent cannot break or hijack a session.

  • Tokens are sent only in the Token header. They are never accepted as tool arguments, any echo of a configured token in a response is replaced with [REDACTED], and any response field named token is redacted.

  • There is no automatic retry. A transport error is reported as "result may be uncertain" so the agent does not send duplicates.

  • Prefer a dedicated test session over a production number while experimenting.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables AI assistants to interact with WhatsApp through the WSAPI service, supporting comprehensive messaging, contact management, group operations, and account management functionality. Allows sending various media types, managing chats, and controlling WhatsApp sessions through natural language.
      101
      20 npm
      4
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to interact with WhatsApp through the WAHA (WhatsApp HTTP API) platform. Supports chat management, message operations including sending/receiving messages, and marking chats as read.
      52
      11
      ISC
    • A
      license
      B
      quality
      C
      maintenance
      Enables an AI assistant to read and send WhatsApp messages, search contacts and chats, manage messages and media, and sync history through the api-supp WhatsApp bridge's REST API.
      13
      MIT