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.
Clone the repository:
git clone https://github.com/pnizer/wweb-mcp.git
cd wweb-mcp
Choose one of these installation methods:
# Install globally
npm install -g .
# Or use with npx directly
npx .
Build with Docker:
docker build . -t wweb-mcp:latest
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 | - | '' |
Run a standalone WhatsApp API server:
npx wweb-mcp --mode whatsapp-api --api-port 3001
Run an MCP server with direct WhatsApp Web connection:
npx wweb-mcp --mode mcp --mcp-mode standalone --transport sse --sse-port 3002
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
Tool | Description | Parameters |
---|---|---|
get_status |
Check WhatsApp client connection status | None |
send_message |
Send messages to contacts | number : Phone numbermessage : Text content |
search_contacts |
Search for contacts | query : Search term |
get_messages |
Retrieve chat messages | number : Phone numberlimit (optional): Messages count |
get_chats |
Get all WhatsApp chats | None |
create_group |
Create a WhatsApp group | name : Group nameparticipants : Phone numbers array |
add_participants_to_group |
Add group members | groupId : Group IDparticipants : Phone numbers array |
get_group_messages |
Get group messages | groupId : Group IDlimit (optional): Messages count |
send_group_message |
Message a group | groupId : Group IDmessage : Text content |
search_groups |
Search groups | query : Search term |
get_group_by_id |
Get group details | groupId : Group ID |
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 : Recipientmessage : Content |
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 nameparticipants : 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 IDmessage : Content |
Start WhatsApp API server:
npx wweb-mcp -m whatsapp-api -s local
Scan the QR code with your WhatsApp mobile app
Note the API key from the logs
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"
]
}
}
}
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
Scan the QR code with your WhatsApp mobile app
Note the API key from the logs
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"
]
}
}
}
Restart Claude Desktop
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.
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"
]
}
}
}
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.
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.