WhatsApp Web MCP server

Connects AI systems to WhatsApp Web for sending messages, managing groups, searching contacts, and retrieving chat history through direct connection or API client modes.
Back to servers
Provider
Philippe Nizer
Release date
Mar 22, 2025
Language
TypeScript
Stats
5 stars

WhatsApp Web MCP provides a bridge between WhatsApp Web and AI models through the Model Context Protocol (MCP). This tool allows AI models like Claude to interact with WhatsApp programmatically through a standardized interface, enabling automated WhatsApp interactions.

Installation Options

Basic Installation

  1. Clone the repository:

    git clone https://github.com/pnizer/wweb-mcp.git
    cd wweb-mcp
    
  2. Choose one of these installation methods:

    # Install globally
    npm install -g .
    
    # Or use with npx directly
    npx .
    

Docker Installation

Build with Docker:

docker build . -t wweb-mcp:latest

Configuration

Command Line Options

Option Alias Description Choices Default
--mode -m Run mode mcp, whatsapp-api mcp
--mcp-mode -c MCP connection mode standalone, api standalone
--transport -t MCP transport mode sse, command sse
--sse-port -p Port for SSE server - 3002
--api-port - Port for WhatsApp API server - 3001
--auth-data-path -a Path to store authentication data - .wwebjs_auth
--auth-strategy -s Authentication strategy local, none local
--api-base-url -b API base URL for MCP when using api mode - http://localhost:3001/api
--api-key -k API key for WhatsApp Web REST API when using api mode - ''

Authentication Methods

Local Authentication (Recommended)

  • Scan QR code once
  • Credentials persist between sessions
  • More stable for long-term operation

No Authentication

  • Requires QR code scan on each startup
  • Suitable for testing and development

Usage

Running Modes

WhatsApp API Server

Run a standalone WhatsApp API server:

npx wweb-mcp --mode whatsapp-api --api-port 3001

MCP Server (Standalone)

Run an MCP server with direct WhatsApp Web connection:

npx wweb-mcp --mode mcp --mcp-mode standalone --transport sse --sse-port 3002

MCP Server (API Client)

Connect to a WhatsApp API server:

# First start the WhatsApp API server
npx wweb-mcp --mode whatsapp-api --api-port 3001

# Then start the MCP server with the API key from the logs
npx wweb-mcp --mode mcp --mcp-mode api --api-base-url http://localhost:3001/api --api-key YOUR_API_KEY --transport sse --sse-port 3002

Available Tools

Tool Description Parameters
get_status Check WhatsApp client connection status None
send_message Send messages to contacts number: Phone number
message: Text content
search_contacts Search for contacts query: Search term
get_messages Retrieve chat messages number: Phone number
limit (optional): Messages count
get_chats Get all WhatsApp chats None
create_group Create a WhatsApp group name: Group name
participants: Phone numbers array
add_participants_to_group Add group members groupId: Group ID
participants: Phone numbers array
get_group_messages Get group messages groupId: Group ID
limit (optional): Messages count
send_group_message Message a group groupId: Group ID
message: Text content
search_groups Search groups query: Search term
get_group_by_id Get group details groupId: Group ID

REST API Endpoints

Contacts & Messages

Endpoint Method Description Parameters
/api/status GET Get connection status None
/api/contacts GET Get all contacts None
/api/contacts/search GET Search contacts query: Search term
/api/chats GET Get all chats None
/api/messages/{number} GET Get chat messages limit (query): Message count
/api/send POST Send a message number: Recipient
message: Content

Group Management

Endpoint Method Description Parameters
/api/groups GET Get all groups None
/api/groups/search GET Search groups query: Search term
/api/groups/create POST Create a group name: Group name
participants: Numbers array
/api/groups/{groupId} GET Get group details None
/api/groups/{groupId}/messages GET Get group messages limit (query): Message count
/api/groups/{groupId}/participants/add POST Add group members participants: Numbers array
/api/groups/send POST Message a group groupId: Group ID
message: Content

AI Integration

Claude Desktop Integration

Option 1: Using NPX

  1. Start WhatsApp API server:

    npx wweb-mcp -m whatsapp-api -s local
    
  2. Scan the QR code with your WhatsApp mobile app

  3. Note the API key from the logs

  4. Add to Claude Desktop configuration:

    {
        "mcpServers": {
            "whatsapp": {
                "command": "npx",
                "args": [
                    "wweb-mcp",
                    "-m", "mcp",
                    "-s", "local",
                    "-c", "api",
                    "-t", "command",
                    "--api-base-url", "http://localhost:3001/api",
                    "--api-key", "YOUR_API_KEY_FROM_LOGS"
                ]
            }
        }
    }
    

Option 2: Using Docker

  1. Start WhatsApp API server in Docker:

    docker run -i -p 3001:3001 -v wweb-mcp:/wwebjs_auth --rm wweb-mcp:latest -m whatsapp-api -s local -a /wwebjs_auth
    
  2. Scan the QR code with your WhatsApp mobile app

  3. Note the API key from the logs

  4. Add to Claude Desktop configuration:

    {
        "mcpServers": {
            "whatsapp": {
                "command": "docker",
                "args": [
                    "run",
                    "-i",
                    "--rm",
                    "wweb-mcp:latest",
                    "-m", "mcp",
                    "-s", "local",
                    "-c", "api",
                    "-t", "command",
                    "--api-base-url", "http://host.docker.internal:3001/api",
                    "--api-key", "YOUR_API_KEY_FROM_LOGS"
                ]
            }
        }
    }
    
  5. Restart Claude Desktop

Troubleshooting

Claude Desktop Integration Issues

  • It's not possible to start wweb-mcp in command standalone mode on Claude because it opens multiple processes. Each wweb-mcp needs to open a separate puppeteer session that cannot share WhatsApp authentication. For proper integration with Claude, use the split MCP and API modes.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later