MCP server for WhatsApp via whatsapp-web.js: send/receive messages, media, chats, groups, contacts
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Automation of Whatsapp Messages without Meta (Business-)API is against WhatsApp' Terms of Service! You take full responsibility for everything you do with this MCP-Server. It is possible that your account will be flagged/restricted.
A Model Context Protocol (MCP) server for WhatsApp Web, implemented in TypeScript. This project is a TypeScript port of the original whatsapp-mcp repository.
With this MCP server, you can:
MCP_HTTP_PORT to additionally expose http://127.0.0.1:<port>/mcp, or run HTTP-only with --http)request_pairing_code tool, or automatically printed to stderr at startup via WHATSAPP_PAIRING_PHONE_NUMBER), and an optional OAuth flow for HTTP clients (MCP_OAUTH=true) where the browser authorization page shows the WhatsApp QR code β unlinking WhatsApp revokes tokens so clients automatically re-authenticateThis MCP server consists of:
webjs backend: Google Chrome or Microsoft Edge (auto-detected; needed for video/GIF codec support; other operations can use Puppeteer's bundled Chromium)baileys: install optional dependencies, including the native better-sqlite3 module. No Chrome, Edge, or Chromium is needed at runtime.FFmpeg is bundled automatically via the ffmpeg-static npm package β no manual installation needed. You can point the FFMPEG_PATH environment variable at your own binary to override it.
Clone this repository
Install dependencies
Build the project
Configure environment variables (optional)
Copy the example environment file and modify as needed:
You can select the backend with WHATSAPP_BACKEND, adjust logging levels, pin the WhatsApp Web version, or override the auto-detected browser (BROWSER_EXECUTABLE_PATH) and ffmpeg binary (FFMPEG_PATH). WHATSAPP_HEADLESS=false shows the web.js browser window, and WHATSAPP_SESSION_DIR relocates its persistent profile. Use an absolute session directory to keep it consistent across working directories.
WHATSAPP_BACKEND=webjs is the default and preserves existing sessions and MCP tool names. It uses a dedicated persistent LocalAuth profile, not your personal Chrome profile. It now keeps the browser's native user agent and graphics defaults, omits Puppeteer's automation banner flag, and leaves the browser sandbox enabled. Containers that require disabling the sandbox can explicitly set WHATSAPP_NO_SANDBOX=true. These settings do not guarantee that automation is undetectable.
To use the optional Baileys backend, set these variables in your MCP client configuration or .env, then restart the server:
BAILEYS_SESSION_DIR defaults to <working directory>/baileys-sessions; the example above should be replaced with your own absolute directory. Pair this backend separately with get_qr_code or request_pairing_code. The existing WHATSAPP_PAIRING_PHONE_NUMBER option also works. Baileys cannot reuse the web.js browser profile. You can switch back to webjs and resume its existing session.
Baileys and SQLite are pinned optional dependencies installed by normal npm install. If your package manager omitted them, run npm install --include=optional. SQLite uses a native addon; a supported prebuilt binary or a local native build toolchain is required. To avoid downloading Chromium when installing for Baileys or an existing system browser, use:
On macOS/Linux, the equivalent installation command is PUPPETEER_SKIP_DOWNLOAD=true npm install --include=optional. Selecting Baileys loads only its driver and never starts or cleans up browser processes. An unavailable backend produces an error; it never silently switches drivers or retries a send through another backend.
BAILEYS_SESSION_DIR/session.sqlite. Keep the whole directory private and out of version control. Only one running server may own a session directory. Use separate directories for independent accounts.BAILEYS_SESSION_DIR/oauth-store.json.get_backend_status reports the active backend, authentication, stored record counts and history synchronization state. Being connected does not mean history has finished arriving. An available history state means local data is available, not that WhatsApp supplied a complete archive.list_messages may request up to 100 additional older messages when a known chat has fewer than requested, with a bounded wait and a per-chat cooldown. Late history batches are persisted for subsequent queries. WhatsApp may still supply only part of an account's history.@c.us phone-number inputs, @s.whatsapp.net, groups and @lid identifiers are supported; known LID/phone mappings are persisted. Message IDs from web.js cannot be passed to Baileys or vice versa.The Baileys backend is opt-in and pinned to 7.0.0-rc14. Review upstream changes before upgrading, especially authentication and message-format migrations. See the Baileys documentation and release history.
FLUJO provides a streamlined installation process:
https://github.com/mario-andreschak/mcp-whatsapp-webFLUJO will automatically handle the cloning, dependency installation, and building process for you.
This will start the MCP server using stdio transport by default, which is suitable for integration with Claude Desktop or similar applications.
Important: After starting the server for the first time, you must authenticate with WhatsApp by using the
get_qr_codetool and scanning the QR code with your phone. See the Authentication section for detailed instructions.
This starts the server in development mode with TypeScript watch mode and automatic server restarts.
This launches the MCP Inspector tool, which provides a web interface for testing and debugging your MCP server. The inspector allows you to:
Create a configuration file for Claude Desktop:
Replace PATH_TO with the absolute path to the repository.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/whatsapp-web-mcp-server)<a href="https://allmcps.com/mcp/whatsapp-web-mcp-server"><img src="https://allmcps.com/api/badge/whatsapp-web-mcp-server?style=directory" alt="WhatsApp Web MCP Server on AllMCPs" /></a>