Skip to main content
Glama
roshi-google-messages-mcp

roshi-google-messages-mcp

README.md
<!-- mcp-name: io.github.RIAEvangelist/roshi-google-messages-mcp -->

<p align="center">
  <a href="https://riaevangelist.github.io/roshi-google-messages-mcp/">
    <img src="assets/roshi-google-messages-mcp-header.png" alt="Roshi's Google Messages MCP — Local-First SMS, MMS & RCS with Friends of the Temple" width="100%">
  </a>
</p>

<h1 align="center">Roshi's Google Messages MCP</h1>

<p align="center">
  <strong>Local-first SMS, MMS &amp; RCS for Google Messages (<code>messages.google.com/web</code>).</strong><br>
  Warm lantern light across every text thread: pair, sync, import Android SMS backups, search with FTS5, redact 2FA OTPs under a CLI lock, export MMS photo galleries, automate watch triggers, and send SMS/MMS messages with friends of the temple.
</p>

<p align="center">
  <a href="https://riaevangelist.github.io/roshi-google-messages-mcp/"><strong>Documentation Site</strong></a> &middot;
  <a href="https://riaevangelist.github.io/roshi-google-messages-mcp/workflows.html"><strong>Temple Friends Workflows</strong></a> &middot;
  <a href="https://riaevangelist.github.io/roshi-google-messages-mcp/tools.html"><strong>25 MCP Tools Reference</strong></a> &middot;
  <a href="https://github.com/RIAEvangelist/roshi-google-messages-mcp"><strong>GitHub Repository</strong></a>
</p>

<p align="center">
  <img src="https://img.shields.io/badge/version-0.1.0-1A73E8" alt="Version 0.1.0">
  <img src="https://img.shields.io/badge/python-%3E%3D3.10-4FC3F7?logo=python&logoColor=white" alt="Python 3.10+">
  <img src="https://img.shields.io/badge/MCP-2.x%20stdio-4FC3F7" alt="MCP 2.x stdio">
  <img src="https://img.shields.io/badge/Antigravity%20%7C%20Claude%20%7C%20Codex-plugin-1A73E8" alt="Multi-AI Plugin">
  <img src="https://img.shields.io/badge/platforms-Windows%20%7C%20macOS%20%7C%20Linux-3A76F0" alt="Cross-platform">
  <img src="https://img.shields.io/badge/license-MIT-F5A623" alt="MIT License">
</p>

---

## Sending SMS & MMS with Friends of the Temple

> *"A short text from the veranda — a photo of evening tea, a reminder for morning sitting — carries the warmth of the temple across any valley, and deserves a local archive you actually own."*

