MCP server documentation

Quick start

1. Create a workspace     →  https://app.whatsmcp.com/console/register
2. Link a WhatsApp number →  Console → Pair device (scan the QR with your phone)
3. Give your client       →  https://app.whatsmcp.com/mcp
                             …and sign in when it asks. No key to paste.

For Claude Code that is two commands:

claude mcp add --transport http wamcp https://app.whatsmcp.com/mcp
claude mcp login wamcp

Then ask your agent: “list my WhatsApp accounts and show me the last few messages.”

Clients that cannot sign in — curl, CI, anything without OAuth — take a key in a header instead: mint one, then see Connect your client.

Register

Sign-up is self-serve and free — no card, no sales call.

Create an accounthttps://app.whatsmcp.com/console/register
Sign inhttps://app.whatsmcp.com/console/login

You give a name and an email address. We send a confirmation link; opening it is where you choose a password. Confirming creates your workspace (tenant) on the free plan and drops you into a short setup wizard that walks the three steps that turn a bare account into a working integration: link a number, mint a key, and — optionally — point a webhook at your endpoint. It is derived from what you have actually done rather than a checklist you tick, so it disappears once you are set up and comes back if you unlink everything.

Everything lives in the console:

Console pageWhat it is for
FleetEvery linked number and whether it is connected
Pair deviceLink a new WhatsApp number by QR
API keysMint and revoke keys; copy-paste connection examples
WebhooksInbound delivery endpoint and its recent attempts
ConnectionsClients you signed in with OAuth, and a revoke button per client
UsageMessages sent against your plan’s caps
HelpThe connection details for your workspace, and which tools your plan includes

Per-number pages (Messages, Contacts, Calls) hang off each account in the same console.

WhatsMCP connects as a linked device, the same mechanism as WhatsApp Web. Your phone stays the primary device and can stay in your pocket afterwards.

From the console: open Pair device, then on the handset go to WhatsApp → Settings → Linked devices → Link a device and scan the code.

The console's Pair device page: a QR code above a four-stage progress indicator reading code, scanned, syncing, ready.

The code rotates roughly every 20 seconds and the page refreshes itself, so a stale QR never sits there failing to scan. The stepper underneath tracks the whole run: the handset accepts the code (scanned), the device logs in and pulls its history (syncing), and only then is the number ready to use.

From the agent, with the wa_pair_account tool:

// 1. start pairing — returns a QR as a base64 PNG for the user to scan
wa_pair_account()
→ { "pair_id": "…", "state": "qr", "qr_png_base64": "iVBORw0…", "instructions": "…" }

// 2. the code rotates about every 20 seconds — poll for the current one
wa_pair_status({ "pair_id": "…" })
→ { "state": "qr",     "qr_png_base64": "…" }     // show the new image
→ { "state": "paired", "instructions": "Linked. …" }  // done

Once state is paired the number appears in wa_list_accounts and is ready to use. wa_unpair_account disconnects it again.

Create an API key

Optional. A client that can sign in with OAuth never needs one — skip to Connect your client. Keys are for curl, for CI, and for clients that cannot do OAuth.

Console → API keysCreate key.

Keys look like wamcp_live_XXXXXXXXXXXX_… and are shown exactly once — we store only a hash, so a lost key is replaced, never recovered. Mint one key per client or per environment and revoke individually.

The key is the workspace. Every tool is scoped to it: there is no tenant argument to pass and no way for one workspace to reach another’s messages.

Connect your client

Any MCP client that speaks Streamable HTTP will work. There is one endpoint:

Endpointhttps://app.whatsmcp.com/mcp

There are two ways to prove who you are against it.

OAuth — recommended, and what every client below does by default. The client reads the server’s own metadata, registers itself, and sends you to the console to approve it. Nothing is pasted anywhere: no key is created, none is stored in a config file, and you can revoke one client without touching the others from Console → Connections.

An API keyAuthorization: Bearer <your key>, or x-api-key: <your key> for clients that reserve Authorization for a token they manage themselves. Use it for curl, for CI, and for clients that cannot do OAuth. See Create an API key.

Claude Code

claude mcp add --transport http wamcp https://app.whatsmcp.com/mcp

Then run /mcp inside Claude Code, pick Authenticate, and sign in in the browser window it opens. claude mcp login wamcp does the same thing from the shell. claude mcp list should then show wamcp connected.

With a key instead, and no sign-in step:

