Skip to main content

WhatsApp Multi-Capability Protocol (MCP) Server

Project description

Ragazap

A WhatsApp Multi-Capability Protocol (MCP) server that integrates the WhatsApp Cloud API with AI capabilities.

Features

  • Receive and process WhatsApp messages via webhook
  • Expose MCP WebSocket endpoint for AI agent connections
  • Send messages to WhatsApp contacts
  • Store and retrieve conversation history in Redis
  • Support for text messages
  • Tools for AI agents to interact with WhatsApp
  • Two operation modes: Standalone and Client

Operation Modes

Standalone Mode

In standalone mode, the server operates independently with its own WhatsApp Business API credentials. This mode is useful for:

  • Direct integration with WhatsApp
  • Testing and development
  • Single-tenant deployments

Client Mode

In client mode, the server expects WhatsApp credentials to be provided by the client through the MCP protocol. This mode is useful for:

  • Multi-tenant deployments
  • Managed service providers
  • Clients managing their own WhatsApp Business accounts

Installation

From PyPI (Recommended)

The package is available on PyPI and can be installed using pip:

# Install the latest stable version
pip install ragazap

Direct Installation from GitHub

For development or the latest version:

# Clone the repository
git clone https://github.com/jquant/whatsapp-mcp-server.git
cd whatsapp-mcp-server

# Install the package in development mode
pip install -e .

# Install with development dependencies
pip install -e ".[dev]"

System Requirements

  • Python 3.8 or higher
  • Redis (optional, for conversation history)
  • WhatsApp Business API access (for standalone mode)

Usage

Environment Variables

Create a .env file with the following variables:

# Mode Configuration
STANDALONE_MODE=false  # Set to true for standalone mode

# WhatsApp API Configuration (Required in standalone mode)
META_API_VERSION=v22.0
META_APP_SECRET=your_app_secret
WHATSAPP_API_TOKEN=your_api_token
WEBHOOK_VERIFY_TOKEN=your_verify_token
BUSINESS_PHONE_NUMBER_ID=your_phone_number_id

# Server Configuration (Required in both modes)
WEBHOOK_HOST=0.0.0.0
WEBHOOK_PORT=8000

# Redis Configuration (Optional in both modes)
UPSTASH_REDIS_URL=your_redis_url
UPSTASH_REDIS_TOKEN=your_redis_token

# Optional Configuration
MAX_CONVERSATION_HISTORY_LENGTH=100
CONVERSATION_EXPIRATION_DAYS=7
LOG_LEVEL=INFO

Running the Server

# Using the CLI command (if installed via pip)
ragazap

# Or directly with Python
python -m app.main

API Endpoints

  • Webhook: POST /api/v1/webhook
  • MCP WebSocket: ws://host:port/api/v1/mcp
  • Health Check: GET /

Development

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

Building the Package

# Install build tools
pip install build twine

# Build the package
python -m build

# Publish to Test PyPI (for testing)
python scripts/publish_to_pypi.py --test

# Publish to PyPI
python scripts/publish_to_pypi.py

This will create both a source distribution (.tar.gz) and a wheel (.whl) in the dist/ directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ragazap-0.1.0.tar.gz (43.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ragazap-0.1.0-py3-none-any.whl (50.1 kB view details)

Uploaded Python 3

File details

Details for the file ragazap-0.1.0.tar.gz.

File metadata

  • Download URL: ragazap-0.1.0.tar.gz
  • Upload date:
  • Size: 43.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ragazap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9a589973f08394d69b27ba238120519a8218f84c50fe0d5404c4deb958a19877
MD5 f57dc4c35647818265ae7541d50613d2
BLAKE2b-256 0ef18c0331851e5a69fabe88cb6ebd4a90180cba93cfc48e7e7ec4b654ce1204

See more details on using hashes here.

File details

Details for the file ragazap-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ragazap-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 50.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ragazap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40f2f9f6164fbb85e7639e7d3080003a9b6bb987924f7e12e4f322964a535258
MD5 819a36c33830d35e2b90227c7d4e0c03
BLAKE2b-256 898cc2793ffa470a3f3db2f2928b6b83a062b06e7f693b2f41fc465e3090766b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page