WhatsApp MCP Server
Provides tools for managing WhatsApp sessions, sending messages, retrieving chats, creating groups, getting chat history, sending files, and managing group participants via the GreenAPI service.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WhatsApp MCP Serversend a message to John saying hi"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WhatsApp MCP Server
A WhatsApp server implementation using the Model Context Protocol (MCP) SDK. This server provides a standardized interface for interacting with WhatsApp through the GreenAPI service.
Features
WhatsApp session management
Integration with GreenAPI service
Standardized MCP protocol implementation
TypeScript support
Prerequisites
Node.js (v14 or higher)
npm or yarn
GreenAPI account and credentials
Installation
Clone the repository:
git clone <repository-url>
cd whatsapp-mcp-serverInstall dependencies:
npm installConfiguration
The server requires the following environment variables:
GREENAPI_API_URL: The base URL for GreenAPI serviceGREENAPI_API_TOKEN: Your GreenAPI API token
Usage
Start the server:
npm startThe server will start listening 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 IDinstanceId: GreenAPI instance IDapiTokenInstance: GreenAPI API token
Send Message
Sends a message to a specified chat.
Parameters:
sessionId: Session ID from open_sessionchatId: Recipient chat ID (e.g., 1234567890@c.us or group@g.us)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_sessiongroupName: Name of the group to createparticipants: Array of phone numbers with domain (e.g. 12345@c.us)
Get Chat History
Retrieves recent messages from a specified chat (personal or group).
Parameters:
sessionId: Session ID from open_sessionchatId: Chat ID to retrieve messages from (e.g., 1234567890@c.us or group@g.us)count: Number of messages to retrieve (default: 50)
Important: To receive incoming messages in the chat history, you need to enable the "Receive webhooks on incoming messages and files" setting using the SetSettings method or through the GreenAPI console. Without this setting enabled, the chat history will only show outgoing messages.
Send File
Sends a file to a specified chat.
Parameters:
sessionId: Session ID from open_sessionchatId: WhatsApp chat ID (e.g., 1234567890@c.us)fileUrl: Public URL of the file to sendfileName: (Optional) Name of the file as seen by recipientcaption: (Optional) Caption text to display below the file
Add Participant
Adds a participant to an existing WhatsApp group.
Parameters:
sessionId: Session ID from open_sessiongroupId: ID of the WhatsApp group (e.g., group@g.us)participantChatId: Chat ID of the participant to add (e.g., 1234567890@c.us)
Remove Participant
Removes a participant from an existing WhatsApp group.
Parameters:
sessionId: Session ID from open_sessiongroupId: ID of the WhatsApp group (e.g., group@g.us)participantChatId: Chat ID of the participant to remove (e.g., 1234567890@c.us)
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/piyushgupta53/whatsapp-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server