**Roshi's Google Messages MCP** (`roshi-google-messages-mcp`) completes the Roshi local-first messaging suite alongside **[Roshi's Signal MCP](https://github.com/RIAEvangelist/roshi-signal-mcp)** and **[Roshi's Google Chat MCP](https://github.com/RIAEvangelist/roshi-google-chat-mcp)** — bringing full local search, archival, privacy lock, and safeguarded automation to **SMS, MMS, and RCS** via **`messages.google.com/web`**:

- **Flexible Local-First Connection & Import Paths**:
  1. **`web` (Live `messages.google.com/web` Pairing)**: Launches an isolated Chrome/Edge profile at `~/.roshi-google-messages-mcp/accounts/<alias>/browser_profile`. Works with **Google Account pairing** (emoji tap on Android), **QR Code device pairing**, and **Google Fi Sync** (`mode="fi"`), automatically clicking `"Use here"` if another tab previously held the lock.
  2. **Native Android SMS Backup & Restore XML Importer (`import_sms_backup`)**: Stream-parses `sms-*.xml` backups — decoding `<sms>` and `<mms>` (including Base64-encoded MMS images, videos, audio, vCards, and group MMS participants) straight into your searchable SHA-256 vault.
  3. **Takeout / JSON / CSV Importer + Optional Read-Only ADB Sync**: Ingest Google Takeout/JSON/CSV archives or pull SMS read-only over USB/wireless `adb`.
- **SHA-256 SQLite FTS5 Vault + Non-Destructive Edit & Delete Shield**:
  - Stores conversations, contacts, SMS/MMS/RCS messages, reactions, and SHA-256 hashed MMS media in `~/RoshiGoogleMessages/vault.db`.
  - Preserves `original_text` + `edit_history` for edited RCS messages and stamps `deleted_remotely_at` without ever erasing local copies.
  - Smart phone-number resolution (`+15551234567`, `(555) 123-4567`, or contact name) plus `±N` search context and inclusive `until` dates.
- **Tamper-Resistant Privacy Lock + Built-In 2FA `otp` Redaction**:
  - Ignore lists (`accounts`, `conversations`, `contacts`, `keywords`, `regexes`) with phone-number-aware matching.
  - Redaction presets including **`otp`** (automatically masks SMS login/2FA verification codes so AI agents never read your security codes!), plus `ssn`, Luhn-validated `credit_card`, `email`, `phone`, `secrets`, `bank_account`, and `ipv4`.
  - Anti-oracle search re-verifies every query post-redaction; lock it from your terminal with `.\gmessages-tool.ps1 policy lock`.
- **Declarative Watch Triggers, Scheduled SMS/MMS Outbox & Resumable Galleries**:
  - Watch for `message_added`, `message_edited`, `message_deleted`, or `mms_received` -> `reply`, `react`, `sync`, `export`, `webhook`, `antigravity_task`, or `command` with redacted `GMESSAGES_*` env vars.
  - Queue future SMS/MMS texts (with photo attachments) in a local scheduled outbox and export crash-safe JSON, Markdown, and searchable HTML galleries (`~/GoogleMessagesExports/`).

<p align="center">
  <img src="assets/roshi-temple-friends-messages.png" alt="Roshi sending SMS and MMS messages with friends of the temple on the evening veranda" width="100%">
</p>

---

## Install in Seconds

### Google Antigravity (one command)

```bash
agy plugin install RIAEvangelist/roshi-google-messages-mcp
```

Installs **all 25 MCP tools**, the **`roshi-google-messages-mcp` skill**, and **bundled safety rules**, bootstrapping an isolated Python environment automatically via [`bootstrap_mcp.py`](./bootstrap_mcp.py).

### Windows / macOS / Linux (local clone)

```powershell
# Windows (PowerShell)
git clone https://github.com/RIAEvangelist/roshi-google-messages-mcp.git
cd roshi-google-messages-mcp
.\setup.ps1 -InstallPlugin
```

```bash
# macOS / Linux
git clone https://github.com/RIAEvangelist/roshi-google-messages-mcp.git
cd roshi-google-messages-mcp
./setup.sh --install-plugin
```

---

## Works with Every Major AI Client

| AI Client / Environment | Integration | Setup |
| --- | --- | --- |
| **Google Antigravity** (App, CLI, IDE) | Native Plugin (MCP + Skill + Rules) | `agy plugin install RIAEvangelist/roshi-google-messages-mcp` |
| **Claude Code & Claude Desktop** | Native Plugin (`.claude-plugin/`) or `uvx` | `claude mcp add roshi-google-messages-mcp -- uvx roshi-google-messages-mcp` |
| **OpenAI Codex** (CLI & App) | Native Plugin (`.codex-plugin/`) or `uvx` | Add `[mcp_servers.roshi-google-messages-mcp]` to `~/.codex/config.toml` |
| **Cursor / Windsurf / Zed / Gemini CLI** | Standard MCP 2.x stdio server | `command: "uvx"`, `args: ["roshi-google-messages-mcp"]` |
| **Docker / Glama** | Containerized MCP stdio image | `docker build -t roshi-google-messages-mcp .` |
| **Standalone CLI (No AI required)** | PowerShell / Python CLI | `.\gmessages-tool.ps1 <cmd>` or `roshi-gmessages-cli <cmd>` |

---

## MCP Tool Surface (25 Tools)

| Category | Tools |
| --- | --- |
| **Diagnostics & Multi-Account Pairing** | `messages_doctor`, `connect_account`, `list_accounts` |
| **Conversations, Contacts, Search & Digest** | `list_conversations`, `get_conversation`, `get_messages`, `search_messages`, `get_unread_digest`, `list_contacts`, `extract_attachment` |
| **Vault Sync, XML/Takeout Import & Export** | `sync_conversations`, `import_sms_backup`, `import_takeout`, `export_conversation`, `resume_export` |
| **Safeguarded SMS/MMS/RCS Send & Actions** | `send_message`, `manage_reaction`, `manage_conversation` |
| **Lockable Privacy Policy & OTP Redaction** | `get_privacy_policy`, `manage_ignore_list`, `manage_redaction_rules`, `test_redaction` |
| **Watch Automation & Scheduled Outbox** | `manage_watch_rules`, `manage_messages_watcher`, `manage_scheduled_messages` |

---

## Standalone CLI Quick Reference

```powershell
# Diagnostics & pair with messages.google.com/web
.\gmessages-tool.ps1 doctor
.\gmessages-tool.ps1 auth login --alias personal --mode web

# Sync, import Android SMS Backup XML, search with ±2 context, and export HTML gallery
.\gmessages-tool.ps1 sync --all
.\gmessages-tool.ps1 import-sms-backup "C:\Backups\sms-2026.xml" --account phone_archive
.\gmessages-tool.ps1 search "evening tea" --protocol MMS --context 2
.\gmessages-tool.ps1 digest --since 24h
.\gmessages-tool.ps1 export "Brother Kenji" --output "$HOME\GoogleMessagesExports\Brother_Kenji"
.\gmessages-tool.ps1 resume-export "$HOME\GoogleMessagesExports\Brother_Kenji" --expand-until-to-now

# Safeguarded SMS/MMS send, 2FA OTP redaction lock & watcher daemon
.\gmessages-tool.ps1 send "+15552345678" "Tea on the veranda at 7!" --attach "C:\Photos\tea.jpg"
.\gmessages-tool.ps1 policy preset-on otp
.\gmessages-tool.ps1 policy ignore-add contacts "+15559990000"
.\gmessages-tool.ps1 policy lock
.\gmessages-tool.ps1 watch daemon --interval 20
```

---

## Security & Trust Boundary

- **Zero credential leakage**: Browser profiles and session cookies stay private inside `~/.roshi-google-messages-mcp/` (`0600` on POSIX) and are never returned in tool outputs.
- **Safeguarded mutations**: `send_message`, `manage_reaction`, and `manage_conversation` default to `dry_run=True`.
- **SMS 2FA / OTP protection & CLI lock**: Enable the `otp` preset and run `.\gmessages-tool.ps1 policy lock` so AI agents can never read one-time login codes or weaken privacy rules.
- **Non-destructive chain-of-custody**: Local vaults (`~/RoshiGoogleMessages/`) and exports (`~/GoogleMessagesExports/`) live outside repositories and preserve edited and remotely deleted messages untouched.

## Verification

```powershell
python -m unittest discover -s tests -v
```

## License

MIT — see [LICENSE](./LICENSE).