Skip to main content
Glama
WhatsApp MCP Server

WhatsApp MCP Server

WhatsApp MCP Server

License: MIT Python 3.10+ MCP Spec

A native Model Context Protocol (MCP) server for WhatsApp on macOS.

This server bridges local WhatsApp Catalyst SQLite storage (ChatStorage.sqlite) with native OS messaging, enabling AI agents to read conversations, search message history, inspect media attachments, and send/draft messages with hardware-enforced biometric authorization (Apple Touch ID / Windows Hello).


Key Features

  • Read-Only SQLite Storage Parsing: Connects directly to WhatsApp's sandboxed CoreData SQLite database using URI mode (file:...?mode=ro) with read-only pragmas and automatic WAL lock snapshot fallback. Never locks or alters the desktop client database.

  • Hardware-Enforced Biometrics: All message sending operations are gated by native OS biometric prompts (macOS Touch ID / Windows Hello) with interactive recipient and text preview before dispatch.

  • Flexible Message Dispatch:

    • auto: Focuses WhatsApp, stages the message, and automatically dispatches via native AppleScript Return keystroke.

    • draft: Opens the chat and stages the message text in the input box for manual human review and dispatch.

  • Rich Media & Context Resolution: Inspects images, documents, PDFs, voice notes, and contact cards, resolving local filesystem paths and disk presence.

  • Cross-Version CoreData Schema Adaptation: Automatically inspects table metadata at runtime to adapt across macOS Catalyst updates.


Related MCP server: WhatsApp MCP Server (TypeScript)

Architectural Overview

                      ┌────────────────────────────────┐
                      │    AI Agent / MCP Client       │
                      │  (Claude, Cursor, Antigravity) │
                      └───────────────┬────────────────┘
                                      │ stdio (JSON-RPC)
                                      ▼
                      ┌────────────────────────────────┐
                      │      WhatsApp MCP Server       │
                      └───────┬────────────────┬───────┘
                              │                │
            [Read-Only Layer] │                │ [Write Layer]
      (Zero-Friction SQLite)  │                │ (Biometric Guard)
                              ▼                ▼
            ┌───────────────────┐    ┌───────────────────┐
            │ ChatStorage.sqlite│    │ Native Biometrics │
            │ (mode=ro + WAL    │    │ (Touch ID / Hello)│
            │  snapshot safe)   │    └─────────┬─────────┘
            └───────────────────┘              │
                                               ▼
                                     ┌───────────────────┐
                                     │   WhatsApp.app    │
                                     │ (URL Scheme + UI) │
                                     └───────────────────┘

Prerequisites & Permissions

1. macOS Full Disk Access (FDA)

WhatsApp for macOS stores its SQLite database inside a sandboxed Group Container: ~/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/ChatStorage.sqlite

To allow the MCP server (or your terminal / IDE) to read the database:

  1. Open System Settings -> Privacy & Security -> Full Disk Access.

  2. Click the + button.

  3. Add your terminal application (e.g., Terminal, iTerm2, Ghostty) or your MCP client host (e.g., Cursor, VS Code, Antigravity) or Python executable.

  4. Restart your terminal / IDE.

To verify access at any time, run:

whatsapp-mcp --status

Installation

Using uv (Recommended)

# Clone the repository
git clone https://github.com/hemelbesem90s/WhatsApp-MCP.git
cd WhatsApp-MCP

# Create environment and install
uv venv .venv --python 3.13
source .venv/bin/activate
uv pip install -e ".[dev]"

Using standard pip

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Configuration

Settings can be specified in a .env file or passed as environment variables:

Variable

Type

Default

Description

WHATSAPP_MCP_DB_PATH

Path

~/Library/Group Containers/.../ChatStorage.sqlite

Path to WhatsApp SQLite database

WHATSAPP_MCP_MEDIA_PATH

Path

~/Library/Group Containers/.../Message/Media

Path to WhatsApp media directory

WHATSAPP_MCP_ENABLE_WRITE_TOOLS

bool

true

Enable write tools (send_message, draft_message)

WHATSAPP_MCP_REQUIRE_BIOMETRIC

bool

true

Require Touch ID / Windows Hello for write actions

WHATSAPP_MCP_SEND_MODE

str

auto

Message dispatch mode (auto or draft)

WHATSAPP_MCP_LOG_LEVEL

str

INFO

Logging level (DEBUG, INFO, WARNING, ERROR)


MCP Tool Reference

Read Tools (Zero Friction, Read-Only)

Tool Name

Parameters

Description

check_connection_status

(none)

Tests WhatsApp installation, database readability, and Full Disk Access status with summary stats.

list_chats

search, include_archived, unread_only, limit, offset

Lists recent 1:1 and group chats with unread counts and message previews.

get_chat

chat_id (required)

Retrieves full chat metadata, group membership roster, and media breakdown.

list_messages

chat_id, since, until, sender, media_type, search, limit, offset, order

Lists messages across chats or within a chat with rich timestamp/media filtering.

search_messages

query (required), chat_id, limit, offset

Full-text substring search across message history.

search_contacts

query (required), limit

Searches contacts by name, push name, phone number, or JID.

get_message_context

message_id (required), before, after

Retrieves chronological conversation context surrounding a message ID.

list_media

chat_id, media_type, limit, offset

Lists media attachments with local file disk verification.

get_media_path

media_id, message_id

Resolves absolute filesystem path, disk presence, size, and MIME type.

Write Tools (Biometric-Gated)

Tool Name

