MCP Hub
Back to servers

WhatsApp MCP

A 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.

glama
Stars
2
Updated
Mar 29, 2026
Validated
Mar 31, 2026

<<<<<<< HEAD

whatsapp_MCP

=======

WhatsApp MCP — Remote HTTP Server

A Model Context Protocol (MCP) server for WhatsApp built with whatsapp-web.js.
Supports two modes:

ModeFileUse case
stdiosrc/index.tsClaude Desktop (local)
Remote HTTP/SSEsrc/remote.tsClaude.ai "Remote MCP URL" / any HTTP client

Quick Start

1. Install dependencies

npm install

2. Build TypeScript

npm run build

3. Run the remote server

npm run start:remote
# or in dev mode (no build needed):
npm run dev:remote

4. Scan the QR code

Open http://localhost:3000/qr in your browser and scan with WhatsApp → Linked Devices.


Endpoints

MethodPathDescription
GET/ or /healthHealth check + status
GET/qrQR code page (browser) or ?format=json for raw data
GET/toolsList all available MCP tools
GET/tools/statusWhatsApp connection status
POST/tools/send-messageSend a WhatsApp message
GET/tools/chatsList recent chats
GET/tools/contactsList contacts
GET/tools/messages/:chatIdFetch messages from a chat
POST/tools/invokeGeneric tool invocation
GET/sseMCP SSE endpoint (for Claude Remote MCP)
POST/messagesMCP POST endpoint (used with /sse)

REST API Examples

Check status

curl http://localhost:3000/tools/status

Send a message

curl -X POST http://localhost:3000/tools/send-message \
  -H "Content-Type: application/json" \
  -d '{"to": "919876543210", "message": "Hello from MCP!"}'

Get recent chats

curl "http://localhost:3000/tools/chats?limit=10"

Get messages from a chat

curl "http://localhost:3000/tools/messages/919876543210?limit=20"

Generic tool invocation

curl -X POST http://localhost:3000/tools/invoke \
  -H "Content-Type: application/json" \
  -d '{"tool": "whatsapp_get_groups", "args": {}}'

Optional: Bearer Token Auth

Set the API_KEY environment variable to protect REST endpoints:

API_KEY=mysecretkey npm run start:remote

Then include the header in requests:

curl -H "Authorization: Bearer mysecretkey" http://localhost:3000/tools/status

Testing with ngrok (public HTTPS URL)

  1. Install ngrok: https://ngrok.com/download
  2. Start your server: npm run start:remote
  3. In a new terminal: ngrok http 3000
  4. Copy the https://xxxx.ngrok-free.app URL

Paste this into Claude → Settings → Integrations → Remote MCP:

https://xxxx.ngrok-free.app/sse

Deploy to Render

  1. Push this repo to GitHub
  2. Go to https://render.com → New → Web Service
  3. Connect your repo
  4. Set:
    • Build Command: npm install && npm run build
    • Start Command: npm run start:remote
    • Environment: NODE_ENV=production
    • Optional: API_KEY=yoursecretkey
  5. Deploy → copy your https://your-app.onrender.com URL

Paste into Claude Remote MCP:

https://your-app.onrender.com/sse

⚠️ Important for Render: WhatsApp session data (.wwebjs_auth) does not persist across Render deploys by default. Use a Render Disk (persistent storage) or re-scan the QR after each deploy. See Render Disks.


Project Structure

whatsapp-mcp/
├── src/
│   ├── index.ts          # stdio MCP server (Claude Desktop)
│   ├── remote.ts         # HTTP/SSE MCP server (Remote MCP + REST API)
│   └── send_message.ts   # CLI script to send a message
├── dist/                 # Compiled JS (after npm run build)
├── .wwebjs_auth/         # WhatsApp session data (gitignore this!)
├── package.json
├── tsconfig.json
└── README.md

Available MCP Tools

ToolDescription
whatsapp_statusCheck connection status
whatsapp_send_messageSend a text message
whatsapp_send_mediaSend image/video/doc
whatsapp_get_contactsList contacts
whatsapp_get_groupsList groups
whatsapp_get_group_infoGroup details + members
whatsapp_create_groupCreate a new group
whatsapp_get_chatsRecent chats
whatsapp_get_messagesMessages from a chat

.gitignore recommendations

node_modules/
dist/
.wwebjs_auth/
.wwebjs_cache/
.env

2848b1a (whatsapp mcp)

Reviews

No reviews yet

Sign in to write a review