WhatsApp MCP Server
This server provides a Model Context Protocol (MCP) interface to interact with WhatsApp Business API, enabling you to:
Open WhatsApp sessions
Send text messages to contacts (with optional reply functionality)
Retrieve chat lists with pagination options
Create WhatsApp groups with specified participants
Manage group participants
Enables messaging (send text messages) and group management (create groups, list members, add/remove participants) through the WhatsApp Business API via GreenAPI
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 Doe saying 'Meeting at 3 PM tomorrow'"
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 server that provides a Model Context Protocol (MCP) interface to interact with WhatsApp Business API using FastMCP.
Introduction
WhatsApp MCP Server is a Python implementation that enables language models like Claude to interact with WhatsApp functionality through GreenAPI. It leverages FastMCP for improved performance, better developer experience, and a cleaner implementation.
Related MCP server: YCloud WhatsApp API MCP Server
Features
Messaging: Send text messages to WhatsApp contacts
Group Management: Create groups, list members, add/remove participants
Session Handling: Manage WhatsApp API sessions
Chat History: Retrieve chat lists and message history
WhatsApp API Client
This project uses the whatsapp-api-client-python library to interact with WhatsApp. The client provides access to the WhatsApp Cloud API, which requires a GreenAPI account to use.
Environment Variables
This project uses environment variables for configuration:
GREENAPI_ID_INSTANCE: Your GreenAPI ID instanceGREENAPI_API_TOKEN: Your GreenAPI API token
You can either set these in your environment or use the provided .env file (see Installation instructions).
Installation
# Clone the repository
git clone https://github.com/yourusername/whatsapp-mcp-server.git
cd whatsapp-mcp-server
# Install dependencies
pip install -e .
# Set up environment variables
cp .env-template .env
# Edit the .env file with your GreenAPI credentialsUsage
Run the MCP server:
# Run the MCP server on default host (127.0.0.1) and port (8000)
whatsapp-mcp
# Specify host and port
whatsapp-mcp --host 0.0.0.0 --port 9000For debugging:
whatsapp-mcp --debugThe server communicates using the Model Context Protocol (MCP) and can be accessed via HTTP or WebSockets when running with FastMCP.
Available Tools
open_session: Open a new WhatsApp sessionsend_message: Send a message to a chatget_chats: Get a list of chatscreate_group: Create a new WhatsApp groupget_group_participants: Get the participants of a group
FastMCP API Reference
The WhatsApp MCP Server uses FastMCP to provide both WebSocket and HTTP endpoints:
WebSocket:
ws://localhost:8000/mcpHTTP:
http://localhost:8000/mcp
You can test the API directly using tools like curl:
# List available tools
curl -X POST http://localhost:8000/mcp/listTools
# Call a tool
curl -X POST http://localhost:8000/mcp/callTool \
-H "Content-Type: application/json" \
-d '{"name": "open_session", "arguments": {}}'How to add it to Claude Code
To add a WhatsApp server to Claude, use the claude mcp add command:
# Add the WhatsApp MCP server
$ claude mcp add whatsapp -- whatsapp-mcp
# List existing MCP servers - Validate that the server is running
claude mcp list
# Start claude code
claudeUsing with Claude
Once the WhatsApp MCP server is running, you can interact with it using Claude in your conversations:
Authenticating with WhatsApp
Login to WhatsAppSending a message
Send the "Hello" message to John DoeUsing with Claude Desktop
To use the WhatsApp MCP server with Claude Desktop, you need to add it to your claude_desktop_config.json file:
Using pip installation (recommended)
"mcpServers": {
"whatsapp": {
"command": "python",
"args": ["-m", "whatsapp_mcp"]
}
}Using the executable
"mcpServers": {
"whatsapp": {
"command": "whatsapp-mcp"
}
}Using 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"]
}
}Remember to set your GreenAPI credentials either as environment variables or in your .env file before starting Claude Desktop.
Command-line options
The WhatsApp MCP server accepts these command-line arguments:
--debug: Increase verbosity level for debugging--host: Host to bind the server to (default: 127.0.0.1)--port: Port to bind the server to (default: 8000)
Debugging
For debugging the MCP server:
Use MCP inspector:
npx @modelcontextprotocol/inspector whatsapp-mcpView logs in your Claude Desktop logs directory (typically
~/Library/Logs/Claude/on macOS)Access the FastMCP web interface at http://localhost:8000 for interactive API documentation
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
flake8 src/
# Run type checking
mypy src/The project uses a modern pyproject.toml configuration which includes:
Core dependencies needed for running the application
Development dependencies available with
pip install -e ".[dev]"
License
This project is licensed under the MIT License - see the LICENSE file for details.
Available Tools
5 toolscreate_groupC
Create a new WhatsApp group.
Parameters:
- group_name: Name of the group to create
- participants: List of participant phone numbers
| Name | Required | Description | Default |
|---|---|---|---|
| group_name | Yes | ||
| participants | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but doesn't cover critical aspects: whether this requires specific permissions, if it's idempotent, what happens on failure, rate limits, or the expected return format. The description is minimal and lacks necessary operational context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately concise with a clear heading and bullet points for parameters. Every sentence adds value, and it's front-loaded with the core purpose. No redundant information is present, though it could benefit from more structured behavioral details.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a creation tool with no annotations and no output schema, the description is incomplete. It lacks information on success/failure responses, error handling, dependencies (e.g., session requirements), and behavioral traits. For a mutation tool, this leaves significant gaps for an AI agent to operate effectively.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It lists both parameters with brief explanations ('Name of the group to create', 'List of participant phone numbers'), adding basic meaning beyond the schema's titles. However, it doesn't specify format constraints (e.g., phone number format, group name length limits), leaving gaps in parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'Create' and resource 'new WhatsApp group', making the purpose unambiguous. However, it doesn't explicitly distinguish this from sibling tools like 'get_chats' or 'send_message', though the creation action is inherently different from retrieval/messaging operations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active session via 'open_session'), exclusions, or comparative context with sibling tools like managing existing groups versus creating new ones.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_chatsC
Get a list of chats.
Parameters:
- limit: Maximum number of chats to return (default: 50)
- offset: Offset for pagination (default: 0)
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| offset | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions parameters for pagination but does not describe key traits like whether this is a read-only operation, potential rate limits, authentication needs, or what the output looks like (e.g., format, fields). For a list tool with no annotation coverage, this leaves significant gaps in understanding its behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, starting with the main purpose followed by parameter details in a clear list format. Every sentence adds value, with no redundant or wasted words. However, the structure could be slightly improved by integrating the purpose and parameters more seamlessly, but it remains efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (a list tool with 2 parameters), lack of annotations, and no output schema, the description is incomplete. It covers basic purpose and parameters but misses critical context like output format, error handling, or how it fits with sibling tools. For adequate agent use, it should provide more behavioral and contextual details beyond the minimal information given.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds meaningful semantics beyond the input schema, which has 0% description coverage. It explains that 'limit' is the 'Maximum number of chats to return' with a default of 50, and 'offset' is for 'pagination' with a default of 0, clarifying their purposes. Since there are only 2 parameters and the schema lacks descriptions, this compensates well, though it could detail constraints like min/max values.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states 'Get a list of chats,' which clearly indicates the verb ('Get') and resource ('chats'), providing a basic purpose. However, it lacks specificity about what 'chats' entails (e.g., types, scope) and does not differentiate from sibling tools like 'get_group_participants' or 'open_session,' leaving room for ambiguity. This is a minimal viable description but vague in context.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It does not mention any context, prerequisites, or exclusions, such as how it relates to sibling tools like 'get_group_participants' for participant details or 'open_session' for active chats. Without such information, the agent must infer usage, which reduces effectiveness.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_group_participantsB
Get the participants of a WhatsApp group.
Parameters:
- group_id: The WhatsApp ID of the group
| Name | Required | Description | Default |
|---|---|---|---|
| group_id | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't mention whether this is a read-only operation, requires authentication, has rate limits, or what the return format looks like. For a tool with zero annotation coverage, this is inadequate.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly concise: one clear purpose statement followed by a parameter explanation. Every sentence earns its place with no wasted words, and the information is front-loaded appropriately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple single-parameter tool with no output schema, the description covers the basic purpose and parameter meaning adequately. However, the lack of behavioral information (especially with no annotations) and usage guidance relative to siblings leaves gaps that could hinder effective tool selection.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description explicitly documents the single parameter 'group_id' and explains it as 'The WhatsApp ID of the group', adding meaningful context beyond the schema's basic type information. With 0% schema description coverage, this fully compensates for the schema's lack of detail.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('participants of a WhatsApp group'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_chats' which might also involve group data, so it doesn't reach the highest score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_chats' or 'create_group'. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
open_sessionB
Open a new WhatsApp session.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. While 'Open a new WhatsApp session' implies initialization or connection, it lacks critical details: whether this requires credentials, if it's idempotent, what happens to existing sessions, potential side effects, or error conditions. This leaves significant behavioral gaps for a session management tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple tool and front-loaded with the essential information, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of session management (which often involves authentication, state persistence, and error handling), the description is insufficient. With no annotations, no output schema, and minimal behavioral context, it fails to provide complete guidance. The agent would need to guess about return values, success/failure states, and operational constraints.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description appropriately doesn't discuss parameters, maintaining focus on the tool's purpose without redundancy. A baseline of 4 is appropriate for zero-parameter tools when the schema coverage is complete.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Open') and target resource ('a new WhatsApp session'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from its siblings like 'create_group' or 'send_message', which would require explicit differentiation for a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'get_chats' or 'send_message'. There's no mention of prerequisites (e.g., authentication status), timing considerations, or explicit exclusions, leaving the agent with minimal contextual direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
send_messageC
Send a message to a chat.
Parameters:
- phone_number: The phone number of the recipient
- content: The content of the message to send
- reply_to: ID of the message to reply to (optional)
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | ||
| phone_number | Yes | ||
| reply_to | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Send a message' implies a write/mutation operation, the description doesn't address critical behavioral aspects like required permissions, rate limits, whether messages are encrypted, delivery confirmation, or what happens on failure. This leaves significant gaps for an agent to understand the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is efficiently structured with a clear purpose statement followed by a bulleted parameter list. Every sentence serves a purpose, though the parameter explanations could be slightly more detailed given the lack of schema descriptions. The formatting is clean and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 3-parameter mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what the tool returns (success/failure indicators, message ID, etc.), doesn't address error conditions, and provides minimal behavioral context. The parameter explanations help but don't compensate for the overall contextual gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description explicitly lists all three parameters with brief explanations, adding meaningful context beyond the schema's 0% description coverage. It clarifies that 'reply_to' is optional and identifies what each parameter represents. However, it doesn't provide format details (e.g., phone number format, content length limits) or deeper semantic constraints.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Send a message') and the target resource ('to a chat'), providing a specific verb+resource combination. However, it doesn't differentiate this tool from potential sibling tools like 'create_group' or 'open_session', which might also involve messaging functionality in some contexts.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'create_group' for group messaging or 'get_chats' for retrieving messages. There's no mention of prerequisites, appropriate contexts, or exclusions for this messaging operation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Most tools have distinct purposes: creating groups, listing chats, getting group participants, opening sessions, and sending messages. However, 'get_chats' could potentially overlap with group-related functionality since groups are a type of chat, but the descriptions clarify their focus areas.
The naming follows a consistent verb_noun pattern (e.g., create_group, get_chats, send_message) with clear, descriptive names. The only minor deviation is 'open_session', which uses a verb_adjective_noun structure but remains readable and fits the pattern conceptually.
With 5 tools, the count is reasonable for a WhatsApp server, covering core operations like messaging, group management, and session handling. It might benefit from additional tools for actions like deleting messages or managing contacts, but it's well-scoped for basic functionality.
The toolset covers key areas such as sending messages, creating groups, and retrieving chats/participants, but has notable gaps. For example, there are no tools for updating or deleting groups, managing contacts, or handling message reactions, which could limit agent workflows in a messaging domain.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
MCP server for Sendbird — chat users, channels, members, and messages from your AI client.
WhatsApp CRM for AI agents: search contacts, read chats, manage the sales pipeline, send messages.
Drive your real WhatsApp inbox from Claude — send, reply, label, assign, and triage via TimelinesAI.
Related MCP Servers
- AlicenseCqualityFmaintenanceA Model Context Protocol server that connects your personal WhatsApp account to AI agents like Claude, enabling them to search messages, view contacts, retrieve chat history, and send messages via WhatsApp.71372ISC
- FlicenseCqualityFmaintenanceA server that enables AI models like Claude to directly interact with YCloud WhatsApp API through natural language, automatically generating tools from the OpenAPI specification.1911
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables interaction with WhatsApp through local stdio or remote HTTP/SSE connections. It allows users to send messages, manage groups, and access chat history using natural language.393MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that connects Claude and other LLM clients to WhatsApp via the Baileys library. Enables sending and receiving messages, listing chats, downloading media, and more.47MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/msaelices/whatsapp-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server