logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

wa-mcp-gateway

A server implementing the Model Context Protocol (MCP) for interfacing with the WhatsApp Business Platform, facilitating message transmission, group administration, and chat management via FastMCP.

Author

wa-mcp-gateway logo

msaelices

MIT License

Quick Info

GitHub GitHub Stars 21
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

whatsappchatprotocolwhatsapp mcpinteraction whatsappwhatsapp business

WhatsApp MCP Service Gateway

This service establishes a Model Context Protocol (MCP) conduit to interact with the WhatsApp Business API, utilizing the high-performance FastMCP framework.

Introduction

WhatsApp MCP Gateway is a Python-based solution engineered to allow large language models, such as Claude, to access WhatsApp capabilities. It interfaces with the underlying API via GreenAPI. The adoption of FastMCP ensures superior throughput, an enhanced development experience, and a more streamlined code structure.

Capabilities

  • Communication Dispatch: Transmit textual content to specified WhatsApp contacts.
  • Group Administration: Functionality for creating new groups, enumerating members, and managing participant addition/removal.
  • Session Lifecycle: Control over WhatsApp API session states.
  • Conversation Retrieval: Accessing contact lists and historical message archives.

WhatsApp API Abstraction Layer

This utility relies on the whatsapp-api-client-python package to bridge interactions with the WhatsApp Cloud API infrastructure, which necessitates an active GreenAPI subscription.

Configuration Parameters

Operational settings are managed through environment variables:

  • GREENAPI_ID_INSTANCE: Your unique GreenAPI Instance Identifier.
  • GREENAPI_API_TOKEN: Your confidential GreenAPI authentication key.

These must be defined in your environment or populated within the provided .env template file (refer to Setup).

Setup Procedure

bash

Obtain the source code repository

git clone https://github.com/yourusername/whatsapp-mcp-server.git cd whatsapp-mcp-server

Install required libraries (editable mode)

pip install -e .

Prepare configuration file

cp .env-template .env

Input your GreenAPI credentials into the .env file

Operational Use

Execute the MCP service instance:

bash

Launch server on default interfaces (127.0.0.1:8000)

whatsapp-mcp

Define custom host and port

whatsapp-mcp --host 0.0.0.0 --port 9000

For troubleshooting verbosity:

bash whatsapp-mcp --debug

The service operates over the Model Context Protocol (MCP), accessible via HTTP or WebSocket bindings established by FastMCP.

Available Toolset

  • open_session: Initializes a connection context within WhatsApp.
  • send_message: Delivers a payload to a designated chat entity.
  • get_chats: Fetches the roster of active conversations.
  • create_group: Provision a new group entity.
  • get_group_participants: Query the membership list of a specified group.

FastMCP Interface Specification

The WhatsApp MCP Service exposes dual endpoints via FastMCP:

  • WebSocket Endpoint: ws://localhost:8000/mcp
  • HTTP Endpoint: http://localhost:8000/mcp

Testing the exposed methods via curl:

bash

Query the registered functions

curl -X POST http://localhost:8000/mcp/listTools

Invoke a specific function

curl -X POST http://localhost:8000/mcp/callTool \ -H "Content-Type: application/json" \ -d '{"name": "open_session", "arguments": {}}'

Integration with Claude Ecosystem

Integration is performed using the claude mcp register utility:

bash

Register the WhatsApp gateway instance

$ claude mcp add whatsapp -- whatsapp-mcp

Verify registration status

claude mcp list

Initiate Claude interaction session

claude

When interacting with Claude post-integration:

Initializing WhatsApp Linkage

Establish connection to WhatsApp

Sending Communications

Dispatch the text "Greetings" to recipient designated as John Doe

Configuration for Claude Desktop

To incorporate this gateway within Claude Desktop, modify the claude_desktop_config.json manifest:

"mcpServers": { "whatsapp": { "command": "python", "args": ["-m", "whatsapp_mcp"] } }

Direct Executable Call

"mcpServers": { "whatsapp": { "command": "whatsapp-mcp" } }

