WhatsApp MCP Server

WhatsApp MCP Server

A Python-based MCP server that automates WhatsApp Web using Playwright to manage chats and messages. It enables users to list conversations, send messages, and retrieve history through a local browser automation interface.

Category
Visit Server

README

WhatsApp MCP Server

A local Python MCP server that automates WhatsApp Web through Playwright and exposes a small set of WhatsApp tools over stdio.

What this project does

  • Runs as an MCP server over stdio.
  • Uses Python instead of Node.
  • Uses Playwright with Chromium.
  • Persists the WhatsApp Web session under ./data/profile.

Current tools

  • get_auth_status
  • wait_until_ready
  • list_recent_chats
  • send_message
  • get_recent_messages
  • shutdown_browser

send_message and get_recent_messages accept either phone_number or chat_name. chat_name works by searching the existing WhatsApp sidebar/chat list. For larger get_recent_messages requests, the server attempts to scroll upward and load older visible history before extracting messages.

Important limitations

  • This project automates WhatsApp Web, not the official WhatsApp Business API.
  • WhatsApp Web markup changes regularly, so selectors may need maintenance.
  • You should use a dedicated account and review WhatsApp's terms before production use.
  • The repository is initialized as a Git repository on the main branch.

Recommended local setup

  1. Copy the environment file:
cp .env.example .env
  1. Create a virtual environment:
python3 -m venv .venv
source .venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
python3 -m playwright install chromium
  1. For local login, set WHATSAPP_HEADLESS=false in .env.

  2. Start the server locally:

PYTHONPATH=src python3 -m whatsapp_mcp.main
  1. From your MCP client, call get_auth_status.

  2. If a browser window opens, scan the QR code directly in that window.

  3. Call wait_until_ready.

Example MCP client configuration

For Claude Desktop or another MCP client, local Python execution is the recommended configuration.

{
  "mcpServers": {
    "whatsapp": {
      "command": "/absolute/path/to/project/.venv/bin/python3",
      "args": [
        "-m",
        "whatsapp_mcp.main"
      ],
      "cwd": "/absolute/path/to/project",
      "env": {
        "PYTHONPATH": "/absolute/path/to/project/src",
        "WHATSAPP_HEADLESS": "false",
        "WHATSAPP_PROFILE_DIR": "/absolute/path/to/project/data/profile"
      }
    }
  }
}

Tool examples

get_auth_status

{
  "name": "get_auth_status",
  "arguments": {}
}

send_message

{
  "name": "send_message",
  "arguments": {
    "chat_name": "John Appleseed",
    "text": "Hello from the WhatsApp MCP server"
  }
}

get_recent_messages

{
  "name": "get_recent_messages",
  "arguments": {
    "chat_name": "John Appleseed",
    "count": 10
  }
}

Project structure

.
├── docs/
├── src/whatsapp_mcp/
├── .env.example
└── pyproject.toml

Documentation

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured