Whatsapp-Web MCP
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:
This MCP server consists of:
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 and specify paths to FFmpeg if needed.
FLUJO provides a streamlined installation process:
https://github.com/mario-andreschak/mcp-whatsapp-web
FLUJO 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_code
tool 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.json
Restart 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.json
Restart 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.json
If 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 processescheck_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.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!