#Connect WhatsApp to Claude and ChatGPT with MCP Server
What If Your AI Assistant Could Send WhatsApp Messages?
Imagine telling Claude: "Send a WhatsApp message to my last 10 leads asking if they're still interested." And it just does it. No switching tabs, no API calls, no copy-pasting phone numbers.
That's what MCP (Model Context Protocol) enables. MCP is Anthropic's open standard for connecting AI models to external tools and data sources. Instead of the AI just generating text, it can call real tools — query databases, send messages, check analytics, manage campaigns.
MoltFlow ships a production-ready MCP server with 25 tools that give your AI assistant full control over WhatsApp automation. Sessions, messaging, groups, leads, outreach campaigns, usage tracking, and delivery analytics — all accessible through natural language.
Here's how to set it up.
What Is MCP (30-Second Version)
MCP is a protocol that lets AI clients (like Claude Desktop) talk to tool servers. Think of it like USB for AI — a standard interface that any AI client can use to connect to any tool server.
The architecture is simple:
AI Client (Claude Desktop)
↓ MCP protocol (JSON-RPC over stdio or HTTP)
MCP Server (@moltflow/mcp-server)
↓ REST API calls
MoltFlow API (apiv2.waiflow.app)
↓ WAHA protocol
WhatsAppThe AI client discovers available tools from the MCP server, shows them to the model, and the model decides when to call them based on your prompts. You never write API calls — you just ask for what you want in plain English.
Available Tools (25 Total)
MoltFlow's MCP server exposes 25 tools across 7 categories:
Sessions (5 tools)
moltflow_list_sessions— List all connected WhatsApp accountsmoltflow_get_session— Get details for a specific sessionmoltflow_create_session— Create a new WhatsApp sessionmoltflow_start_session— Start a stopped sessionmoltflow_get_qr_code— Get QR code for phone pairing
Messages (3 tools)
moltflow_send_message— Send a WhatsApp message (text, to any chat ID)moltflow_list_chats— List recent conversationsmoltflow_get_chat_messages— Read message history for a chat
Groups (6 tools)
moltflow_list_monitored_groups— List groups you're tracking for leadsmoltflow_list_available_groups— List all WhatsApp groups your session belongs tomoltflow_add_monitored_group— Start monitoring a group for keywordsmoltflow_list_custom_groups— List your custom contact groupsmoltflow_create_custom_group— Create a new custom group for targetingmoltflow_add_custom_group_members— Add contacts to a custom group
Leads (2 tools)
moltflow_list_leads— List captured leads with filteringmoltflow_update_lead_status— Update a lead's qualification status
Outreach (4 tools)
moltflow_create_bulk_send— Launch a bulk messaging campaignmoltflow_list_bulk_sends— List all campaignsmoltflow_get_bulk_send_status— Check campaign progress and delivery statsmoltflow_create_schedule— Schedule a message for future delivery
Usage (2 tools)
moltflow_get_current_usage— Check message usage against plan limitsmoltflow_get_plan_limits— View your plan's feature limits
Analytics (3 tools)
moltflow_get_campaign_analytics— Get delivery and engagement metrics for campaignsmoltflow_get_contact_engagement— See engagement stats for a specific contactmoltflow_get_contact_history— Pull full interaction history for a contact
Every tool includes input validation via Zod schemas, structured error handling, and response formatting in either Markdown or JSON.
Setup: Claude Desktop
Claude Desktop has native MCP support. Here's how to connect MoltFlow.
Step 1: Get Your API Key
Log into MoltFlow, go to your Sessions page, click the API Keys tab, and generate a key with the scopes you need. For full MCP access, use the "Full Access" preset.
Step 2: Install the MCP Server
npm install -g @moltflow/mcp-serverStep 3: Configure Claude Desktop
Open Claude Desktop settings and add the MCP server configuration. On macOS, edit ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows, edit %APPDATA%\Claude\claude_desktop_config.json.
{
"mcpServers": {
"moltflow": {
"command": "npx",
"args": ["-y", "@moltflow/mcp-server"],
"env": {
"MOLTFLOW_API_KEY": "your_api_key_here"
}
}
}
}Step 4: Restart Claude Desktop
After saving the config, restart Claude Desktop. You should see the MoltFlow tools appear in the tools menu (the hammer icon). If the server fails to start, check the MCP logs — the most common issue is a missing or invalid API key.
That's it. You can now ask Claude things like "List my WhatsApp sessions" or "Send a message to +1234567890 saying hello" and it will use the MoltFlow tools automatically.
Setup: Claude Code (CLI)
If you use Claude Code (Anthropic's CLI tool), the setup is similar. Add MoltFlow to your project's .mcp.json:
{
"mcpServers": {
"moltflow": {
"command": "npx",
"args": ["-y", "@moltflow/mcp-server"],
"env": {
"MOLTFLOW_API_KEY": "your_api_key_here"
}
}
}
}Or configure it globally in ~/.claude/mcp.json to make MoltFlow tools available in every project.
Setup: Remote HTTP Mode
For shared environments, CI/CD pipelines, or any client that supports HTTP-based MCP, you can run the server in HTTP mode:
MOLTFLOW_API_KEY=your_key TRANSPORT=http PORT=3000 npx @moltflow/mcp-serverThis starts an Express server with Streamable HTTP transport on port 3000. The MCP endpoint is at http://localhost:3000/mcp. You get CORS protection, rate limiting (120 requests/minute per key), and HTTPS enforcement in production.
Point any MCP-compatible client at the HTTP endpoint to connect.
Example Prompts and Workflows
Here are real prompts you can use once MoltFlow's MCP server is connected. These aren't hypothetical — they work today.
Check Your WhatsApp Status
"Show me all my WhatsApp sessions and their connection status."
Claude will call moltflow_list_sessions and display a formatted table of your sessions with their status (working, stopped, qr_code, etc.).
Send a Quick Message
"Send a WhatsApp message to 16505551234 on my 'main-account' session saying: Hey, just following up on our conversation yesterday. Do you still need the pricing doc?"
Claude calls moltflow_send_message with the session ID, chat ID ([email protected]), and your message text. All anti-spam safeguards (typing simulation, rate limiting) are applied server-side.
Review Your Leads
"Show me all leads captured this week, sorted by score. Which ones should I follow up with?"
Claude calls moltflow_list_leads, gets the results, and gives you a prioritized analysis based on the lead data. You get AI-powered lead prioritization for free.
Launch a Campaign
"Create a bulk send to my 'warm-leads' custom group. The message should say: Hi! We're running a 20% discount this week on all plans. Reply YES if you want the details. Schedule it for tomorrow at 9 AM EST."
Claude calls moltflow_create_bulk_send with the custom group ID, message text, and scheduled time. The campaign will execute with all anti-spam delays automatically applied.
Check Campaign Performance
"How did my last bulk send perform? Show me delivery rate, read rate, and any failures."
Claude calls moltflow_get_bulk_send_status and moltflow_get_campaign_analytics to pull delivery metrics, then summarizes the results with actionable insights.
Monitor Usage
"Am I close to hitting my plan limits this month?"
Claude calls moltflow_get_current_usage and moltflow_get_plan_limits, then tells you exactly where you stand — messages sent vs. limit, sessions used, and whether you need to upgrade.
Building Automations with MCP
The real power comes from chaining tools together. Here's an example workflow you could trigger with a single prompt:
"Check my leads from the last 3 days. For any lead scored 7 or above that I haven't contacted yet, send them a personalized follow-up message on my 'sales' session."
Claude will:
- Call
moltflow_list_leadsto get recent leads - Filter for score >= 7
- Call
moltflow_get_contact_historyfor each to check if you've already reached out - Call
moltflow_send_messagefor each uncontacted lead with a contextual message - Report back what it did
That's a lead follow-up workflow that would normally require a CRM integration, custom code, and a scheduler. With MCP, it's one prompt.
Security Notes
A few important things about running the MCP server:
- API key scopes matter — Generate keys with only the scopes you need. Don't use a full-access key if you only need read access. MoltFlow returns
403with anX-Required-Scopesheader if a scope is missing. - Keys are environment variables — Never hardcode API keys in config files that get committed to git. Use environment variables or a secrets manager.
- Rate limiting is server-side — The MCP server enforces 120 requests/minute per API key. The underlying MoltFlow API has its own rate limits too. You can't bypass anti-spam safeguards through MCP.
- Prompt injection protection — MoltFlow's MCP server wraps all user-generated content (message text, contact names) in
[user_data]boundaries and defangs tool name references. This prevents prompt injection attacks where malicious WhatsApp messages could trick the AI into calling unintended tools.
Troubleshooting
"Server failed to start" — Check that MOLTFLOW_API_KEY is set. The server will start without a key (with a warning), but all tool calls will fail with 401 errors.
"Tool not found" — Make sure you're using the latest version: npm install -g @moltflow/mcp-server@latest. New tools are added in minor releases.
"Rate limit exceeded" — You're hitting the 120 req/min limit on the MCP server. This usually happens when asking Claude to process large batches. Break your request into smaller chunks.
Messages not sending — The most common cause is the reciprocity rule. MoltFlow only allows sending to contacts who messaged you within the last 24 hours. Check with moltflow_get_chat_messages to verify the contact has recent inbound messages.
What's Next
MoltFlow's MCP server turns your AI assistant into a WhatsApp automation operator. Instead of switching between dashboards and terminals, you stay in one conversation and let the AI handle the API calls.
Start with the basics — list sessions, send a test message, check your usage. Once you're comfortable, build more complex workflows by chaining tools together.
Useful resources:
- Getting Started with WhatsApp Automation — Connect your first session and send your first message
- MCP vs A2A: Which Protocol for WhatsApp? — Understanding when to use MCP vs agent-to-agent coordination
- Bulk Messaging Without Getting Banned — Anti-spam safeguards explained in detail
Get started in 5 minutes. Sign up for free, generate an API key, and connect MoltFlow to Claude Desktop today.
> Try MoltFlow Free — 100 messages/month