Parameters

Description

send_message

recipient (required), text (required), confirm=true (required)

Sends a message to a phone number or JID via native desktop WhatsApp. Gated by Touch ID.

draft_message

recipient (required), text (required), confirm=true (required)

Stages a message draft in WhatsApp for manual human review without sending. Gated by Touch ID.


Client Integration Examples

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "whatsapp": {
      "command": "/path/to/whatsapp-mcp/.venv/bin/whatsapp-mcp",
      "args": [],
      "env": {
        "WHATSAPP_MCP_ENABLE_WRITE_TOOLS": "true",
        "WHATSAPP_MCP_REQUIRE_BIOMETRIC": "true",
        "WHATSAPP_MCP_SEND_MODE": "auto"
      }
    }
  }
}

Antigravity / Gemini CLI (mcp_config.json)

{
  "mcpServers": {
    "whatsapp": {
      "command": "/path/to/whatsapp-mcp/.venv/bin/whatsapp-mcp",
      "args": [],
      "env": {
        "WHATSAPP_MCP_ENABLE_WRITE_TOOLS": "true",
        "WHATSAPP_MCP_REQUIRE_BIOMETRIC": "true",
        "WHATSAPP_MCP_SEND_MODE": "auto"
      }
    }
  }
}

Development & Testing

# Run unit test suite with coverage
make test

# Run linter
make lint

# Run type checker
make typecheck

# Full test and verification suite
make check

License

MIT License. See LICENSE for details.

Available Tools

11 tools
check_connection_statusA

Check whether WhatsApp.app is installed, if the ChatStorage.sqlite database is accessible, and whether macOS Full Disk Access is granted (with setup instructions if needed). Returns summary statistics including chat count, message count, media count, and latest message date.

Inputs: no named parameters.

draft_messageA

Open WhatsApp with the recipient focused and message body pre-filled without pressing Enter. Allows the user to review, edit, or manually send the message in the app. Requires explicit user confirmation (confirm=true) and native biometric verification.

Inputs: text (required), recipient (required), confirm.

get_chatA

Retrieve detailed metadata for a WhatsApp chat session by JID, phone number, or contact name. Includes unread count, message count, group membership roster (for group chats), and media breakdowns.

Inputs: chat_id (required).

get_media_pathB

Resolve the absolute filesystem path for a media attachment by media ID or message ID. Checks disk existence, file size, and MIME type.

Inputs: media_id, message_id.

get_message_contextA

Retrieve the conversational context around a specific message. Returns the target message along with preceding and succeeding messages in chronological order.

Inputs: message_id (required), after, before.

list_chatsA

List recent 1:1 and group chat sessions from WhatsApp's local storage. Includes contact name, JID, unread count, last message date, last message text preview, archived status, and pinned status.

Inputs: limit, offset, search, unread_only, +1 more.

list_mediaA

List media attachments (images, PDFs, documents, audio clips, videos) from WhatsApp storage. Verifies whether the media files exist locally on disk and returns sizes, captions, and MIME types.

Inputs: limit, offset, chat_id, media_type.

list_messagesA

List messages from WhatsApp's local storage with rich filtering. Filter by chat, date range (ISO 8601), sender ('me' vs 'other'), media type, or text search. Returns message ID, stanza ID, text, timestamps, sender info, read status, and media details.

Inputs: limit, order, since, until, +5 more.

search_contactsA

Search contacts across WhatsApp chat sessions and contact records. Returns matched contact names, phone numbers, JIDs, and last interaction timestamps.

Inputs: query (required), limit.

search_messagesB

Search message history for specific keywords or phrases. Returns matching messages with full conversation context and timestamps.

Inputs: query (required), limit, offset, chat_id.

send_messageA

Send a WhatsApp message to a phone number or JID. Requires explicit user confirmation (confirm=true) and native OS biometric verification (Touch ID / Windows Hello). Dispatches message using the native desktop WhatsApp application.

Inputs: text (required), recipient (required), confirm.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 11 tools

    Disambiguation4/5

    Most tools target clearly distinct resources: chats, messages, contacts, media, plus two write actions (send vs draft) that are well differentiated by their confirmation semantics. The main overlap is search_messages versus list_messages, which already advertises a text search filter, so an agent could plausibly pick either for the same query.

    Naming Consistency5/5

    Every tool follows a consistent snake_case verb_noun pattern (list_chats, get_chat, search_messages, get_media_path, send_message, draft_message), making intent predictable from the name alone.

    Tool Count5/5

    Eleven tools sit squarely in the ideal 3-15 range and each covers a distinct step of the read/search/send workflow. Nothing feels padded or missing at the count level.

    Completeness4/5

    The surface covers connection diagnostics, chat/message/contact/media discovery, context retrieval, and message dispatch, which is close to full lifecycle for a local WhatsApp reader. Minor gaps remain: no media content download or send-attachment capability, no reply/quote targeting, and no way to mark chats read.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with your personal WhatsApp account, allowing them to search messages and contacts, retrieve chat history, and send messages to individuals or groups. Uses WhatsApp Web API with local data storage for privacy and security.
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to interact with your personal WhatsApp account to search messages, list chats, and send messages. It stores all authentication and message data locally using SQLite for privacy and direct multi-device API connection.
      1
      ISC
    • A
      license
      A
      quality
      C
      maintenance
      MCP server that gives AI agents read and write access to WhatsApp on macOS, reading local chat history offline and sending messages via pre-filled drafts with explicit user confirmation.
      8
      MIT