WhatsApp MCP Server

WhatsApp MCP Server

Bridge WhatsApp messaging to Model Context Protocol-compliant LLM agents.

5,056
Stars
786
Forks
5,056
Watchers
83
Issues
WhatsApp MCP Server enables users to access, search, and interact with their personal WhatsApp messages through the Model Context Protocol. It connects to WhatsApp via the WhatsApp web multidevice API, stores messages locally in a SQLite database, and exposes them as tools to LLM-powered agents like Claude. Users can also send messages, media, and search contacts, all while retaining control over what is shared with the AI agent.

Key Features

Direct integration with personal WhatsApp accounts via WhatsApp Web API
Search and access messages, contacts, and groups
Send messages and media files, including images, videos, documents, and audio
Stores all messages locally in a SQLite database
Selective sharing of messages with LLM agents through controlled tools
Supports integration with Claude Desktop and Cursor
Handles audio file conversion with FFmpeg for WhatsApp voice messages
Cross-platform compatibility with special instructions for Windows
Automated QR code authentication for WhatsApp account login
Supports group messaging and media file sending

Use Cases

Enabling LLM-powered agents to search and summarize WhatsApp message history
Automating responses to WhatsApp messages using AI agents like Claude
Retrieving and sending WhatsApp media files via language models
Searching contacts and initiating messaging tasks from within an AI tool
Providing personal context to LLMs for enhanced task assistance
Monitoring WhatsApp group conversations through automated agents
Allowing AI-driven notification summaries of unread WhatsApp messages
Facilitating secure, local control of message data exposed to LLMs
Sending documents or images on WhatsApp based on contextual AI prompts
Orchestrating cross-app workflows involving WhatsApp and AI assistants

README

WhatsApp MCP Server

This is a Model Context Protocol (MCP) server for WhatsApp.

With this you can search and read your personal Whatsapp messages (including images, videos, documents, and audio messages), search your contacts and send messages to either individuals or groups. You can also send media files including images, videos, documents, and audio messages.

It connects to your personal WhatsApp account directly via the Whatsapp web multidevice API (using the whatsmeow library). All your messages are stored locally in a SQLite database and only sent to an LLM (such as Claude) when the agent accesses them through tools (which you control).

Here's an example of what you can do when it's connected to Claude.

WhatsApp MCP

To get updates on this and other projects I work on enter your email here

Caution: as with many MCP servers, the WhatsApp MCP is subject to the lethal trifecta. This means that project injection could lead to private data exfiltration.

Installation

Prerequisites

  • Go
  • Python 3.6+
  • Anthropic Claude Desktop app (or Cursor)
  • UV (Python package manager), install with curl -LsSf https://astral.sh/uv/install.sh | sh
  • FFmpeg (optional) - Only needed for audio messages. If you want to send audio files as playable WhatsApp voice messages, they must be in .ogg Opus format. With FFmpeg installed, the MCP server will automatically convert non-Opus audio files. Without FFmpeg, you can still send raw audio files using the send_file tool.

Steps

  1. Clone this repository

    bash
    git clone https://github.com/lharries/whatsapp-mcp.git
    cd whatsapp-mcp
    
  2. Run the WhatsApp bridge

    Navigate to the whatsapp-bridge directory and run the Go application:

    bash
    cd whatsapp-bridge
    go run main.go
    

    The first time you run it, you will be prompted to scan a QR code. Scan the QR code with your WhatsApp mobile app to authenticate.

    After approximately 20 days, you will might need to re-authenticate.

  3. Connect to the MCP server

    Copy the below json with the appropriate {{PATH}} values:

    json
    {
      "mcpServers": {
        "whatsapp": {
          "command": "{{PATH_TO_UV}}", // Run `which uv` and place the output here
          "args": [
            "--directory",
            "{{PATH_TO_SRC}}/whatsapp-mcp/whatsapp-mcp-server", // cd into the repo, run `pwd` and enter the output here + "/whatsapp-mcp-server"
            "run",
            "main.py"
          ]
        }
      }
    }
    

    For Claude, save this as claude_desktop_config.json in your Claude Desktop configuration directory at:

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

    For Cursor, save this as mcp.json in your Cursor configuration directory at:

    ~/.cursor/mcp.json
    
  4. Restart Claude Desktop / Cursor

    Open Claude Desktop and you should now see WhatsApp as an available integration.

    Or restart Cursor.

