W2A
Documentation engine

MCP (Model Context Protocol)

Plug Whats2API into any AI assistant that supports MCP.

Whats2API runs a remote MCP server at https://api.whats2api.com/mcp. It accepts Streamable HTTP requests with Bearer-token auth, and exposes a set of tools (list, create, start, stop WhatsApp connections, plus any Baileys / whatsmeow method on a running connection).

When should I use MCP instead of the REST API?

Use MCP when you want a language model to drive the API on your behalf (e.g. "list my connections and start the one called Sales", or "send a message to 5511999999999"). The REST API is still the right choice for production backends; MCP is for AI-driven workflows and one-off automations from your IDE.

Authentication

Generate a long-lived token in your dashboard (API tokens section), then send it as a Bearer header on every request to /mcp. Tokens are 64 hex characters, and the raw value is only shown once at creation time. Revoke at any time from the dashboard.

MCP endpoint:https://api.whats2api.com/mcp

Authorization:Authorization: Bearer <token>

Streamable HTTP:Streamable HTTP (JSON-RPC over POST + optional SSE)

Available tools

Every tool runs on behalf of the user who owns the token — there is no cross-tenant access. The full set will grow over time; today it includes:

  • list_connections — list_connections — list the WhatsApp sessions owned by the token owner.
  • get_connection — get_connection — fetch one connection by id.
  • create_connection — create_connection — create a new WhatsApp connection (engine is pass-through; default is hypermeow for new connections).
  • patch_connection — patch_connection — update editable fields of an existing connection. The engine cannot be changed.
  • remove_connection — remove_connection — delete a connection (and its auth state).
  • start_connection — start_connection — spawn the worker (Baileys thread or hypermeow bridge) and emit a QR code.
  • stop_connection — stop_connection — stop the worker for a connection.

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows) and add:

{
  "mcpServers": {
    "whats2api": {
      "url": "https://api.whats2api.com/mcp",
      "headers": {
        "Authorization": "Bearer <paste the raw token from your dashboard /p/mcp-tokens>"
      }
    }
  }
}

Cursor

Create .cursor/mcp.json at the project root:

{
  "mcpServers": {
    "whats2api": {
      "url": "https://api.whats2api.com/mcp",
      "headers": {
        "Authorization": "Bearer <paste the raw token from your dashboard /p/mcp-tokens>"
      }
    }
  }
}

VS Code + Copilot

Create .vscode/mcp.json at the project root. VS Code will prompt for the token on first connect:

{
  "servers": {
    "whats2api": {
      "type": "http",
      "url": "https://api.whats2api.com/mcp",
      "headers": {
        "Authorization": "Bearer ${input:mcp-jwt}"
      }
    }
  },
  "inputs": [
    {
      "id": "mcp-jwt",
      "type": "promptString",
      "description": "API token from /p/mcp-tokens",
      "password": true
    }
  ]
}

Example: ask your AI to send a message

With the MCP server configured, you can say:

"List my WhatsApp connections, then send the message 'Hi from Claude' to 5511999999999 using the open one."

The assistant calls list_connections, picks the connection, then calls connections/request via MCP. The response is the WhatsApp message ID you can use to track the delivery.

Security

MCP calls run with the same owner-scoped, payment-gated checks as the REST API. Connections, free-tier limits and engine immutability are enforced at the service layer. Tokens can be revoked at any time; revocation takes effect on the next request. The token is stored as a SHA-256 hash, never plaintext.