WhatsApp Web MCP server

Enables AI interaction with WhatsApp through direct client integration or API connectivity, supporting message handling, contact management, group creation, and conversation search capabilities.
Back to servers
Provider
Philippe Nizer
Release date
Mar 14, 2025
Language
TypeScript
Package
Stats
713 downloads
23 stars

The WhatsApp Web MCP server allows you to integrate WhatsApp with AI models through the Model Context Protocol (MCP). It creates a standardized interface for programmatic interaction with WhatsApp, enabling automated messaging, contact management, and group chat functionality through AI-driven workflows.

Installation

From Source

git clone https://github.com/pnizer/wweb-mcp.git
cd wweb-mcp

Install Options

# Install globally
npm install -g .

# Or use with npx directly
npx .

Docker Installation

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

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

Webhook Configuration

Create a webhook.json file in your authentication data directory to receive incoming WhatsApp messages:

{
  "url": "https://your-webhook-endpoint.com/incoming",
  "authToken": "your-optional-authentication-token",
  "filters": {
    "allowedNumbers": ["+1234567890", "+0987654321"],
    "allowPrivate": true,
    "allowGroups": false
  }
}

Usage

Running Modes

WhatsApp API Server

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

MCP Server (Standalone)

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

MCP Server (API Client)

# 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 WhatsApp contacts number: Phone number to send to
message: Text content to send
search_contacts Search for contacts by name or number query: Search term to find contacts
get_messages Retrieve messages from a specific chat number: Phone number to get messages from
limit (optional): Number of messages to retrieve
get_chats Get a list of all WhatsApp chats None
create_group Create a new WhatsApp group name: Name of the group
participants: Array of phone numbers to add
add_participants_to_group Add participants to an existing group groupId: ID of the group
participants: Array of phone numbers to add
get_group_messages Retrieve messages from a group groupId: ID of the group
limit (optional): Number of messages to retrieve
send_group_message Send a message to a group groupId: ID of the group
message: Text content to send
search_groups Search for groups by name, description, or member names query: Search term to find groups
get_group_by_id Get detailed information about a specific group groupId: ID of the group to get
download_media_from_message Download media from a message messageId: ID of the message containing media to download
send_media_message Send a media message to a WhatsApp contact number: Phone number to send to
source: Media source with URI scheme
caption (optional): Text caption for the media

REST API Endpoints

Contacts & Messages

Endpoint Method Description Parameters
/api/status GET Get WhatsApp connection status None
/api/contacts GET Get all contacts None
/api/contacts/search GET Search for contacts query: Search term
/api/chats GET Get all chats None
/api/messages/{number} GET Get messages from a chat limit (query): Number of messages
/api/send POST Send a message number: Recipient
message: Message content
/api/send/media POST Send a media message number: Recipient
source: Media source URL
caption (optional): Text caption
/api/messages/{messageId}/media/download POST Download media from a message None

Group Management

Endpoint Method Description Parameters
/api/groups GET Get all groups None
/api/groups/search GET Search for groups query: Search term
/api/groups/create POST Create a new group name: Group name
participants: Array of numbers
/api/groups/{groupId} GET Get detailed group information None
/api/groups/{groupId}/messages GET Get messages from a group limit (query): Number of messages
/api/groups/{groupId}/participants/add POST Add members to a group participants: Array of numbers
/api/groups/send POST Send a message to a group groupId: Group ID
message: 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. Add the following to your 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. Add the following to your 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"
                ]
            }
        }
    }
    
  4. Restart Claude Desktop

Troubleshooting

Claude Desktop Integration Issues

It's not possible to start wweb-mcp in command standalone mode on Claude because Claude opens more than one process, multiple times, and each wweb-mcp needs to open a puppeteer session that cannot share the same WhatsApp authentication. Because of this limitation, we've split the app into MCP and API modes to allow for proper integration with Claude.

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