Windows Compatibility

If you're running this project on Windows, be aware that go-sqlite3 requires CGO to be enabled in order to compile and work properly. By default, CGO is disabled on Windows, so you need to explicitly enable it and have a C compiler installed.

Steps to get it working:

  1. Install a C compiler
    We recommend using MSYS2 to install a C compiler for Windows. After installing MSYS2, make sure to add the ucrt64\bin folder to your PATH.
    → A step-by-step guide is available here.

  2. Enable CGO and run the app

    bash
    cd whatsapp-bridge
    go env -w CGO_ENABLED=1
    go run main.go
    

Without this setup, you'll likely run into errors like:

Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work.

Architecture Overview

This application consists of two main components:

  1. Go WhatsApp Bridge (whatsapp-bridge/): A Go application that connects to WhatsApp's web API, handles authentication via QR code, and stores message history in SQLite. It serves as the bridge between WhatsApp and the MCP server.

  2. Python MCP Server (whatsapp-mcp-server/): A Python server implementing the Model Context Protocol (MCP), which provides standardized tools for Claude to interact with WhatsApp data and send/receive messages.

Data Storage

  • All message history is stored in a SQLite database within the whatsapp-bridge/store/ directory
  • The database maintains tables for chats and messages
  • Messages are indexed for efficient searching and retrieval

Usage

Once connected, you can interact with your WhatsApp contacts through Claude, leveraging Claude's AI capabilities in your WhatsApp conversations.

MCP Tools

Claude can access the following tools to interact with WhatsApp:

  • search_contacts: Search for contacts by name or phone number
  • list_messages: Retrieve messages with optional filters and context
  • list_chats: List 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
  • get_last_interaction: Get the most recent message with a contact
  • get_message_context: Retrieve context around a specific message
  • send_message: Send a WhatsApp message to a specified phone number or group JID
  • send_file: Send a file (image, video, raw audio, document) to a specified recipient
  • send_audio_message: Send an audio file as a WhatsApp voice message (requires the file to be an .ogg opus file or ffmpeg must be installed)
  • download_media: Download media from a WhatsApp message and get the local file path

Media Handling Features

The MCP server supports both sending and receiving various media types:

Media Sending

You can send various media types to your WhatsApp contacts:

  • Images, Videos, Documents: Use the send_file tool to share any supported media type.
  • Voice Messages: Use the send_audio_message tool to send audio files as playable WhatsApp voice messages.
    • For optimal compatibility, audio files should be in .ogg Opus format.
    • With FFmpeg installed, the system will automatically convert other audio formats (MP3, WAV, etc.) to the required format.
    • Without FFmpeg, you can still send raw audio files using the send_file tool, but they won't appear as playable voice messages.

Media Downloading

By default, just the metadata of the media is stored in the local database. The message will indicate that media was sent. To access this media you need to use the download_media tool which takes the message_id and chat_jid (which are shown when printing messages containing the meda), this downloads the media and then returns the file path which can be then opened or passed to another tool.

Technical Details

  1. Claude sends requests to the Python MCP server
  2. The MCP server queries the Go bridge for WhatsApp data or directly to the SQLite database
  3. The Go accesses the WhatsApp API and keeps the SQLite database up to date
  4. Data flows back through the chain to Claude
  5. When sending messages, the request flows from Claude through the MCP server to the Go bridge and to WhatsApp

Troubleshooting

  • If you encounter permission issues when running uv, you may need to add it to your PATH or use the full path to the executable.
  • Make sure both the Go application and the Python server are running for the integration to work properly.

Authentication Issues

  • QR Code Not Displaying: If the QR code doesn't appear, try restarting the authentication script. If issues persist, check if your terminal supports displaying QR codes.
  • WhatsApp Already Logged In: If your session is already active, the Go bridge will automatically reconnect without showing a QR code.
  • Device Limit Reached: WhatsApp limits the number of linked devices. If you reach this limit, you'll need to remove an existing device from WhatsApp on your phone (Settings > Linked Devices).
  • No Messages Loading: After initial authentication, it can take several minutes for your message history to load, especially if you have many chats.
  • WhatsApp Out of Sync: If your WhatsApp messages get out of sync with the bridge, delete both database files (whatsapp-bridge/store/messages.db and whatsapp-bridge/store/whatsapp.db) and restart the bridge to re-authenticate.

