WhatsApp Web MCP
Overview
- Creating a standardized interface through the Model Context Protocol (MCP)
- Offering MCP Server access to WhatsApp functionality
- Providing flexible deployment options through SSE or Command modes
- Supporting both direct WhatsApp client integration and API-based connectivity
Disclaimer
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners. Also it is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
Learning Resources
Installation
- Clone the repository:
- Install globally or use with npx:
- Build with Docker:
Configuration
Command Line Options
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
API Key Authentication
--api-key
or -k
option:--auth-data-path
) and persists between restarts of the WhatsApp API server.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
webhook.json
file in your authentication data directory (specified by --auth-data-path
).Webhook JSON Format
Configuration Options
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
Webhook Payload
Usage
Running Modes
WhatsApp API Server
MCP Server (Standalone)
MCP Server (API Client)
Available Tools
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
Available Resources
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
REST API Endpoints
Contacts & Messages
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
Group Management
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
AI Integration
Claude Desktop Integration
- Start WhatsApp API server:
- Scan the QR code with your WhatsApp mobile app
- Note the API key displayed in the logs:
- Add the following to your Claude Desktop configuration:
- Start WhatsApp API server in Docker:
- Scan the QR code with your WhatsApp mobile app
- Note the API key displayed in the logs:
- Add the following to your Claude Desktop configuration:
- Restart Claude Desktop
- The WhatsApp functionality will be available through Claude's interface
Architecture
Components
- WhatsAppService: Core business logic for interacting with WhatsApp
- WhatsAppApiClient: Client for connecting to the WhatsApp API
- API Router: Express routes for the REST API
- MCP Server: Model Context Protocol implementation
Deployment Options
- WhatsApp API Server: Standalone REST API server
- MCP Server (Standalone): Direct connection to WhatsApp Web
- MCP Server (API Client): Connection to WhatsApp API server
- Running the API server and MCP server on different machines
- Using the MCP server as a client to an existing API server
- Running everything on a single machine for simplicity
Development
Project Structure
Building from Source
Testing
Linting and Formatting
Publishing
- Version incrementing (
patch
,minor
, ormajor
)
- Git tagging with version prefixed by 'v' (e.g., v0.2.1)
- Publishing to npm with GitHub secrets
- Go to the GitHub repository Actions tab
- Select the "Publish Package" workflow
- Click "Run workflow"
- Choose the version increment type (patch, minor, or major)
- Click "Run workflow" to start the publishing process
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.
Features
- Sending and receiving messages
- Sending media messages (images only)
- Downloading media from messages (images, audio, documents)
- Group chat management
- Contact management and search
- Message history retrieval
Upcoming Features
- Support for sending all media file types (video, audio, documents)
- Enhanced message templates for common scenarios
- Advanced group management features
- Contact management (add/remove contacts)
- Enhanced error handling and recovery
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Create a Pull Request
- Follows the existing code style
- Includes appropriate tests
- Updates documentation as needed
- Describes the changes in detail
Dependencies
WhatsApp Web.js
License
Logging
- Multiple log levels (error, warn, info, http, debug)
- Console output with colorized logs
- HTTP request/response logging for API endpoints
- Structured error handling
- Environment-aware log levels (development vs. production)
- All logs directed to stderr when running in MCP command mode
Log Levels
- error - Critical errors that prevent the application from functioning
- warn - Warnings that don't stop the application but require attention
- info - General information about application state and events
- http - HTTP request/response logging
- debug - Detailed debugging information
Configuring Log Level
--log-level
or -l
flag:Command Mode Logging
--mode mcp --transport command
), all logs are directed to stderr. This is important for command-line tools where stdout might be used for data output while stderr is used for logging and diagnostics. This ensures that the MCP protocol communication over stdout is not interfered with by log messages.Test Environment
NODE_ENV=test
or when running with Jest), the logger automatically adjusts its behavior to be suitable for testing environments.WhatsApp Web MCP
Overview
- Creating a standardized interface through the Model Context Protocol (MCP)
- Offering MCP Server access to WhatsApp functionality
- Providing flexible deployment options through SSE or Command modes
- Supporting both direct WhatsApp client integration and API-based connectivity
Disclaimer
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners. Also it is not guaranteed you will not be blocked by using this method. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.
Learning Resources
Installation
- Clone the repository:
- Install globally or use with npx:
- Build with Docker:
Configuration
Command Line Options
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] | [object Object] |
API Key Authentication
--api-key
or -k
option:--auth-data-path
) and persists between restarts of the WhatsApp API server.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
webhook.json
file in your authentication data directory (specified by --auth-data-path
).Webhook JSON Format
Configuration Options
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
Webhook Payload
Usage
Running Modes
WhatsApp API Server
MCP Server (Standalone)
MCP Server (API Client)
Available Tools
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] |
Available Resources
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
[object Object] | [object Object] |
REST API Endpoints
Contacts & Messages
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
Group Management
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
[object Object] | [object Object] | [object Object] | [object Object] |
AI Integration
Claude Desktop Integration
- Start WhatsApp API server:
- Scan the QR code with your WhatsApp mobile app
- Note the API key displayed in the logs:
- Add the following to your Claude Desktop configuration:
- Start WhatsApp API server in Docker:
- Scan the QR code with your WhatsApp mobile app
- Note the API key displayed in the logs:
- Add the following to your Claude Desktop configuration:
- Restart Claude Desktop
- The WhatsApp functionality will be available through Claude's interface
Architecture
Components
- WhatsAppService: Core business logic for interacting with WhatsApp
- WhatsAppApiClient: Client for connecting to the WhatsApp API
- API Router: Express routes for the REST API
- MCP Server: Model Context Protocol implementation
Deployment Options
- WhatsApp API Server: Standalone REST API server
- MCP Server (Standalone): Direct connection to WhatsApp Web
- MCP Server (API Client): Connection to WhatsApp API server
- Running the API server and MCP server on different machines
- Using the MCP server as a client to an existing API server
- Running everything on a single machine for simplicity
Development
Project Structure
Building from Source
Testing
Linting and Formatting
Publishing
- Version incrementing (
patch
,minor
, ormajor
)
- Git tagging with version prefixed by 'v' (e.g., v0.2.1)
- Publishing to npm with GitHub secrets
- Go to the GitHub repository Actions tab
- Select the "Publish Package" workflow
- Click "Run workflow"
- Choose the version increment type (patch, minor, or major)
- Click "Run workflow" to start the publishing process
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.
Features
- Sending and receiving messages
- Sending media messages (images only)
- Downloading media from messages (images, audio, documents)
- Group chat management
- Contact management and search
- Message history retrieval
Upcoming Features
- Support for sending all media file types (video, audio, documents)
- Enhanced message templates for common scenarios
- Advanced group management features
- Contact management (add/remove contacts)
- Enhanced error handling and recovery
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Create a Pull Request
- Follows the existing code style
- Includes appropriate tests
- Updates documentation as needed
- Describes the changes in detail
Dependencies
WhatsApp Web.js
License
Logging
- Multiple log levels (error, warn, info, http, debug)
- Console output with colorized logs
- HTTP request/response logging for API endpoints
- Structured error handling
- Environment-aware log levels (development vs. production)
- All logs directed to stderr when running in MCP command mode
Log Levels
- error - Critical errors that prevent the application from functioning
- warn - Warnings that don't stop the application but require attention
- info - General information about application state and events
- http - HTTP request/response logging
- debug - Detailed debugging information
Configuring Log Level
--log-level
or -l
flag:Command Mode Logging
--mode mcp --transport command
), all logs are directed to stderr. This is important for command-line tools where stdout might be used for data output while stderr is used for logging and diagnostics. This ensures that the MCP protocol communication over stdout is not interfered with by log messages.Test Environment
NODE_ENV=test
or when running with Jest), the logger automatically adjusts its behavior to be suitable for testing environments.