WhatsApp Bridge MCP server

Provides a secure bridge to your WhatsApp account, enabling message search, contact management, and sending capabilities while keeping all data stored locally on your device.
Back to servers
Provider
Luke Harries
Release date
Mar 30, 2025
Language
Python
Stats
4.0K stars

This MCP server connects to your personal WhatsApp account, allowing you to search and read messages (including media), search contacts, and send messages through AI assistants like Claude. It uses the WhatsApp web multidevice API, storing messages locally in SQLite and only sharing them with the AI when explicitly requested through tools.

Prerequisites

  • Go
  • Python 3.6+
  • Anthropic Claude Desktop app (or Cursor)
  • UV (Python package manager)
  • FFmpeg (optional) - Only needed for handling audio messages

Installation

Set Up the WhatsApp Bridge

  1. Clone the repository:
git clone https://github.com/lharries/whatsapp-mcp.git
cd whatsapp-mcp
  1. Run the WhatsApp bridge:
cd whatsapp-bridge
go run main.go

You'll need to scan a QR code with your WhatsApp mobile app on the first run. Re-authentication may be required after approximately 20 days.

Configure the MCP Server

  1. Copy the following JSON configuration, replacing the {{PATH}} values:
{
  "mcpServers": {
    "whatsapp": {
      "command": "{{PATH_TO_UV}}", 
      "args": [
        "--directory",
        "{{PATH_TO_SRC}}/whatsapp-mcp/whatsapp-mcp-server", 
        "run",
        "main.py"
      ]
    }
  }
}
  1. Save the configuration file to the appropriate location:

For Claude:

~/Library/Application Support/Claude/claude_desktop_config.json

For Cursor:

~/.cursor/mcp.json
  1. Restart Claude Desktop or Cursor

Windows Setup

If using Windows, you'll need to enable CGO and install a C compiler:

  1. Install a C compiler using MSYS2
  2. Add the ucrt64\bin folder to your PATH
  3. Enable CGO and run the app:
cd whatsapp-bridge
go env -w CGO_ENABLED=1
go run main.go

Using the WhatsApp MCP

Once connected, you can interact with your WhatsApp through Claude using the following tools:

Contact Management

  • search_contacts: Find contacts by name or phone number
  • list_chats: View available chats with metadata
  • get_chat: Get information about a specific chat
  • get_direct_chat_by_contact: Find a direct chat with a specific contact
  • get_contact_chats: List all chats involving a specific contact

Message Access

  • list_messages: Retrieve messages with optional filters
  • get_last_interaction: View the most recent message with a contact
  • get_message_context: Get context around a specific message

Communication

  • send_message: Send a WhatsApp message to a phone number or group
  • send_file: Send a file (image, video, audio, document)
  • send_audio_message: Send an audio file as a WhatsApp voice message
  • download_media: Download media from a WhatsApp message

Media Handling

Sending Media

You can send various media types to your WhatsApp contacts:

  • Images, Videos, Documents: Use the send_file tool
  • Voice Messages: Use the send_audio_message tool
    • For best results, audio files should be in .ogg Opus format
    • With FFmpeg installed, other audio formats will be automatically converted
    • Without FFmpeg, raw audio files can still be sent using send_file

Downloading Media

To access media sent in messages:

  1. Note the message_id and chat_jid shown in messages containing media
  2. Use the download_media tool with these parameters
  3. The tool will download the media and return the file path

Troubleshooting

Common Issues

  • If UV permission issues occur, add it to your PATH or use the full path
  • Ensure both the Go application and Python server are running

Authentication Problems

  • If the QR code doesn't appear, restart the authentication script
  • WhatsApp limits linked devices - you may need to remove an existing device
  • After initial authentication, message history loading may take several minutes
  • If messages get out of sync, delete the database files (whatsapp-bridge/store/messages.db and whatsapp-bridge/store/whatsapp.db) and restart

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later