Provides tools for sending text and template messages, retrieving media files, and checking connectivity with the WhatsApp Cloud API to enable messaging capabilities through Meta's WhatsApp Business platform.
WhatsApp Cloud API MCP Server – Spec v1.0
Overview
This project defines version 1.0 of an MCP Server that exposes the WhatsApp Cloud API to LLM agents through standardized MCP tools.
Goal: Provide a minimal, clean, production-ready baseline so developers can use WhatsApp messaging inside AI agents with zero complexity.
1. Objectives
Create a lightweight MCP server (TypeScript + Node.js).
Expose WhatsApp Cloud API functionalities as tools.
Provide helpers for webhook verification.
Be deployable with a single command (Docker + local dev).
2. Tech Stack
Node.js 20+
TypeScript
Express (or Fastify) for HTTP + webhooks
MCP Server SDK
Axios for outbound WhatsApp API requests
WebSocket for MCP transport (mandatory)
Dotenv for configs
Pino or console logging
3. Project Structure (v1.0)
4. Environment Variables
Required:
Optional:
5. WhatsApp Cloud API Endpoints to Support (v1.0)
The MCP server will call these official endpoints:
Send Text Message
Send Template Message
Get Media URL
Download Media
Health Check
6. Webhook Handling
Expose:
Features:
Validate
hub.verify_token
7. MCP Tools (v1.0)
Tools exposed to agents:
1. send_text_message
Send a simple text message to a WhatsApp user.
Params:
2. send_template_message
Send a WhatsApp template message.
Params:
3. get_media
Retrieve a media file by MEDIA_ID.
Params:
4. health_check
Verify connectivity with WhatsApp Cloud API.
8. Security
Validate Meta webhook signature (optional v1).
Restrict MCP tool usage to authenticated WebSocket clients.
Sanitize user inputs.
Never log tokens.
9. Documentation Requirements
Setup Instructions
Install Dependencies
npm installConfigure Environment Copy
.env.exampleto.envand fill in your Meta WhatsApp API credentials.cp .env.example .envRun Locally
npm run devServer will start on port 4000 (HTTP) and expose MCP on WebSocket.
Configure Webhook
Expose your local server using ngrok or similar:
ngrok http 4000In Meta App Dashboard, set Webhook URL to
https://<your-ngrok-url>/webhookSet Verify Token to match
META_VERIFY_TOKENin.env
Docker Usage
Example Usage with Claude Desktop
Add to your claude_desktop_config.json:
(Note: For local dev without docker, point to the build output)
10. Contact
For any inquiries or similar projects, please contact: marcelo@marcelomarchetti.com