claude mcp add --transport http wamcp https://app.whatsmcp.com/mcp \
  --header "Authorization: Bearer YOUR_KEY"

Claude Desktop and claude.ai

Open Settings → Connectors → Add custom connector, put the endpoint in the URL field, leave Authentication on OAuth, and sign in when Claude asks. The dialog discovers the flow on its own.

The authentication type is fixed when the connector is added. A connector created with a header or an API key never switches itself to OAuth later — delete it and add it again.

To use a key here instead, set Authentication to None and add one entry under Additional request headers:

Header namex-api-key
ValueYOUR_KEY

Paste the key on its own — no Bearer in front of it. Authorization is not offered in that dialog: it is kept for the OAuth token Claude manages itself. Header values are stored once and never shown again, so if the connector will not connect, replace the header rather than trying to read it back — a wrong key and a missing one look identical from the outside.

If you edit the configuration file instead of using the dialog, it has no such restriction:

{
  "mcpServers": {
    "wamcp": {
      "type": "http",
      "url": "https://app.whatsmcp.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_KEY"
      }
    }
  }
}

ChatGPT

Turn on Developer mode under Settings → Security and login (availability depends on your ChatGPT plan), then go to Plugins, press +, and give it the endpoint.

OAuth is the only way in here. ChatGPT cannot present a custom API key to an MCP server, so the key path in this page does not apply to it — there is no header field to put one in. The sign-in flow is the whole configuration.

Codex

codex mcp add wamcp --url https://app.whatsmcp.com/mcp
codex mcp login wamcp

Or write the same server into ~/.codex/config.toml directly. auth defaults to "oauth":

[mcp_servers.wamcp]
url = "https://app.whatsmcp.com/mcp"
auth = "oauth"

To use a key instead, keep it in the environment rather than in the file:

[mcp_servers.wamcp]
url = "https://app.whatsmcp.com/mcp"
bearer_token_env_var = "WHATSMCP_API_KEY"
export WHATSMCP_API_KEY=wamcp_live_…

Codex sends that as Authorization: Bearer …. If you would rather set headers yourself, use http_headers for static values and env_http_headers to pull them from the environment.

Every other client

Clients differ in where they keep configuration, but they all need the same thing: the endpoint added as a remote HTTP (not stdio) server. A client that supports OAuth will find the sign-in flow by itself once it has the URL. One that does not needs the key in Authorization, or in x-api-key where it will not let you set Authorization.

If a client only offers “a command to run”, it does not support remote servers — there is no local process to point it at.

How the OAuth flow works

Worth reading only if you are integrating a client of your own, or wondering what your agent just agreed to. Everything here is standard OAuth 2.1 — no custom handshake.

The server publishes two metadata documents, which is how a client bootstraps with nothing but the endpoint URL:

/.well-known/oauth-protected-resourceRFC 9728 — names the resource and points at its authorization server
/.well-known/oauth-authorization-serverRFC 8414 — the endpoints, grants and scopes below

A client registers itself either by Dynamic Client Registration (RFC 7591, at /oauth/register) or by publishing a Client ID Metadata Document whose URL is its client id — both are supported, and the vendors above use one or the other. Then it is an ordinary authorization-code flow with PKCE (S256 only): you land on the consent page at /console/oauth/authorize, approve, and the code is exchanged at /oauth/token. Authorization codes are single-use, refresh tokens rotate on every use, and a retired refresh token being replayed revokes the whole grant rather than issuing another. Tokens are bound to this resource (RFC 8707) and revocable at /oauth/revoke (RFC 7009).

Seven scopes are advertised and recorded on each grant:

ScopeCovers
wa:accountsListing your numbers, plan and service version
wa:readMessages, chats, contacts, profiles, groups, calls, media
wa:sendSending, reacting, editing, group and blocklist changes
wa:pairLinking and unlinking numbers
wa:webhooksRegistering and managing inbound delivery
wa:egress:socks5, wa:egress:wireguardPer-account egress configuration

Scope is recorded, not enforced at the tool layer. Which tools a grant can actually reach is decided by your plan, exactly as it is for an API key. Treat the scope list as a description of what the connection is for, not as a sandbox.

Grants are listed and revocable at Console → Connections. Revoking one there disconnects that client and nothing else.

Check it by hand

curl -s https://app.whatsmcp.com/mcp \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

Two things catch people out when driving the endpoint directly:

  • The reply may be server-sent-event framed — one data: line per message.
  • A tool result is text that is itself JSON, so it is parsed twice.

