This project lets you start an MCP server from WhatsApp and interact via chat messages. It builds on whatsapp-web.js — follow its installation guide first.
- Node.js v18 or higher (
node -v) - Follow whatsapp-web.js to get a whatsapp web client ready to use
- npm (with Node.js; verify with
npm -v) - OpenAI or Anthropic API key exported as environment variable:
export ANTHROPIC_API_KEY=sk-... - Git (for cloning the repo)
-
Clone the repository
git clone [https://github.com/<you>/mcp-whatsapp.git](https://github.com/operation-hp/WA-MCP.git) cd WA-MCP
-
Edit the whatsapp-client.ts and add your phone number
const pairingCode = await this.whatsapp.requestPairingCode('+1234567890'); // enter the target phone number -
Install dependencies
nvm use 20 npm install
-
Build the project
npm run build
Everything, including the compatible Chromium bundle for Puppeteer, will be downloaded automatically.
Edit mcp-server.conf in the project /build directory. This config file is same as Claude Desktop:
{
"mcpServers": {
"python-bot": {
"command": "python",
"args": ["my_mcp_script.py"],
"env": { "TOKEN": "123" },
"cwd": "./bots"
},
"node-demo": {
"command": "node",
"args": ["--max-old-space-size=256", "demo.js"]
}
}
}one example can be found at https://github.com/operation-hp/spotify-mcp-wa ( which supports Oauth and let you login to Spotify)
Start the client:
npm start-
TimeoutError:
If Puppeteer fails to launch Chromium, ensure you haven’t modifiedsrc/lib/whatsapp-client.tslaunch options. -
ENOENT mcp-server.conf:
Keep the file next tobuild/index.jsor update theconfigPathconstant. -
QR not shown:
Delete the session cache directory and restart:rm -rf .wwebjs_auth
git pull
npm install
npm run buildEnjoy chatting with your MCP servers directly from WhatsApp!