Get the FREE Ultimate OpenClaw Setup Guide →

whatsapp

Whatsapp MCP Server implemented in Python

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio msaelices-whatsapp-mcp-server python -m whatsapp_mcp \
  --env GREENAPI_API_TOKEN="Your GreenAPI API token" \
  --env GREENAPI_ID_INSTANCE="Your GreenAPI ID instance"

How to use

The WhatsApp MCP Server is a Python implementation that exposes a Model Context Protocol (MCP) interface to interact with WhatsApp via the GreenAPI-backed WhatsApp Cloud API. It enables language models and tools to open sessions, send messages, manage groups, and access chat history through a FastMCP-powered server. The server supports both HTTP and WebSocket access for MCP calls, and it exposes tools such as open_session, send_message, get_chats, create_group, and get_group_participants so you can orchestrate WhatsApp interactions from your agent or Claude workflow. After starting the server, you can query the MCP endpoints, list available tools, and invoke specific tools with JSON payloads to perform WhatsApp actions.

To use it with Claude or other MCP-enabled clients, run the server locally or in your environment, then connect to the MCP endpoints to discover and call tools. The server can be integrated into Claude Desktop or Claude Cloud workflows, and you can also attach it to Claude via Claude Code as described in the docs. The available tools cover common WhatsApp operations: opening a session, sending messages to chats, listing chats, creating groups, and retrieving group participants.

How to install

Prerequisites:

  • Python 3.8+ (recommended)
  • pip (Python package manager)
  • Access to a GreenAPI account with valid credentials (GREENAPI_ID_INSTANCE and GREENAPI_API_TOKEN)

Installation steps:

  1. Clone the repository or install the package in editable mode: git clone https://github.com/yourusername/whatsapp-mcp-server.git cd whatsapp-mcp-server pip install -e .

  2. Set up environment variables (use a .env file or export variables): cp .env-template .env

    Edit .env and set GREENAPI_ID_INSTANCE and GREENAPI_API_TOKEN

    export GREENAPI_ID_INSTANCE=your_instance_id export GREENAPI_API_TOKEN=your_api_token

  3. Run the MCP server (default host 127.0.0.1, port 8000): python -m whatsapp_mcp

  4. Optional: run with custom host/port: python -m whatsapp_mcp --host 0.0.0.0 --port 9000

Note: If you prefer to install and run via Docker or other runners, refer to the deployment options in the repository README and Claude integration instructions.

Additional notes

Environment variables can be provided through your shell or a .env file (supported by typical Python deployments). Ensure GreenAPI credentials are kept secure and not checked into version control. If you encounter connection issues, verify that GREENAPI_ID_INSTANCE and GREENAPI_API_TOKEN are correct and that the GreenAPI service is reachable from your environment. The MCP server exposes both HTTP and WebSocket endpoints at the configured host/port (default http://127.0.0.1:8000/mcp and ws://127.0.0.1:8000/mcp). When integrating with Claude Desktop, you can also run via Docker as shown in the README, passing credentials as environment variables. If you update environment variables, restart the MCP server to apply changes. For debugging, you can enable verbose logs in your client or run with a debug flag if supported by the server, and inspect logs found in your system’s standard logs directory.

Related MCP Servers

Sponsor this space

Reach thousands of developers