WhatsApp Claude MCP
Provides a WhatsApp webhook endpoint for receiving incoming messages and returning AI-generated replies, including per-user conversation memory and a clear-history API.
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 Claude MCPTell me a programming joke"
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 Claude MCP
A powerful WhatsApp bot integrated with Claude AI using the Model Context Protocol (MCP). Send messages to your WhatsApp bot and get intelligent responses powered by Claude, with access to external APIs and tools.
š Features
Claude AI Integration: Uses Claude 3.5 Sonnet for intelligent conversations
MCP Tools: Extensible tool system for Claude to interact with external APIs
Joke Generator: Built-in tool that fetches random jokes from external API
Conversation Memory: Maintains context across multiple messages per user
WhatsApp Webhook: Simple REST API for integrating with WhatsApp services
Easy Deployment: Works with express server, ready for cloud deployment
Related MCP server: WAHA WhatsApp MCP Server
š Prerequisites
Node.js 18+
npm or yarn
Anthropic API Key (get from console.anthropic.com)
WhatsApp Cloud API access (for production integration)
š Quick Start
1. Clone and Install
git clone https://github.com/yulianheroes-lgtm/whatsapp-claude-mcp.git
cd whatsapp-claude-mcp
npm install2. Set Environment Variables
cp .env.example .envEdit .env and add your Anthropic API key:
ANTHROPIC_API_KEY=your_anthropic_api_key_here
PORT=30003. Start the Server
npm startYou should see:
ā
WhatsApp Claude MCP Server running on http://localhost:3000
š¤ Ready to process WhatsApp messages!š” API Usage
Health Check
curl http://localhost:3000/healthSend Message to Claude
curl -X POST http://localhost:3000/webhook/whatsapp \
-H "Content-Type: application/json" \
-d '{
"userId": "1234567890",
"message": "Tell me a joke"
}'Response:
{
"success": true,
"userId": "1234567890",
"message": "š Here's a programming joke for you!\n\nWhy do programmers prefer dark mode?\n\nBecause light attracts bugs! š"
}Clear Conversation History
curl -X POST http://localhost:3000/webhook/clear-history \
-H "Content-Type: application/json" \
-d '{
"userId": "1234567890"
}'š ļø Available Tools
Joke Generator
Claude can automatically use this tool when appropriate:
Trigger: When user asks for jokes
Types: random, programming, general
API: Official Joke API
Example interaction:
User: Tell me a funny programming joke
Bot: [Uses joke_generator tool] š Here's a programming joke...š Project Structure
whatsapp-claude-mcp/
āāā src/
ā āāā index.js # Main Express server
ā āāā whatsapp-handler.js # Message handling & Claude integration
ā āāā mcp-server.js # MCP tool definitions & execution
ā āāā tools/
ā āāā joke-generator.js # Joke generator tool implementation
āāā .env.example # Environment variables template
āāā .gitignore # Git ignore rules
āāā package.json # Dependencies
āāā README.md # This fileš Integration with WhatsApp
Option 1: WhatsApp Cloud API
For production, integrate with WhatsApp Cloud API:
Set up webhook on Meta Business Platform
Point webhook URL to:
https://your-domain.com/webhook/whatsappWhen WhatsApp sends messages, forward them to this endpoint
Option 2: Local Testing
Use tools like curl, Postman, or a test script to send messages:
// test.js
const userId = '1234567890';
const message = 'Tell me a joke';
const response = await fetch('http://localhost:3000/webhook/whatsapp', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ userId, message })
});
const result = await response.json();
console.log(result.message);š§ How It Works
Message Received ā WhatsApp webhook receives a message
Claude Processing ā Message sent to Claude with available tools
Tool Selection ā Claude decides if tools are needed
Tool Execution ā MCP server executes tools (e.g., fetch jokes)
Response Generation ā Claude generates response using tool results
Message Sent ā Response sent back via WhatsApp
š Adding More Tools
To add a new tool (e.g., weather, translations):
1. Create Tool File
// src/tools/weather.js
export const weatherTool = {
name: 'get_weather',
description: 'Get current weather for a location',
inputSchema: {
type: 'object',
properties: {
location: { type: 'string', description: 'City name' }
}
}
};
export async function executeWeather(location) {
// Fetch weather data
return { /* weather data */ };
}2. Register in MCP Server
// src/mcp-server.js
import { weatherTool, executeWeather } from './tools/weather.js';
export class MCPServer {
constructor() {
this.tools = [
jokeGeneratorTool,
weatherTool // Add here
];
}
async processTool(toolName, toolInput) {
switch (toolName) {
case 'get_weather':
return await executeWeather(toolInput.location);
// ...
}
}
}š API Reference
POST /webhook/whatsapp
Request Body:
{
"userId": "string (required)",
"message": "string (required)"
}Response:
{
"success": boolean,
"userId": "string",
"message": "string"
}POST /webhook/clear-history
Request Body:
{
"userId": "string (required)"
}Response:
{
"success": boolean,
"message": "string"
}š Security Considerations
API Keys: Never commit
.envfile to version controlRate Limiting: Consider adding rate limiting for production
Input Validation: Always validate webhook payloads
HTTPS: Use HTTPS in production
Authentication: Add webhook signature verification for WhatsApp integration
š Environment Variables
Variable | Description | Example |
| Claude API key |
|
| Server port |
|
| Environment |
|
| Joke API endpoint |
|
š¤ Contributing
Feel free to fork, modify, and contribute back!
š License
MIT License - see LICENSE file for details
š Troubleshooting
"API key not found"
Ensure
.envfile exists and hasANTHROPIC_API_KEYsetCheck key is valid at console.anthropic.com
"Tool execution failed"
Check external APIs are accessible
Verify network connectivity
Review error logs in console output
"No response from Claude"
Check
ANTHROPIC_API_KEYis correctEnsure Claude model is available
Check API rate limits
š Support
For issues or questions:
Check the troubleshooting section
Review Claude API documentation
Open an issue on GitHub
šÆ Future Enhancements
Support for image/media in WhatsApp messages
Additional tools (weather, news, translations)
Database for persistent conversation history
Rate limiting and authentication
Admin dashboard for monitoring
Multi-language support
Custom Claude system prompts per user
Made with ā¤ļø by yulianheroes-lgtm
This server cannot be installed
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 Servers
- AlicenseAqualityDmaintenanceEnables sending, reading, and deleting WhatsApp messages through Claude Desktop and other MCP clients with granular per-chat permissions. Built on whatsapp-web.js using a headless browser to automate WhatsApp Web.6MIT
- AlicenseAqualityCmaintenanceEnables Claude to interact with WhatsApp through a unified backend API, providing 20 tools for messaging, media, groups, contacts, and chat management.22107MIT
- AlicenseNot gradedqualityBmaintenanceConnects WhatsApp to Claude Code, enabling message reading, audio transcription, image analysis, and message sending with full codebase context.51MIT
- AlicenseNot gradedqualityCmaintenanceA local MCP server that connects WhatsApp to Claude via QR code, enabling chat listing, message retrieval, and sending with automatic rate limiting for anti-ban protection.51MIT
Related MCP Connectors
Drive your real WhatsApp inbox from Claude ā send, reply, label, assign, and triage via TimelinesAI.
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.
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/yulianheroes-lgtm/whatsapp-claude-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server