The endpoint is stateless (MCP 2026-07-28 removed protocol sessions), so it needs no sticky routing and it is safe to call from anywhere.

Tools

42 tools. Which ones appear in tools/list depends on your plan — a tool your plan does not include is absent, not present-and-refusing. Console → Help lists the set your workspace gets, marked against what your plan includes.

Start with wa_list_accounts. Every other tool takes an account_id from it, and an account is usable only while its state is connected.

Accounts, pairing and plan

ToolDoes
wa_list_accountsLists your linked numbers: account_id, phone, push_name, state (pairing, connected, disconnected, logged_out, locked)
wa_pair_accountStarts linking a new number; returns a QR as a base64 PNG
wa_pair_statusPolls a pairing; returns a fresh code while one is waiting
wa_unpair_accountDisconnects a linked number
wa_get_planYour plan, its limits, and usage so far against the message and account caps — call it to see why a send was refused, or how much headroom is left
wa_get_versionThe version of the service you are talking to

Messaging

ToolDoes
wa_send_messageSends text, an image, a document or audio from one of your numbers
wa_list_messagesReads messages across accounts, oldest first, paged by cursor
wa_get_chatRecent messages for one account, no cursor — a one-off catch-up
wa_get_mediaDownloads a received attachment by message_id (base64 + mime)

Message operations

Each of these acts on a message that already exists, so each one takes the message_id that wa_list_messages gave you.

ToolDoes
wa_reactReacts with an emoji; an empty reaction removes one you sent
wa_edit_messageEdits a message you sent — WhatsApp accepts an edit for about 20 minutes
wa_delete_messageDeletes for everyone. WhatsApp has no true delete; this revokes the message, which every modern client honours
wa_set_presenceAnnounces typing (composing/paused) to a chat, or sets an account available/unavailable. Fire-and-forget — there is no delivery confirmation

Contacts and profiles

ToolDoes
wa_list_contactsThe account’s address book, paged
wa_search_contactsFinds contacts by name or number
wa_get_profileLooks up who a number is on WhatsApp: whether it is registered, its public name, about text, picture, and a business’s categories, contact details and hours

Unlike the two above it, wa_get_profile asks WhatsApp rather than reading the local store. An empty about or picture means the peer has not shared it with this account, not that they have none.

Blocklist

ToolDoes
wa_block_contactBlocks a contact — they can no longer call or message this account
wa_unblock_contactUnblocks one again
wa_list_blockedEveryone this account has blocked

All three report who, not just a number: each entry carries the number, the name this account’s address book has for them (absent for someone never saved on the phone) and the country the number belongs to. WhatsApp does not record when a contact was blocked, so no date is available.

Groups and channels

ToolDoes
wa_list_groupsGroups an account has joined — JID, name, member count
wa_list_channelsChannels an account follows — JID, name, subscriber count
wa_join_groupJoins a group from an invite link
wa_follow_channelFollows a Channel from its link
wa_leave_chatLeaves a group or unfollows a channel
wa_list_group_membersA group’s members, each with JID, phone and admin flag
wa_create_groupCreates a group; returns its JID and invite link
wa_delete_groupRemoves every other member, then leaves (WhatsApp has no true delete)

Group administration

Every one of these follows WhatsApp’s own rules: a mutation that needs admin fails without it, rather than silently doing nothing.

ToolDoes
wa_add_participants / wa_remove_participantsAdds or removes members by phone number or JID
wa_promote_participants / wa_demote_participantsGrants or revokes admin
wa_set_group_nameRenames the group
wa_set_group_descriptionSets its description
wa_set_group_lockedRestricts name/description/photo to admins, or opens them to everyone
wa_set_group_announceRestricts posting to admins (an “announcement” group), or opens it
wa_get_group_invite_linkReturns the invite link, or with reset revokes it and issues a new one

Calls

ToolDoes
wa_list_callsCall history, oldest first, paged — direction, peer, answered, seconds, reason, codec

Webhooks (paid plans)

ToolDoes
wa_set_webhookRegisters an HTTPS endpoint for inbound messages; returns a signing secret shown once
wa_get_webhookShows the endpoint, whether it is enabled, when it last succeeded
wa_enable_webhookPauses or resumes delivery without changing the endpoint or its secret
wa_delete_webhookStops delivery; messages remain readable through the tools

Reach for wa_enable_webhook rather than deleting and recreating when you only want deliveries to stop for a while: deleting issues a new secret, and everything verifying the old one breaks.

