piyushgupta53_whatsapp_mcp_server

piyushgupta53_whatsapp_mcp_server

by piyushgupta53
A server implementing the Model Context Protocol (MCP) to manage WhatsApp interactions via GreenAPI.

WhatsApp MCP Server for GreenAPI Integration

Overview

The WhatsApp MCP Server is a server implementation using the Model Context Protocol (MCP) SDK. It provides a standardized interface for interacting with WhatsApp through the GreenAPI service, enabling seamless integration and management of WhatsApp sessions.

Features

  • WhatsApp Session Management: Easily manage WhatsApp sessions using GreenAPI credentials.
  • GreenAPI Integration: Direct integration with the GreenAPI service for WhatsApp interactions.
  • MCP Protocol Implementation: Standardized implementation of the MCP protocol for consistent communication.
  • TypeScript Support: Built with TypeScript for type safety and developer productivity.

Prerequisites

Before you begin, ensure you have the following:
- Node.js (v14 or higher)
- npm or yarn
- A GreenAPI account and credentials

Installation

  1. Clone the repository:
    shell git clone <repository-url> cd whatsapp-mcp-server
  2. Install dependencies:
    shell npm install

Configuration

The server requires the following environment variables:
- GREENAPI_API_URL: The base URL for the GreenAPI service.
- GREENAPI_API_TOKEN: Your GreenAPI API token.

Usage

  1. Start the server:
    shell npm start
  2. The server will listen for MCP protocol messages through standard input/output.

Available Tools

Open Session

Opens a new WhatsApp session using GreenAPI credentials.

Parameters:
- sessionId: A unique session ID.
- instanceId: GreenAPI instance ID.
- apiTokenInstance: GreenAPI API token.

Send Message

Sends a message to a specified chat.

Parameters:
- sessionId: Session ID from open_session.
- chatId: Recipient chat ID (e.g., [email protected] or [email protected]).
- message: The message to send.

Get Chats

Retrieves the list of available chats.

Parameters:
- sessionId: Session ID from open_session.

Create Group

Creates a new WhatsApp group.

Parameters:
- sessionId: Session ID from open_session.
- groupName: Name of the group to create.
- participants: Array of phone numbers with domain (e.g., [email protected]).

Get Chat History

Retrieves recent messages from a specified chat (personal or group).

Parameters:
- sessionId: Session ID from open_session.
- chatId: Chat ID to retrieve messages from (e.g., [email protected] or [email protected]).
- count: Number of messages to retrieve (default: 50).

Important: Enable "Receive webhooks on incoming messages and files" in GreenAPI settings to include incoming messages in the chat history.

Send File

Sends a file to a specified chat.

Parameters:
- sessionId: Session ID from open_session.
- chatId: WhatsApp chat ID (e.g., [email protected]).
- fileUrl: Public URL of the file to send.
- fileName: (Optional) Name of the file as seen by the recipient.
- caption: (Optional) Caption text to display below the file.

Add Participant

Adds a participant to an existing WhatsApp group.

Parameters:
- sessionId: Session ID from open_session.
- groupId: ID of the WhatsApp group (e.g., [email protected]).
- participantChatId: Chat ID of the participant to add (e.g., [email protected]).

Remove Participant

Removes a participant from an existing WhatsApp group.

Parameters:
- sessionId: Session ID from open_session.
- groupId: ID of the WhatsApp group (e.g., [email protected]).
- participantChatId: Chat ID of the participant to remove (e.g., [email protected]).

About

The WhatsApp MCP Server is a powerful tool for integrating WhatsApp functionality into your applications using the GreenAPI service. It simplifies session management and provides a standardized interface for various WhatsApp operations.

Resources

Stars

2 stars

Watchers

1 watching

Forks

0 forks

Report repository

Releases

No releases published.

Packages 0

No packages published.

Languages

Features & Capabilities

Categories
mcp_server model_context_protocol typescript whatsapp greenapi api_integration session_management

Implementation Details

Stats

0 Views
2 GitHub Stars

Repository Info

piyushgupta53 Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300