Google Messages MCP
Automates Google Messages for Web to list conversations, read message threads, search conversations, send SMS/RCS messages to existing or new recipients, and archive or unarchive conversations on the paired Android phone.
Click on "Deploy 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., "@Google Messages MCP read my 5 most recent unread text conversations"
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.
google-messages-mcp
Local MCP server (stdio) that drives Google Messages for Web (https://messages.google.com/web) with Playwright, so AI agents can read and send the SMS/RCS on your Android phone. There is no official API; this automates the web app in a dedicated, persistent Chromium profile.
Entry:
src/server.mjs(MCP tools, send-token safety)Browser/session + all DOM selectors:
src/browser.mjs(SELECTORSat the top)Profile (pairing lives here; treat as a credential):
~/.google-messages-mcp/profile(%USERPROFILE%\.google-messages-mcp\profileon Windows)QR screenshot:
~/.google-messages-mcp/qr.png
Install
git clone https://github.com/ilakskill/google-messages-mcp.git
cd google-messages-mcp
npm install
npx playwright install chromium
npm run smoke # tools/list + gmsg_status, no browser launchRelated MCP server: Ghostlight
MCP registration
Claude Code (user scope), with the absolute path to your clone:
claude mcp add google-messages --scope user -- node /absolute/path/to/google-messages-mcp/src/server.mjsGeneric JSON (Claude Desktop / Cursor / Gemini / Antigravity mcpServers; VS Code uses servers):
{
"mcpServers": {
"google-messages": {
"command": "node",
"args": ["/absolute/path/to/google-messages-mcp/src/server.mjs"]
}
}
}Only one process can open the profile at a time, so only one MCP client can actively use the server at once. A second client gets PROFILE_LOCKED until the first one exits.
Pairing (one time, needs your phone)
Ask an agent to run gmsg_pair (or wait_seconds: 0 first to get instructions right away).
The server opens a visible browser on the pairing page.
If Google offers a QR code: it turns on "Remember this computer", saves
qr.pngand returns the QR as an image. On the phone: Messages app > profile picture > Device pairing > QR code scanner, then scan.If Google offers no QR code (what the live site did on 2026-12-01:
/web/authenticationredirected to/web/welcome, which only has "Sign In"): Google blocks sign-in in Playwright-controlled browsers, so the server opens the same profile in a plain, non-automated browser window. In that window: click Sign In, sign in with the same Google account the phone's Messages app uses, and approve on the phone when prompted (matching emoji / prompt). Say yes to remembering this computer if asked.The server detects your conversation list, waits a few seconds, closes the window, and confirms pairing by reopening the profile under Playwright. Later calls run headless.
If the wait times out the window stays open; finish there and call gmsg_pair again (it resumes waiting). gmsg_pair with method: "cancel" closes a leftover sign-in window. Force a path with method: "qr" or method: "signin".
Tools
All tools return JSON text: {"ok":true,"data":...} or {"ok":false,"code","message","remedy"}. They never throw. Browser work is serialized through a single queue.
Tool | Args | What it does |
|
| Browser up, paired, page URL, last error. |
|
| Pairing (above). |
|
| name, snippet, timestamp text, unread, |
|
| Messages with direction (incoming/outgoing), text, timestamp, aria label, status. Scrolls up for older ones. |
|
| Filters the conversation list by name, snippet or digits of a number. |
| one of | Two-step. Without token: preview (resolved recipient + text) and a 5-minute, single-use token bound to the exact recipient and text hash; nothing is sent. With token: sends, then verifies the outgoing bubble and reports its status. New numbers go through Start chat. |
|
| Two-step. Without token: resolves targets and returns a preview plus token; nothing is archived. With token: archives them and records id-to-name in |
| see tool schema, | Two-step. Restores conversations from the Archived view. Only conversations archived through this server (recorded in |
Error codes: NOT_PAIRED, PAIRING_IN_PROGRESS, PROFILE_LOCKED, SESSION_IN_USE, SELECTOR_MISSING, TIMEOUT, NOT_FOUND, AMBIGUOUS, BAD_INPUT, TOKEN_INVALID, TOKEN_MISMATCH, SEND_UNVERIFIED, BROWSER_MISSING, LAUNCH_FAILED, INTERNAL.
Environment variables
Var | Default | Meaning |
|
| Persistent browser profile. Changing it means re-pairing. |
|
|
|
|
|
|
| auto | Explicit browser .exe for the manual sign-in window. |
|
| Auto-click "Use here" on the "open in another tab" dialog. |
|
| Sign-in window gets |
|
| Navigation timeout. |
Troubleshooting
Re-pair: if tools return
NOT_PAIRED(phone unpaired the device, or "Remember this computer" was off), rungmsg_pairagain. To start over completely, stop all MCP clients and pointGMSG_PROFILE_DIRat a new empty folder; the old profile is never deleted by the server.PROFILE_LOCKED: another server process, a smoke/probe run, or a sign-in window has the profile open. Close it (gmsg_pair method=cancelfor a sign-in window) and retry."Messages for web is open in another tab/window" / "Use here": the server owns its profile and keeps a single tab, so by default it closes stray tabs in its own browser and clicks "Use here". Your own Chrome is a separate paired device and isn't affected. Set
GMSG_AUTO_USE_HERE=0to getSESSION_IN_USEinstead.Selector updates (Google changed the DOM): symptoms are
SELECTOR_MISSINGor empty results. Stop the MCP server, then:cd google-messages-mcp node scripts/probe.mjs # conversation list page node scripts/probe.mjs <conversation_id> # a thread node scripts/probe.mjs --new # Start chat page GMSG_HEADLESS=0 node scripts/probe.mjs # watch itIt prints which
SELECTORSentries match and savesprobe.png+probe-dom.htmlin~/.google-messages-mcp(these contain message content; keep private). Fix the list inSELECTORSinsrc/browser.mjs(put the working selector first). In Git Bash, prefix path arguments withMSYS_NO_PATHCONV=1.Headless blocked or blank: set
GMSG_HEADLESS=0and watch. The server already removes "HeadlessChrome" from the user agent.Logs: stderr only (stdout is the MCP channel). Claude Code shows them with
claude --debug/ MCP logs.
Selector status
Verified live (unpaired) on 2026-12-01: the welcome page ([data-e2e-welcome-page-sign-in-button]) and the /web/authentication to /web/welcome redirect. Everything for a paired session (conversation list, threads, compose, send, Start chat, QR element, Remember toggle, Use here) is best-known and UNVERIFIED until a paired probe run. Entries are tagged [UNVERIFIED] in SELECTORS.
Smoke test
cd google-messages-mcp
node scripts/smoke.mjs # tools/list + gmsg_status
node scripts/smoke.mjs --check --validate # + headless pairing check + send input validation
node scripts/smoke.mjs --list # + list 5 conversations (needs pairing)
node scripts/smoke.mjs --qr # + gmsg_pair method=qr wait 0 (visible window)The smoke test never sends a message.
Disclaimer
Unofficial. Not affiliated with or endorsed by Google. It automates the Google Messages web app, which can change or block automation at any time. The browser profile grants full access to your messages; never share or commit it.
License
MIT. See LICENSE.
Available Tools
8 toolsgmsg_archive_conversationsArchive conversations (two-step)ADestructive
Two-step archive. Call 1 (no confirm_token): resolves targets (conversation_ids, or all_in_inbox=true which scrolls the whole inbox) and returns {count, targets:[{conversation_id,name}]} plus a confirm_token valid 5 minutes, single use, bound to the sorted id list; NOTHING is archived. Call 2 with the same selector (same conversation_ids, or all_in_inbox=true) and the token: archives each conversation one by one via its item menu and returns {archived:[ids], failed:[{id,reason}]}; a per-item failure never aborts the batch. Archived conversations are recoverable with gmsg_unarchive_conversations.
Inputs: all_in_inbox, confirm_token, conversation_ids.
gmsg_list_conversationsList conversationsBRead-only
List recent conversations: name, snippet, timestamp text, unread flag, conversation_id.
Inputs: limit, unread_only.
gmsg_pairPair Google Messages (QR)A
Pair this server's browser profile with the phone (needs the user). method "auto" (default): opens a VISIBLE browser on the pairing page; if Google offers a QR code it turns on "Remember this computer", saves the QR to ~/.google-messages-mcp/qr.png and returns it as an image (scan: Messages app > profile picture > Device pairing > QR code scanner). If no QR is offered (current Google behaviour: Google-account sign-in only), it opens a plain non-automated browser window on the same profile for the user to sign in by hand and approve on the phone; the server detects completion and closes it. Waits up to wait_seconds (default 120); wait_seconds=0 returns right away (then call gmsg_pair again to keep waiting, or gmsg_status check=true). Relay the returned instructions to the user.
Inputs: method, wait_seconds.
gmsg_read_conversationRead a conversationARead-only
Read messages from one conversation (by conversation_id or name). Returns direction (incoming/outgoing), text, timestamp, aria label, status. Scrolls up to load older messages up to limit.
Inputs: name, limit, conversation_id.
gmsg_searchSearch conversationsARead-only
Find conversations whose name, snippet or number contains the query (scans the loaded conversation list, scrolling to load up to scan entries).
Inputs: query (required), scan.
gmsg_send_messageSend SMS/RCS (two-step)ADestructive
Two-step send. Call 1 (no confirm_token): resolves the recipient and returns a preview plus a confirm_token valid 5 minutes, bound to the exact recipient and text; NOTHING is sent. Show the preview to the user. Call 2 with the same recipient fields, identical text and confirm_token: actually sends, then verifies the outgoing bubble and reports status. Recipient: exactly one of conversation_id, name, phone_number (new numbers go through Start chat).
Inputs: text (required), name, phone_number, confirm_token, +1 more.
gmsg_statusGoogle Messages statusARead-only
Browser up?, paired?, page URL, last error. check=true launches the browser (headless) if needed to determine pairing; default only reports current state without launching.
Inputs: check.
gmsg_unarchive_conversationsUnarchive conversations (two-step)ADestructive
Two-step unarchive, operating from the Archived view (drawer > Archived dialog, which lists names only, no ids). Only ids archived through gmsg_archive_conversations are known (remembered by name in ~/.google-messages-mcp/archived-map.json); unknown ids fail with NOT_FOUND. Call 1 (no confirm_token): verifies each name is present in the archived list and returns {count, targets} plus a 5-minute single-use confirm_token bound to the sorted id list; nothing changes. Call 2 with the same conversation_ids and token: unarchives each, returns {unarchived:[ids], failed:[{id,reason}]}.
Inputs: conversation_ids (required), confirm_token.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct action on a distinct resource: send, list, read, search, archive, unarchive, pair, status. The archive/unarchive pair are clearly opposite operations, and search vs. list are distinguished (query-based scan vs. recent conversations). Status (read state) vs. pair (initiate pairing) are separated by explicit descriptions.
All tools share the gmsg_ prefix and snake_case, giving a predictable namespace. Minor deviation: several tools are bare verbs/nouns (gmsg_status, gmsg_pair, gmsg_search) rather than verb_noun, but the convention remains readable and consistent in style.
Eight tools is well within the sweet spot and each earns its place: core messaging (send/list/read/search), lifecycle management (archive/unarchive), and setup/diagnostics (pair/status). Nothing appears redundant or padded.
The core read/send/search workflow plus archive lifecycle and pairing is covered, including two-step confirmation for destructive actions. Gaps remain: no way to list archived conversations directly (unarchive requires remembered ids), and no delete-conversation, mark read/unread, or media/attachment sending.
Maintenance
Related MCP Connectors
Hosted WhatsApp MCP server for AI agents — read, search, send messages, media, polls, and groups.
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceMCP server for a local-first messaging workspace that integrates Google Messages, WhatsApp, and Signal. It enables reading, sending, searching messages, and managing conversations through MCP tools.74-
- AlicenseAqualityBmaintenanceMCP server that lets AI agents drive your real Chromium browser with your existing signed-in sessions, providing visible, local, and inspectable automation for tasks like navigation, clicking, typing, and form filling.252Apache 2.0
- AlicenseNot gradedqualityCmaintenanceMCP server that lets ChatGPT search and read iMessage/SMS history, send one-at-a-time messages, and manage Contacts on your own Mac, with confirmations for any writes.MIT
- FlicenseAqualityBmaintenanceA local stdio MCP server that gives any MCP client one connection to all of the user's Gmail, Google Workspace and IMAP accounts at once, letting assistants list accounts, read messages and attachments, run full-text search across mailboxes, trigger syncs and export messages as .eml. It runs on the user's own computer with encrypted secrets and no intermediary server, so mail is fetched directly from the providers.91-