Provides comprehensive WhatsApp functionality through the WSAPI service, enabling AI assistants to send messages, manage contacts and groups, handle chat operations, set presence status, manage account settings, and perform session management including QR code login and device pairing.
@wsapichat/mcp-server
A comprehensive Model Context Protocol (MCP) server that provides LLMs with seamless access to WhatsApp functionality through the WSAPI service. This server enables AI assistants to send messages, manage contacts and groups, handle chat operations, and much more functionallity.
🚀 Features
📱 Core Messaging
Text Messages: Send rich text with mentions and replies
Media Messages: Send images, videos, audio files, and voice messages
Documents: Share files with captions
Stickers: Send animated and static stickers
Location: Share location data with coordinates and place information
Contacts: Send vCard contacts
Links: Send URLs with rich preview metadata
Reactions: React to messages with emojis
📧 Message Management
Edit Messages: Modify sent text messages
Delete Messages: Remove messages for all participants or just yourself
Star Messages: Mark important messages
Mark as Read: Update message read status
Reply to Messages: Create threaded conversations
👥 Contact Management
List Contacts: Get all WhatsApp contacts
Contact Details: Retrieve contact information and business profiles
Create/Update Contacts: Manage your contact list
Profile Pictures: Get contact profile images
Presence Subscription: Monitor contact online status
🏢 Group Management
Create Groups: Start new group chats with participants
Group Info: Get group details and participant lists
Manage Participants: Add/remove group members
Group Settings: Update name, description, and picture
Invite Links: Generate and manage group invite links
💬 Chat Management
List Chats: Get all active conversations
Chat Presence: Set typing/recording indicators
Archive/Unarchive: Organize chat list
Pin/Unpin: Prioritize important chats
Mute/Unmute: Control notifications
Ephemeral Messages: Configure disappearing messages
🔐 Session & Instance Management
Session Status: Monitor connection state
QR Code Login: Get QR codes for device pairing
Pair Code: Generate pairing codes for phone linking
Logout: Disconnect from WhatsApp
Instance Settings: Configure instance preferences
API Key Management: Generate new authentication keys
👤 Account Management
Profile Info: Get account details
Display Name: Update account name
Profile Picture: Change profile image
Status Message: Update account status
Presence Status: Set availability (available/unavailable)
📦 Installation
Prerequisites
Node.js 18.0.0 or higher
npm or yarn package manager
WSAPI account with API credentials
NPM Installation
Usage with MCP Clients
Claude Desktop Configuration
Add the server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Alternative: Local Installation
Install the package:
Configure environment variables:
Add to MCP client configuration:
Development Setup
Clone and install dependencies:
Configure environment:
Edit
Build and start:
🔧 Development
Development Mode
Type Checking
Linting
Testing
Generate Types from OpenAPI
🛠️ Configuration
Environment Variables
Variable | Required | Default | Description |
| Yes | - | Your WSAPI API key |
| Yes | - | Your WSAPI instance ID |
| No |
| WSAPI base URL |
| No |
| Request timeout in milliseconds |
| No |
| Number of retry attempts |
| No |
| Delay between retries in milliseconds |
| No |
| Server port |
| No |
| Logging level (error, warn, info, debug) |
| No |
| Environment (development, production, test) |
Getting WSAPI Credentials
Visit WSAPI.chat and create an account
Create a new WhatsApp instance
Get your API key and Instance ID from the dashboard
Configure your instance settings as needed
📚 Usage Examples
Send a Text Message
Send an Image with Caption
Create a Group
Send Location
Set Chat Presence
🔗 Available Tools
Messaging Tools
whatsapp_send_text
- Send text messageswhatsapp_send_image
- Send image messageswhatsapp_send_video
- Send video messageswhatsapp_send_audio
- Send audio fileswhatsapp_send_voice
- Send voice messageswhatsapp_send_document
- Send document fileswhatsapp_send_sticker
- Send stickerswhatsapp_send_location
- Send location datawhatsapp_send_contact
- Send contact vCardswhatsapp_send_link
- Send links with previewwhatsapp_send_reaction
- React to messageswhatsapp_edit_message
- Edit sent messageswhatsapp_delete_message
- Delete messageswhatsapp_mark_message_read
- Mark messages as readwhatsapp_star_message
- Star messages
Contact Tools
whatsapp_get_contacts
- List all contactswhatsapp_get_contact
- Get contact detailswhatsapp_create_contact
- Create new contactwhatsapp_update_contact
- Update contact infowhatsapp_get_contact_picture
- Get contact profile picturewhatsapp_get_contact_business
- Get business profilewhatsapp_subscribe_contact_presence
- Monitor contact status
Group Tools
whatsapp_get_groups
- List all groupswhatsapp_create_group
- Create new groupwhatsapp_get_group
- Get group detailswhatsapp_update_group_name
- Change group name
Chat Tools
whatsapp_get_chats
- List all chatswhatsapp_get_chat
- Get chat detailswhatsapp_set_chat_presence
- Set typing/recording statuswhatsapp_archive_chat
- Archive/unarchive chatswhatsapp_pin_chat
- Pin/unpin chats
Session Tools
whatsapp_get_session_status
- Check connection statuswhatsapp_get_qr_code
- Get QR code for loginwhatsapp_get_qr_code_image
- Get QR code imagewhatsapp_get_pair_code
- Get pairing codewhatsapp_logout
- Logout from WhatsApp
Instance Tools
whatsapp_get_instance_settings
- Get instance configurationwhatsapp_update_instance_settings
- Update instance settingswhatsapp_restart_instance
- Restart instancewhatsapp_update_api_key
- Generate new API key
Account Tools
whatsapp_get_account_info
- Get account informationwhatsapp_set_account_name
- Update display namewhatsapp_set_account_picture
- Update profile picturewhatsapp_set_account_presence
- Set availability statuswhatsapp_set_account_status
- Update status message
🐛 Troubleshooting
Common Issues
Authentication Errors
Verify your API key and instance ID are correct
Check that your WSAPI subscription is active
Ensure the instance is properly configured
Connection Issues
Check your internet connection
Verify the WSAPI service status
Review firewall settings
Message Sending Failures
Ensure the recipient number format is correct (include @s.whatsapp.net)
Check that the WhatsApp session is active
Verify media file formats and sizes
Validation Errors
Review input parameters against the tool schemas
Check data types and required fields
Ensure string lengths don't exceed limits
Debug Mode
Enable debug logging for detailed troubleshooting:
Health Check
The server includes a built-in health check that verifies API connectivity on startup.
🤝 Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature
)Commit your changes (
git commit -m 'Add amazing feature'
)Push to the branch (
git push origin feature/amazing-feature
)Open a Pull Request
Development Guidelines
Follow TypeScript best practices
Add tests for new functionality
Update documentation for new features
Run linting and type checking before committing
Follow the existing code style and conventions
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🔗 Links
📞 Support
For support and questions:
Create an issue in this repository
Check the WSAPI documentation
Contact WSAPI support for API-related issues
Built with ❤️ using TypeScript, and the Model Context Protocol SDK.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables AI assistants to interact with WhatsApp through the WSAPI service, supporting comprehensive messaging, contact management, group operations, and account management functionality. Allows sending various media types, managing chats, and controlling WhatsApp sessions through natural language.