Contacts

Your agent should not have to make you be the address book. Two tools read the contacts synced from the phone the account is linked to, so an agent can turn “message Alice” into a number on its own.

Both read the account’s local contact store. Nothing here talks to WhatsApp: no lookups are performed against the network, and asking is free of any rate cost beyond your plan’s ordinary request throttling.

wa_list_contacts — the whole address book

wa_list_contacts({ "account_id": "acct_…", "limit": 500 })
→ {
    "contacts": [
      { "phone": "447700900111", "name": "Alice Perreira", "name_source": "saved",
        "jid": "[email protected]" },
      { "phone": "447700900222", "name": "Bakery",         "name_source": "business", "jid": "…" },
      { "phone": "447700900333", "name": "dave",           "name_source": "push",     "jid": "…" }
    ],
    "total": 482,
    "next_cursor": "447700900333",
    "has_more": true
  }
FieldMeaning
phoneInternational form, digits only — pass this straight to wa_send_message. Empty for a LID-form contact whose number this account has never been told
nameThe best available display name
name_sourcesaved — what the account owner wrote in their own address book · business — a verified business name · push — what the contact calls themselves, vouched for by nobody
jidWhatsApp’s own identifier
totalHow many contacts matched before the page limit, so a model can tell a page from the whole book
next_cursor / has_morePage until has_more is false to read everything

Paging is by cursor over a stable order (sorted by phone), so it never repeats or skips a row. Default page 500, maximum 2000.

wa_search_contacts — find one person

wa_search_contacts({ "account_id": "acct_…", "query": "+44 7700 900111" })

Matching is case-insensitive and ignores punctuation in numbers, so "+44 7700 900111" finds a contact stored as 447700900111. It looks at saved names, business names, the name the contact publishes for themselves, and the number. An empty result means no match — not an error.

Things worth knowing

  • A newly linked account starts with an empty address book. Contacts arrive from the phone by app-state sync shortly after linking, so “no contacts” right after pairing is usually “not synced yet”. The tool says so in a note rather than letting an agent report that a customer with 500 contacts has none.
  • Only numbers saved on the phone itself are contacts. Someone you have chatted with but never saved has no address-book entry — but they do appear as a peer in wa_list_messages.
  • If the account is offline, the read refuses with account_not_connected and a retry-after, rather than returning an empty book that reads as “you know nobody”.
  • The console shows the same address book per number under Contacts, if you would rather look with your eyes.

Reading incoming messages

The server never pushes to your agent. Nothing can interrupt a model when a message arrives, so your agent reads on its own schedule — and a cursor is what makes that reliable.

wa_list_messages returns messages oldest-first, each with a cursor, plus a next_cursor for the page and has_more. Pass a cursor back as after_cursor to get only what has arrived since — no gaps, no duplicates, even for two messages in the same millisecond, which a timestamp cannot promise.

after = 0
repeat:
    r = wa_list_messages(after_cursor = after)
    for m in r.messages:
        if m.direction == "inbound":
            handle(m)                 # e.g. reply with wa_send_message
    after = r.next_cursor             # advance — only newer rows next time
    if not r.has_more:
        sleep(a while)                # caught up; poll again later

Each row says who and where:

FieldMeaning
directioninbound (received) or outbound (sent by you)
peerThe other party’s number. In a group or channel this is the individual sender, not the conversation
chatThe conversation JID — …@g.us for a group, …@newsletter for a channel
chat_kinddm, group, channel or broadcast
kind / textThe content kind and the body (only text carries a body — fetch the rest with wa_get_media)
at, message_idRFC3339 timestamp, and WhatsApp’s id

To reply: in a DM send to the peer’s number; in a group or channel send to the chat JID — sending to the individual peer would start a private chat instead.

In Claude Code, the /loop command automates exactly this: it polls on a cadence, acts when the message appears, and stops. See running loops with /tasks.

For a one-off catch-up on a single account rather than a poll, wa_get_chat returns recent messages without a cursor.

Webhooks

If you would rather not poll, wa_set_webhook delivers each inbound message to an HTTPS endpoint as it arrives (paid plans).

{
  "event": "message.inbound",
  "delivery_id": "01JB…",
  "tenant_id": "01JA…",
  "account_id": "01J9…",
  "account_phone": "447700900000",
  "message_seq": 48210,
  "message_id": "3EB0…",
  "chat_jid": "[email protected]",
  "peer": "447700900111",
  "kind": "text",
  "body": "are you open on Sunday?",
  "at": "2026-09-02T14:21:07Z"
}

