WhatsApp MCP Server
claude mcp add --transport stdio piyushgupta53-whatsapp-mcp-server node path/to/server.js \ --env GREENAPI_API_URL="The base URL for GreenAPI service" \ --env GREENAPI_API_TOKEN="Your GreenAPI API token"
How to use
This MCP server provides a standardized interface to interact with WhatsApp via the GreenAPI service using the MCP (Model Context Protocol) framework. It supports session management, sending and receiving messages, chat history retrieval, and basic group management operations. Through the available tools, you can open a WhatsApp session, send messages or files, fetch chats, create groups, and manage group participants. The server exposes these capabilities through MCP-compatible commands that can be invoked by MCP clients or other services in your workflow.
To use the server, first ensure the required GreenAPI credentials are provided via environment variables. Start the server using the configured command, and then issue MCP requests to the server’s open_session to initialize a session. Once a session is open, you can call the Send Message, Get Chats, Create Group, Get Chat History, Send File, Add Participant, and Remove Participant tools by supplying the appropriate parameters (sessionId, chatId, groupId, etc.). For incoming messages, enable webhook delivery for incoming messages and files in GreenAPI or via the SetSettings method so chat histories reflect both sent and received messages.
How to install
Prerequisites:
- Node.js v14 or higher
- npm or yarn
- Access to a GreenAPI account with API URL and token
Installation steps:
-
Clone the repository git clone <repository-url> cd whatsapp-mcp-server
-
Install dependencies npm install
or
yarn install
-
Configure environment variables Create a .env file or export variables in your environment: GREENAPI_API_URL="https://api.greenapi.com" # base URL for GreenAPI GREENAPI_API_TOKEN="YOUR_GREENAPI_TOKEN" # your GreenAPI token
-
Start the server npm start
or if using a different script, ensure it runs the node server.js entrypoint
-
Verify the server is listening for MCP messages on standard I/O as described in the README.
Additional notes
Notes and tips:
- Ensure GREENAPI_API_URL and GREENAPI_API_TOKEN are correct; invalid credentials will prevent session creation.
- The server relies on GreenAPI webhook settings to receive incoming messages; enable Receive webhooks on incoming messages and files in GreenAPI settings for complete chat history behavior.
- The path to the Node.js entrypoint may vary; if your build outputs to dist/index.js, update the mcp_config accordingly.
- When deploying, consider setting up proper logging and error handling for MCP requests to aid debugging.
- If you need to run in a container, you can adapt the command to docker with the appropriate image and entrypoint, and pass GREENAPI variables as environment variables.
- The available tools require a valid opened session (sessionId). Always open a session first via the Open Session tool before calling Send Message or other session-scoped operations.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud