PyWA MCP Server
Integrates with Meta's WhatsApp Cloud API for WhatsApp Business messaging functionality, requiring credentials from the Meta Developer Console.
Provides comprehensive WhatsApp Business API integration with 18 tools for sending messages, media (images, videos, documents, audio, stickers), locations, contacts, reactions, interactive elements (buttons, lists), templates, and message status management (read receipts, typing indicators).
Click on "Deploy 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., "@PyWA MCP Server send a WhatsApp message to +1234567890 saying 'Your order is ready for pickup!'"
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.
PyWA MCP Server
A comprehensive Model Context Protocol (MCP) server that exposes full WhatsApp Business API functionality using the PyWA library.
Features
This MCP server provides 18 WhatsApp tools organized into four categories:
Messaging Tools (12)
Text & Media:
send_message,send_image,send_video,send_document,send_audio,send_stickerLocation & Contacts:
send_location,request_location,send_contactInteractions:
send_reaction,remove_reaction,upload_media
Interactive Tools (2)
Interactive Messages:
send_message_with_buttons,send_message_with_list
Template Tools (2)
Template Messaging:
send_template,get_templates
Status Tools (2)
Message Status:
mark_message_as_read,indicate_typing
Related MCP server: WAHA MCP Server
Setup
Install dependencies:
uv syncConfigure WhatsApp credentials:
cp .env.example .env # Edit .env with your WhatsApp Cloud API credentialsRun the server:
# Production mode uv run python server.py # Development mode with Web UI (recommended for testing) uv run fastmcp dev --ui-port 6275 server.py
Configuration
Set these environment variables:
WHATSAPP_PHONE_ID- Your WhatsApp Business phone number IDWHATSAPP_TOKEN- Your WhatsApp Cloud API access token
Get these from your Meta Developer Console.
Development & Testing
Web UI (Recommended for Development)
Test your WhatsApp tools interactively with the FastMCP Inspector:
uv run fastmcp dev --ui-port 6275 server.pyOpen http://localhost:6275 in your browser to:
View all 15+ WhatsApp tools
Test messaging, buttons, lists, templates
See real-time API calls and responses
Debug with comprehensive error messages
Testing with Real WhatsApp
Get WhatsApp Business API credentials from Meta Developer Console
Add test phone numbers in your Meta Developer Console
Use the Web UI to send messages to test numbers
Verify messages appear in WhatsApp
Claude Desktop Integration
Quick Setup (One Command)
Install directly in Claude Desktop config:
{
"mcpServers": {
"pywa-whatsapp": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/Jem-HR/pywa-mcp-server.git",
"pywa-mcp-server"
],
"env": {
"WHATSAPP_PHONE_ID": "your_phone_id",
"WHATSAPP_TOKEN": "your_token"
}
}
}
}This automatically downloads and runs the server without manual installation.
Manual Configuration
Locate Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add server configuration:
{ "mcpServers": { "pywa-whatsapp": { "command": "uv", "args": [ "run", "python", "/path/to/pywa-mcp-server/server.py" ], "env": { "WHATSAPP_PHONE_ID": "your_phone_number_id", "WHATSAPP_TOKEN": "your_whatsapp_cloud_api_token" } } } }Restart Claude Desktop
Verify connection: Look for the 🔨 hammer icon in Claude Desktop
Using WhatsApp Tools in Claude Desktop
Once connected, you can ask Claude to:
Send Messages:
Send a WhatsApp message to +1234567890 saying "Hello from Claude!"Create Interactive Buttons:
Send a WhatsApp message with buttons asking "Are you available?"
with Yes/No options to +1234567890Build Menu Lists:
Create a WhatsApp menu for a restaurant with sections for Main Courses
and Beverages, send to +1234567890Show Typing Indicators:
Show typing indicator for WhatsApp message ID wamid.XXX to let the user
know I'm preparing a responseSend Media:
Send an image from URL https://example.com/image.jpg with caption
"Check this out!" to +1234567890Use Templates:
Send the "welcome_message" template in English to +1234567890Available WhatsApp Tools in Claude
Claude has access to these WhatsApp capabilities:
📝 Messaging (12 tools):
send_message- Text messages with headers/footerssend_image- Images with captionssend_video- Videos with captionssend_document- Files with custom namessend_audio- Audio messagessend_sticker- WebP stickerssend_location- GPS coordinatesrequest_location- Ask user for locationsend_contact- Contact cardssend_reaction- Emoji reactionsremove_reaction- Remove reactionsupload_media- Upload files to WhatsApp
🎛️ Interactive (2 tools):
send_message_with_buttons- Up to 3 reply buttonssend_message_with_list- Selection lists with sections
📋 Templates (2 tools):
send_template- Pre-approved template messagesget_templates- List available templates
⚡ Status (2 tools):
mark_message_as_read- Mark messages as readindicate_typing- Show typing indicator
Architecture
The server uses a modular architecture:
server.py - Main MCP server using FastMCP framework
tools/messaging.py - Text, media, location, contact, and reaction tools
tools/interactive.py - Button, list, catalog, and flow message tools
tools/templates.py - Template messaging and authentication tools
All tools follow consistent patterns:
Async implementation for optimal performance
Comprehensive error handling with success/error responses
Direct mapping to PyWA library methods
Full type safety and parameter validation
Tool Examples
send_message
Send a text message to a WhatsApp user.
{
"to": "+1234567890",
"text": "Hello from PyWA MCP Server!",
"preview_url": true,
"reply_to_message_id": "optional_message_id"
}send_button_message
Send an interactive message with reply buttons.
{
"to": "+1234567890",
"text": "Choose an option:",
"buttons": [
{"id": "option1", "title": "Option 1"},
{"id": "option2", "title": "Option 2"}
],
"header": "Quick Actions",
"footer": "Select one option"
}send_template
Send a pre-approved template message.
{
"to": "+1234567890",
"template": "hello_world",
"language": "en",
"components": [
{
"type": "body",
"parameters": [
{"type": "text", "text": "John Doe"}
]
}
]
}Troubleshooting
Common Issues
❌ "Missing required environment variables"
Ensure
.envfile exists withWHATSAPP_PHONE_IDandWHATSAPP_TOKENCheck values are correct from Meta Developer Console
❌ "Cannot import name 'X' from pywa.types"
Run
uv syncto update dependenciesPyWA version must be >=3.0.0
❌ "401 Unauthorized" from WhatsApp API
Verify your
WHATSAPP_TOKENis current and has proper permissionsCheck token hasn't expired in Meta Developer Console
❌ Claude Desktop doesn't show tools
Check
claude_desktop_config.jsonsyntax is valid JSONEnsure file paths are absolute, not relative
Restart Claude Desktop after config changes
Look for 🔨 hammer icon to confirm connection
❌ "Typing indicator failed"
indicate_typingrequires a valid message ID from an incoming messageCannot use with arbitrary message IDs - must be from actual WhatsApp messages received
Debug Mode
Enable detailed logging by setting environment variable:
export PYTHONPATH=/path/to/pywa-mcp-server
LOGLEVEL=DEBUG uv run python server.pyGetting Help
Check the PyWA Documentation for WhatsApp API details
Review Meta Developer Console for API setup
Test tools individually using the Web UI before Claude Desktop integration
License
MIT
Available Tools
18 toolsget_templatesB
Get list of available WhatsApp templates.
Args: limit: Maximum number of templates to return (default: 100) name: Optional template name filter
Returns: Dictionary with templates list
Inputs: limit, name. Returns: object
indicate_typingA
Show typing indicator to WhatsApp user.
This marks a message as read and displays a typing indicator to show the user that you are preparing a response. Best practice when it will take a few seconds to respond.
IMPORTANT NOTES:
Typing indicator lasts max 25 seconds or until you send a message
Only use if you are actually going to respond
Will be dismissed when you send the next message
Improves user experience for delayed responses
EXAMPLE: { "message_id": "wamid.HBgNMjc2NTY4NjY5MDUVAgARGBI5QTNDMEM3RjVBMzY2Q0Y4AA==" }
Args: message_id: The WhatsApp message ID to respond to (from incoming message) sender: Optional phone ID (defaults to client's phone ID)
Returns: Dictionary with success status
Inputs: message_id (required), sender. Returns: object
mark_message_as_readC
Mark a message as read.
Args: message_id: The WhatsApp message ID to mark as read sender: Optional phone ID
Returns: Dictionary with success status
Inputs: message_id (required), sender. Returns: object
remove_reactionB
Remove a reaction from a message.
Args: to: Phone number or WhatsApp ID message_id: ID of message to remove reaction from sender: Optional sender phone ID
Returns: Dictionary with success status
Inputs: to (required), message_id (required), sender. Returns: object
request_locationC
Request user's location.
Args: to: Phone number or WhatsApp ID text: Message text asking for location reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), text (required), reply_to_message_id. Returns: object
send_audioB
Send an audio message.
Args: to: Phone number or WhatsApp ID audio: Audio URL or media ID reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), audio (required), reply_to_message_id. Returns: object
send_contactB
Send a contact card.
Args: to: Phone number or WhatsApp ID contact_name: Name of the contact contact_phone: Phone number of the contact reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), contact_name (required), contact_phone (required), reply_to_message_id. Returns: object
send_documentC
Send a document message.
Args: to: Phone number or WhatsApp ID document: Document URL or media ID filename: Optional filename for the document caption: Optional document caption footer: Optional footer text reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), document (required), filename, caption, +2 more. Returns: object
send_imageB
Send an image message.
Args: to: Phone number or WhatsApp ID image: Image URL or media ID caption: Optional image caption footer: Optional footer text reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), image (required), caption, footer, +1 more. Returns: object
send_locationB
Send a location message.
Args: to: Phone number or WhatsApp ID latitude: Latitude of the location longitude: Longitude of the location name: Optional location name address: Optional location address reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), latitude (required), longitude (required), name, +2 more. Returns: object
send_messageA
Send a text message to a WhatsApp user.
Args: to: Phone number (with country code) or WhatsApp ID text: The text message content header: Optional header text (for interactive messages) footer: Optional footer text (for interactive messages) preview_url: Whether to show URL previews (default False) reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), text (required), header, footer, +2 more. Returns: object
send_message_with_buttonsA
Send a message with reply buttons (up to 3).
CONSTRAINTS:
Maximum 3 buttons per message
Button title: max 20 characters
Button ID (callback_data): max 256 characters
Header text: max 60 characters (if provided)
Footer text: max 60 characters (if provided)
EXAMPLE: { "to": "+1234567890", "text": "Choose an option:", "buttons": [ {"id": "option_1", "title": "Yes"}, {"id": "option_2", "title": "No"}, {"id": "option_3", "title": "Maybe"} ], "header": "Quick Question", "footer": "Select one option" }
Args: to: Phone number (with country code) or WhatsApp ID text: Message body text (main message content) buttons: List of buttons with 'id' and 'title' keys (max 3) header: Optional header text (appears above main text) footer: Optional footer text (appears below buttons) reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), text (required), buttons (required), header, +2 more. Returns: object
send_message_with_listA
Send a message with a selection list.
CONSTRAINTS:
Maximum 10 sections per list
Maximum 10 rows total across all sections
Button text: max 20 characters
Section title: max 24 characters
Row title: max 24 characters
Row description: max 72 characters
Row ID (callback_data): max 200 characters
Header text: max 60 characters (if provided)
Footer text: max 60 characters (if provided)
EXAMPLE: { "to": "+1234567890", "text": "Choose from our menu:", "button_text": "View Menu", "sections": [ { "title": "Main Courses", "rows": [ {"id": "burger", "title": "Burger", "description": "Beef burger with fries"}, {"id": "pizza", "title": "Pizza", "description": "Margherita pizza"} ] }, { "title": "Beverages", "rows": [ {"id": "coke", "title": "Coca Cola", "description": "Cold refreshing drink"}, {"id": "water", "title": "Water", "description": "Still or sparkling"} ] } ], "header": "Restaurant Menu", "footer": "All items available today" }
Args:
to: Phone number (with country code) or WhatsApp ID
text: Message body text (main message content)
button_text: Text shown on the list button (triggers the list)
sections: List of sections, each with 'title' and 'rows' arrays
header: Optional header text (appears above main text)
footer: Optional footer text (appears below list button)
reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), text (required), button_text (required), sections (required), +3 more. Returns: object
send_reactionB
Send a reaction to a message.
Args: to: Phone number or WhatsApp ID emoji: Reaction emoji message_id: ID of message to react to sender: Optional sender phone ID
Returns: Dictionary with success status
Inputs: to (required), emoji (required), message_id (required), sender. Returns: object
send_stickerB
Send a sticker message.
Args: to: Phone number or WhatsApp ID sticker: Sticker URL or media ID (must be webp format) reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), sticker (required), reply_to_message_id. Returns: object
send_templateA
Send a WhatsApp template message.
Args: to: Phone number or WhatsApp ID name: Template name/ID language: Template language code (default: en) params: Optional template parameters (header, body, button components) reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), name (required), language, params, +1 more. Returns: object
send_videoB
Send a video message.
Args: to: Phone number or WhatsApp ID video: Video URL or media ID caption: Optional video caption footer: Optional footer text reply_to_message_id: Message ID to reply to
Returns: Dictionary with success status and message ID
Inputs: to (required), video (required), caption, footer, +1 more. Returns: object
upload_mediaA
Upload media file to WhatsApp servers.
Args: media_path: Path to media file mime_type: Optional MIME type
Returns: Dictionary with media ID
Inputs: media_path (required), mime_type. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools have distinct purposes, such as sending different media types (audio, image, video) or handling specific interactions (reactions, typing indicators). However, there is some potential overlap between send_message, send_message_with_buttons, and send_message_with_list, as all involve sending text-based messages with varying interactive elements, which could cause confusion if the agent doesn't carefully read descriptions.
All tool names follow a consistent verb_noun pattern with snake_case, such as send_message, upload_media, and mark_message_as_read. This uniformity makes the tool set predictable and easy to navigate, with no deviations in naming conventions.
With 18 tools, the count is slightly high but reasonable for a WhatsApp API server that needs to cover various message types, media uploads, and interaction features. It's well-scoped for the domain, though it could be streamlined by grouping similar send functions, but each tool earns its place for specific use cases.
The tool set provides comprehensive coverage for WhatsApp messaging, including sending all media types (text, audio, image, video, document, sticker, contact, location), handling templates, reactions, typing indicators, read receipts, and media uploads. There are no obvious gaps; it supports full CRUD-like operations for message interactions and user engagement.
Related MCP Connectors
Send WhatsApp messages and templates, manage chats, contacts, broadcasts and AI agents.
Send WhatsApp messages, templates and media, and manage templates via the WhatsApp Business API.
Official WhatsApp Business API (Meta Cloud API) for your own CRM or SaaS, from WasapFlow, a Meta Tech Provider. Your AI can search the Bridge docs, list connected numbers, create Embedded Signup links so clients connect their own WhatsApp (Coexistence supported), send text and template messages, list templates, check and retry failed webhooks, see usage and open support tickets. Docs tools work without a key; account tools use the x-partner-key header.
Send and read WhatsApp messages, templates, chats and campaigns through the official Business API.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables WhatsApp Business messaging through Evolution API with support for creating instances, sending messages using dynamic templates, and managing contacts and groups. Includes 10+ predefined message templates for common business scenarios like order confirmations, appointment reminders, and promotional messages.25MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with WhatsApp through the WAHA (WhatsApp HTTP API) platform. Supports chat management, message operations including sending/receiving messages, and marking chats as read.5211ISC
- AlicenseBqualityCmaintenanceBridges the WhatsApp HTTP API with AI assistants to enable full control over messaging, chat management, and interactive workflows through 63 specialized tools. It allows users to automate WhatsApp tasks and receive real-time AI feedback directly on their mobile devices.636MIT
- AlicenseCqualityDmaintenance244 WhatsApp Business tools for AI agents: send messages, automate workflows, run marketing campaigns, and manage CRM. Supports Streamable HTTP and stdio transports.1002MIT