account_phone is your own number that received the message — what a routing rule, a CRM or a support queue is usually keyed on. message_seq is the same cursor wa_list_messages uses, so a consumer that missed a delivery can reconcile instead of guessing.

Each request carries:

HeaderValue
X-WAMCP-Signaturet=<unix>,v1=<hex hmac-sha256>
X-WAMCP-DeliveryThe delivery id, for idempotency
X-WAMCP-EventThe event name, so you can route without parsing the body

Verify the signature — recompute HMAC-SHA256(secret, "<unix>" + "." + <raw body>) and compare in constant time, rejecting a stale timestamp:

import hashlib, hmac, time

def verify(secret: str, header: str, body: bytes, tolerance: int = 300) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    ts, sig = parts["t"], parts["v1"]
    if abs(time.time() - int(ts)) > tolerance:
        return False
    mac = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256)
    return hmac.compare_digest(mac.hexdigest(), sig)

Answer 2xx to acknowledge. One attempt is bounded at 10 seconds; a failure is retried with exponential backoff up to 8 attempts, and answering 410 Gone stops delivery of that message permanently — it is the endpoint saying it is never coming back. Recent attempts and their outcomes are visible in Console → Webhooks.

Sending

wa_send_message({
  "account_id": "acct_…",
  "to": "447700900111",          // international form, digits only — or a …@g.us / …@newsletter JID
  "text": "on my way"
})
→ { "status": "sent", "message_id": "3EB0…", "request_id": "01JB…" }

Attachments ride the same tool. text becomes the caption where one applies:

ArgumentLimitNotes
image_base64 + image_mime5 MiB decodedJPEG or PNG
document_base64 + document_mime + document_filename20 MiB decodedAny file; the filename is what the recipient sees
audio_base64 + audio_mime (+ audio_seconds, audio_ptt)16 MiB decodedaudio_ptt: true sends a voice note. Audio has no caption

Check the returned status. The three values mean different things:

statusMeaning
sentDelivered to WhatsApp; message_id is set
queuedAccepted but not yet confirmed. It may still arrive — do not send it again. Reconcile it later in wa_list_messages by its request_id
refusedNothing was sent; refusal.reason says whether retrying helps

An agent that treats queued as failure will send your customer the same message twice.

Groups and channels

Listing groups and channels is part of the read surface. Joining, leaving, messaging and group management require the account to be opted into group and channel messaging on its bridge — ask us to switch it on for a number. Without it the account refuses these calls, and the refusal says so verbatim rather than failing generically.

Group management (wa_create_group, add/remove, promote/demote, delete) follows WhatsApp’s own rules: mutations that need admin fail without it. wa_delete_group removes every other member and then leaves, because WhatsApp has no true delete.

Refusals and error handling

A tool that declines does not raise a protocol error — it returns a structured refusal, so a model can read it and decide what to do:

{
  "refused": true,
  "reason": "account_not_connected",
  "message": "this account's bridge is not currently connected, so its contacts cannot be read; it reconnects on its own",
  "retry_after_seconds": 30
}
reasonMeaning
invalid_requestBad or missing arguments, or an id that does not exist in your workspace
account_not_connectedThe number is offline. It reconnects on its own — retry
account_lockedWhatsApp has locked this account; message carries the reason
quota_exceededYour plan’s send cap for the window
plan_requiredThe capability is on a higher plan
throttledToo many requests, or the account did not answer in time — retry

retry_after_seconds absent or 0 means retrying will not help.

At the transport level: an invalid or revoked key gets 401 (never 500, so a client does not retry a dead credential forever), and the endpoint is rate-limited per source address.

Security model

  • The credential is the identity. An API key and an OAuth grant resolve to the same thing: a workspace, decided at the edge before any tool runs. It travels on the request context, never as a tool argument, so there is no field in which one workspace could name another.
  • A foreign id reads as “no such account”, not “forbidden” — probing reveals nothing.
  • Keys are stored hashed, shown once at creation, and revocable individually.
  • OAuth grants are revocable per client from Console → Connections. Authorization codes are single-use and refresh tokens rotate; replaying a retired one revokes the grant rather than issuing another.
  • Webhook bodies are signed with HMAC-SHA256 over a timestamped payload.
  • Your WhatsApp account remains yours: WhatsMCP is a linked device, and you can remove it at any time from the handset (Settings → Linked devices) or with wa_unpair_account.