Containerized Execution (Docker)

"mcpServers": { "whatsapp": { "command": "docker", "args": ["run", "--rm", "-i", "-e", "GREENAPI_ID_INSTANCE=your_instance_id", "-e", "GREENAPI_API_TOKEN=your_api_token", "whatsapp-mcp-server"] } }

Ensure GreenAPI credentials are set either through system variables or the .env file prior to launching the Desktop application.

Command-Line Arguments

Runtime parameters supported by the WhatsApp MCP Service: - --debug: Activates verbose logging output. - --host: Specifies the network interface address for binding (default: 127.0.0.1). - --port: Specifies the TCP listening port (default: 8000).

Diagnostic Procedures

For troubleshooting the MCP infrastructure: - Utilize the dedicated MCP introspection utility: npx @modelcontextprotocol/inspector whatsapp-mcp - Examine logs within the Claude Desktop application's designated log directory (e.g., ~/Library/Logs/Claude/ on macOS). - Interact with the self-documenting FastMCP interface at http://localhost:8000.

Project Maintenance

bash

Install development environment dependencies

pip install -e ".[dev]"

Execute unit tests

pytest

Check code style adherence

flake8 src/

Verify static typing integrity

mypy src/

The project configuration adheres to modern standards using pyproject.toml, segregating core runtime necessities from optional development toolchains (pip install -e ".[dev]").

Licensing

This software is distributed under the stipulations of the MIT License (see LICENSE file for specifics).

== Strategic Business Utility Overview == Business management frameworks encompass all methodologies, computational solutions, software constructs, governance mechanisms, and operational blueprints utilized by enterprises to navigate volatile markets, maintain competitive parity, and elevate overall organizational efficacy.

There is a functional categorization of these utilities aligning with internal organizational silos or management domains—such as resource planning, workflow control, record archival, human capital management, inference engines, oversight mechanisms, etc. A functional dissection often reveals core operational pillars:

Utilities for data ingestion and verification across functional units. Utilities dedicated to monitoring and refinement of organizational throughput. Tools for aggregating synthesized data to support executive determinations. Modern management solutions have undergone rapid metamorphosis spurred by technological acceleration, creating a complex landscape where optimal tool selection for a given organizational context is challenging. This complexity is driven by relentless pressures to reduce operational expenditure, maximize revenue realization, deeply comprehend customer requirements, and execute product delivery precisely to specification. Within this dynamic environment, executive focus must pivot towards a strategic framework for tool adoption rather than passively integrating the newest available technology. Over-reliance on off-the-shelf solutions without proper customization frequently results in systemic instability. Therefore, business management systems must be curated with precision and then diligently tailored to fit the enterprise's unique operational blueprint, reversing the common pitfall of adapting the business to the tool.

== Prevalent Global Selections == Data collected by Bain & Company in 2013 illuminated the global deployment landscape of business technologies, reflecting how their utility aligns with regional economic demands and market conditions. The ten most frequently adopted platforms included:

Strategic Planning Frameworks Customer Relationship Management (CRM) Suites Employee Feedback and Engagement Surveys Competitive Benchmarking Analysis Balanced Scorecard Implementation Core Competency Identification Business Process Outsourcing Governance Organizational Change Management Programs Supply Chain Optimization and Visibility Mission and Vision Statement Articulation Market Segmentation Analysis Total Quality Management (TQM) Systems

== Commercial Software Constructs == Any computational program or collection of programs employed by organizational personnel to execute diverse operational tasks is classified as business application software. These applications serve to augment productivity metrics, provide quantifiable performance measurement, and ensure precision in various corporate functions. The progression began with foundational Management Information Systems (MIS), expanded into comprehensive Enterprise Resource Planning (ERP) architectures, subsequently incorporated Customer Relationship Management (CRM) capabilities, and has now largely migrated toward integrated cloud-based enterprise management environments. While a demonstrable link exists between IT investment and corporate results, two factors crucially amplify value realization: the efficacy of the deployment methodology and the judicious selection and customization of the utilized toolset.

See Also

`