LabscoMCP early access ↗
mario-andreschakMCP SERVER

WhatsApp Web

Search, read and send your own WhatsApp messages and media from the conversation, through a linked WhatsApp Web session.

by mario-andreschak ↗Team Chat PlatformsCommunity

LABSCO SUMMARY

A personal WhatsApp account an agent can read and write — with the terms-of-service question that comes attached.

This automates your personal account as a linked device rather than going through Meta's Business API, and the repository opens by saying that automating WhatsApp this way is against WhatsApp's terms and can get an account flagged or restricted. What it covers is complete for a personal account: contacts, chat history, media in both directions, and a linked session that survives restarts. One thing to know when reading results — list_chats and get_last_interaction return the newest event of any type, so a call log can read like a message; list_messages is the call that answers what someone actually said.

What it is

A TypeScript server that links to your own WhatsApp account as a device — through WhatsApp Web in a browser by default, or through the optional Baileys backend with no browser. Once the device is linked it searches contacts, lists chats, reads message history, sends text and media, and downloads attachments.

What you get

  • Linking handled in-band: get_qr_code returns the QR as an image result, request_pairing_code returns an 8-character code to type on the phone instead, check_auth_status reports whether the session is live and logout clears it
  • search_contacts by name or phone number, and get_contact_by_id when you already hold the JID
  • list_chats sorted by recent activity, get_chat_by_id for metadata, and get_direct_chat_by_contact_number to turn a phone number into a chat
  • list_messages returns what was actually said in a chat; get_message_by_id fetches a single message and get_message_context the ones around it
  • get_last_interaction returns the newest event involving a contact or group of any type, call logs and media included
  • send_message to a person or a group, and send_media for an image, video, document or audio taken from a path, a URL or inline content — with a caption, or sent as a voice note
  • download_media pulls an attachment back out of a message
  • The linked session is saved — as a browser profile by default, in a SQLite file under Baileys — and reused on later runs, so pairing is a one-time step for each backend

Requirements

Node.js 22 or newer. Clients either run the published package with npx -y mcp-whatsapp-web, or launch dist/index.js with node from a clone of the repository built with npm install and npm run build; both speak stdio. The default whatsapp-web.js backend drives a browser: the Chromium Puppeteer downloads covers everything except videos and GIFs, which need a real Chrome or Edge — both auto-detected, or named through BROWSER_EXECUTABLE_PATH. Its session lives in whatsapp-sessions and moves with WHATSAPP_SESSION_DIR. Set WHATSAPP_BACKEND=baileys to run with no browser at all; that backend needs the optional dependencies, including the native better-sqlite3 module, is paired separately, and keeps its session in BAILEYS_SESSION_DIR. ffmpeg is bundled, and setting WHATSAPP_PAIRING_PHONE_NUMBER logs a pairing code at startup instead of waiting for a QR scan. MCP_HTTP_PORT additionally exposes the server at http://127.0.0.1:<YOUR_PORT>/mcp from the same process; that endpoint controls your personal account, so it binds to 127.0.0.1 by default and MCP_OAUTH puts a bearer token in front of it.

Setup effort

One command — npx -y mcp-whatsapp-web