
Company News
AWS Security Hub Adds Socket for Supply Chain Security
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.
mcp-whatsapp-web
Advanced tools
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:
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
git clone https://github.com/mario-andreschak/mcp-whatsapp-web.git
cd mcp-whatsapp-web
Install dependencies
npm install
Build the project
npm run build
Configure environment variables (optional)
Copy the example environment file and modify as needed:
cp .env.example .env
You can adjust logging levels, pin the WhatsApp Web version, or override the auto-detected browser (BROWSER_EXECUTABLE_PATH) and ffmpeg binary (FFMPEG_PATH) if needed. WHATSAPP_HEADLESS=false shows the browser window (debugging aid), and WHATSAPP_SESSION_DIR relocates the session/browser-profile directory (useful for running multiple instances or isolated test runs).
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.
npm start
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.
npm run dev
This starts the server in development mode with TypeScript watch mode and automatic server restarts.
npm run debug
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:
{
"mcpServers": {
"whatsapp": {
"command": "node",
"args": [
"PATH_TO/dist/index.js"
]
}
}
}
Replace PATH_TO with the absolute path to the repository.
Save this as claude_desktop_config.json in your Claude Desktop configuration directory:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonRestart Claude Desktop
Create a configuration file for Cursor:
{
"mcpServers": {
"whatsapp": {
"command": "node",
"args": [
"PATH_TO/dist/index.js"
]
}
}
}
Replace PATH_TO with the absolute path to the repository.
Save this as mcp.json in your Cursor configuration directory:
~/.cursor/mcp.json%USERPROFILE%\.cursor\mcp.jsonRestart Cursor
The first time you run the server, you'll need to authenticate with WhatsApp:
get_qr_code tool to generate a QR code
Your session will be saved locally in the whatsapp-sessions directory and will be reused automatically on subsequent runs. If you don't authenticate using the QR code, you won't be able to use any WhatsApp functionality.
You can check your current authentication status and manage your session:
check_auth_status tool to verify if you're currently authenticatedlogout tool to log out from your current sessionget_qr_code tool to authenticate with a new QR codeThis is particularly useful when:
get_qr_code- Get the QR code for WhatsApp Web authenticationcheck_auth_status- Check if you're currently authenticated with WhatsApplogout- Log out from WhatsApp and clear the current sessionsearch_contacts- Search for contacts by name or phone numberget_contact- Get information about a specific contactlist_chats- List available chats with metadataget_chat- Get information about a specific chatget_direct_chat_by_contact- Find a direct chat with a specific contactlist_messages- Retrieve messages with optional filtersget_message- Get a specific message by IDsend_message- Send a text message to a chatsend_file- Send a file (image, video, document) to a chatsend_audio_message- Send an audio message (voice note)download_media- Download media from a messageThis MCP server uses Puppeteer to control Chrome browsers for WhatsApp Web connectivity. The server includes a robust browser process management system to prevent orphaned Chrome processes.
The server automatically:
.chrome-pids.jsonIf you notice orphaned Chrome processes that weren't automatically cleaned up, you can use the included cleanup utility:
npm run cleanup-browsers
This utility will:
src/index.ts- Entry pointsrc/server.ts- MCP server implementationsrc/services/whatsapp.ts- WhatsApp Web servicesrc/tools/- Tool implementations for various WhatsApp featuressrc/types/- TypeScript type definitionssrc/utils/- Utility functionsnpm run build- Build the TypeScript codenpm run dev- Run in development mode with watchnpm run lint- Run ESLintnpm run format- Format code with Prettiernpm run cleanup-browsers- Detect and clean up orphaned Chrome browser processesnpm test - Run the unit test suite (fast, no browser needed)npm run test:watch - Run unit tests in watch mode during developmentnpm run test:e2e - Build, then run end-to-end tests (spawns the real server incl. a headless browser)check_auth_status to verify)logout tool first, then request a new QR codecheck_auth_status to confirm your authentication statusnpm run cleanup-browsers to detect and clean up orphaned processesps aux | grep chrome to check for orphaned processesMIT
This project is a TypeScript port of the original whatsapp-mcp by lharries.
FAQs
TypeScript MCP server for WhatsApp using whatsapp-web.js
The npm package mcp-whatsapp-web receives a total of 105 weekly downloads. As such, mcp-whatsapp-web popularity was classified as not popular.
We found that mcp-whatsapp-web demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.

Research
/Security News
Popular npm packages keyv and cacheable compromised.

Security News
A misconfiguration gave three Anthropic models internet access, and one, believing it was in a simulation, shipped a credential-stealing package to PyPI.