For additional Claude Desktop integration troubleshooting, see the MCP documentation. The documentation includes helpful tips for checking logs and resolving common issues.

Star History

Star History Chart

Repository Owner

lharries
lharries

User

Repository Details

Language Go
Default Branch main
Size 2,989 KB
Contributors 5
License MIT License
MCP Verified Nov 11, 2025

Programming Languages

Go
51.23%
Python
48.77%

Tags

Topics

ai mcp whatsapp whatsapp-api

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • YCloud WhatsApp API MCP Server

    YCloud WhatsApp API MCP Server

    Bridge YCloud WhatsApp API to AI models via Model Context Protocol.

    YCloud WhatsApp API MCP Server enables seamless integration between the YCloud WhatsApp OpenAPI and AI models using the Model Context Protocol (MCP). It dynamically generates MCP tools from the OpenAPI specification, supporting interaction with all YCloud API endpoints. The server includes built-in handling for API authentication, parameter validation, and HTTP request/response management, and can be easily integrated with Claude desktop applications. Environment variable configuration allows flexible deployment and usage.

    • 8
    • MCP
    • YCloud-Developers/ycloud-whatsapp-mcp-server
  • iMessage MCP

    iMessage MCP

    MCP server enabling LLM integration with macOS iMessage data.

    iMessage MCP offers a Model Context Protocol (MCP) server that facilitates seamless integration between large language models (LLMs) and macOS iMessage data. It provides robust tools for searching and managing iMessage messages, conversations, and contacts in a read-only manner. Features include message and contact search, chat listing, and context retrieval, making it suitable for conversational agents and context-aware applications. Built using Deno and designed for easy integration with applications such as Claude Desktop, it handles context management efficiently for AI models.

    • 16
    • MCP
    • wyattjoh/imessage-mcp
  • MCP Server for Iaptic

    MCP Server for Iaptic

    A Model Context Protocol server for accessing and managing Iaptic data with AI agents.

    MCP Server for Iaptic implements the Model Context Protocol to enable AI models, such as Claude, to securely and efficiently interact with Iaptic's customer, purchase, transaction, and statistics data. The server provides a standardized interface and command set for querying and managing information related to customers, purchases, transactions, events, and application management. Designed for integration with Claude Desktop and similar AI clients, it offers both automated and manual installation options.

    • 5
    • MCP
    • iaptic/mcp-server-iaptic
  • Membase-MCP Server

    Membase-MCP Server

    Decentralized memory layer server for AI agents using the Model Context Protocol.

    Membase-MCP Server provides decentralized and persistent storage of conversation history and agent knowledge for AI agents using Unibase and the Model Context Protocol. It supports secure, traceable storage and retrieval of messages to ensure agent continuity and personalization within interactions. The server offers integration with Claude, Windsurf, Cursor, and Cline, allowing dynamic context management such as switching conversations and saving or retrieving messages. The server leverages the Unibase DA network for verifiable storage and agent data interoperability.

    • 15
    • MCP
    • unibaseio/membase-mcp
  • BigQuery MCP Server

    BigQuery MCP Server

    Enables LLMs to securely converse with BigQuery data using natural language.

    BigQuery MCP Server acts as a bridge between large language models and Google BigQuery, allowing natural language interactions with database data through the Model Context Protocol. Designed for integration with Claude Desktop, it securely processes user queries and translates them into SQL, streamlining data access and minimizing manual query writing. The tool ensures safe and read-only data operations, supports both tables and materialized views, and labels resource types for easier exploration. Installation is possible via Smithery or manual setup, with a focus on developer-friendliness and robust authentication options.

    • 129
    • MCP
    • ergut/mcp-bigquery-server
  • wcgw

    wcgw

    Local shell and code agent server with deep AI integration for Model Context Protocol clients.

    wcgw is an MCP server that empowers conversational AI models, such as Claude, with robust shell command execution and code editing capabilities on the user's local machine. It offers advanced tools for syntax-aware file editing, interactive shell command handling, and context management to optimize AI-driven workflows. Key protections are included to safeguard files, prevent accidental overwrites, and streamline large file handling, ensuring smooth automated code development and execution.

    • 616
    • MCP
    • rusiaaman/wcgw
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results