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

roshi-google-chat-mcp

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

<p align="center">
  <a href="https://riaevangelist.github.io/roshi-google-chat-mcp/">
    <img src="assets/roshi-google-chat-mcp-header.png" alt="Roshi's Google Chat MCP — The Buddha of Automated Communication" width="100%">
  </a>
</p>

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

<p align="center">
  <strong>The Buddha of Automated Communication for Google Chat.</strong><br>
  Stillness in the noise: read, thread, search, sync, redact, export, watch, schedule, react, and speak across every Google Chat space from any AI.
</p>

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

<p align="center">
  <img src="https://img.shields.io/badge/version-0.1.0-00897B" alt="Version 0.1.0">
  <img src="https://img.shields.io/badge/python-%3E%3D3.10-12d9c4?logo=python&logoColor=white" alt="Python 3.10+">
  <img src="https://img.shields.io/badge/MCP-2.x%20stdio-12d9c4" alt="MCP 2.x stdio">
  <img src="https://img.shields.io/badge/Antigravity%20%7C%20Claude%20%7C%20Codex-plugin-00897B" 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>

---

## Roshi Teaching the Sangha: Why Automated Communication Needs Stillness

> *"When a monastery receives a hundred bells at once, wisdom is not ringing louder—it is knowing which bell to answer, which vow to keep silent, and which record to preserve untouched."*

**Roshi's Google Chat MCP** (`roshi-google-chat-mcp`) brings the proven local-first architecture of **[Roshi's Signal MCP](https://github.com/RIAEvangelist/roshi-signal-mcp)** and **[Roshi's Recorder MCP](https://github.com/RIAEvangelist/roshi-recorder-mcp)** to **Google Chat**—and expands it into a serene, disciplined **Buddha of Automated Communication** across both **personal `@gmail.com`** and **Google Workspace** accounts:

- **Three Ways to Connect (Zero Friction to Enterprise)**:
  1. **`oauth` (Official Google Chat REST API v1)**: Full Workspace access—spaces, DMs, threads, members, reactions, binary media upload/download, interactive Cards v2, and read state—with automatic PKCE OAuth 2.0 refresh.
  2. **`web` (Zero-GCP Persistent Chrome/Edge Session)**: Works on **personal `@gmail.com` AND Workspace** accounts with zero Google Cloud Console setup, using an isolated browser profile at `~/.roshi-google-chat-mcp/accounts/<alias>/browser_profile`.
  3. **`service_account` & Incoming Webhooks**: Chat App / Workspace delegated service accounts (RS256 JWT) plus a private named registry of **Incoming Webhooks** for zero-OAuth space announcements and alerts.
- **SHA-256 SQLite FTS5 Vault + Non-Destructive Edit & Delete Shield**:
  - Syncs spaces, threads, members, and SHA-256 hashed attachments into `~/RoshiGoogleChat/vault.db` (plus full **Google Takeout** import!).
  - If a message is **edited** or **deleted remotely** in Google Chat, the vault never destroys the original—it preserves `original_text`, appends `edit_history`, stamps `deleted_remotely_at`, and can fire a watch alert.
- **Tamper-Resistant Privacy Policy & Anti-Oracle Search**:
  - Strict ignore lists (`accounts`, `spaces`, `threads`, `senders`, `keywords`, `regexes`) and Luhn-validated PII/secret redaction (`ssn`, `credit_card`, `email`, `phone`, `secrets`, `bank_account`, `ipv4`, custom terms/regexes) locked via CLI (`.\gchat-tool.ps1 policy lock`).
  - Search queries are re-verified post-redaction so searching for a redacted secret can never act as an oracle.
- **Declarative Sangha Automation + Scheduled Outbox**:
  - Watch for `message_added`, `message_edited`, `message_deleted`, or `mention_received` -> automatically `reply` in-thread, `react` with emoji, `sync`, `export`, forward to a `webhook`, launch an `antigravity_task`, or run any `command` (such as Codex) with redacted `GCHAT_*` env vars.
  - Queue future/delayed messages in a local **Scheduled Outbox**, send rich **Interactive Cards v2**, and read a calm cross-account **Unread & `@mentions` Digest** in one call.

---

## Install in Seconds

### Google Antigravity (one command)

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

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

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

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

```bash
# macOS / Linux
git clone https://github.com/RIAEvangelist/roshi-google-chat-mcp.git
cd roshi-google-chat-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-chat-mcp` |
| **Claude Code & Claude Desktop** | Native Plugin (`.claude-plugin/`) or `uvx` | `claude mcp add roshi-google-chat-mcp -- uvx roshi-google-chat-mcp` |
| **OpenAI Codex** (CLI & App) | Native Plugin (`.codex-plugin/`) or `uvx` | Add `[mcp_servers.roshi-google-chat-mcp]` to `~/.codex/config.toml` |
| **Cursor / Windsurf / Zed / Gemini CLI** | Standard MCP 2.x stdio server | `command: "uvx"`, `args: ["roshi-google-chat-mcp"]` |
| **Docker / Glama** | Containerized MCP stdio image | `docker build -t roshi-google-chat-mcp .` |
| **Standalone CLI (No AI required)** | PowerShell / Python CLI | `.\gchat-tool.ps1 <cmd>` or `roshi-gchat-cli <cmd>` |

---

## MCP Tool Surface (31 Tools)

| Category | Tools |
| --- | --- |
| **Diagnostics, Auth & Webhooks** | `chat_doctor`, `connect_account`, `setup_oauth`, `list_accounts`, `manage_webhooks` |
| **Spaces, Members & Read State** | `list_spaces`, `get_space`, `list_members`, `create_space`, `manage_read_state` |
| **Read, Thread, Search & Digest** | `get_messages`, `get_thread`, `search_messages`, `get_unread_digest`, `extract_attachment` |
| **Vault Sync, Takeout & Export** | `sync_spaces`, `import_takeout`, `export_space`, `resume_export` |
| **Send, Cards v2, Edit & React** | `send_message`, `send_card_message`, `send_webhook_message`, `manage_message`, `manage_reaction` |
| **Lockable Privacy Policy** | `get_privacy_policy`, `manage_ignore_list`, `manage_redaction_rules`, `test_redaction` |
| **Watch Triggers & Outbox** | `manage_watch_rules`, `manage_chat_watcher`, `manage_scheduled_messages` |

---

## Standalone CLI Quick Reference

```powershell
# Diagnostics & connect accounts
.\gchat-tool.ps1 doctor
.\gchat-tool.ps1 auth login --alias personal --mode web
.\gchat-tool.ps1 auth setup-oauth --enable-gcloud --open-console
.\gchat-tool.ps1 auth setup-oauth --from-downloads --connect --alias work

# Sync, search with ±2 context, digest, and export
.\gchat-tool.ps1 sync --all
.\gchat-tool.ps1 import-takeout "C:\Takeout\Google Chat" --account archive
.\gchat-tool.ps1 search "release checklist" --since 2026-06-01 --until 2026-06-30 --context 2
.\gchat-tool.ps1 digest --since 24h
.\gchat-tool.ps1 export "Engineering" --output "$HOME\GoogleChatExports\Engineering"
.\gchat-tool.ps1 resume-export "$HOME\GoogleChatExports\Engineering" --expand-until-to-now

# Safeguarded sends, webhooks, privacy lock & watcher daemon
.\gchat-tool.ps1 send "Engineering" "Calm waters ahead." --dry-run
.\gchat-tool.ps1 webhook add ops "https://chat.googleapis.com/v1/spaces/.../messages?key=...&token=..."
.\gchat-tool.ps1 policy ignore-add spaces "Attorney*"
.\gchat-tool.ps1 policy preset-on ssn
.\gchat-tool.ps1 policy lock
.\gchat-tool.ps1 watch daemon --interval 15
```

---

## Security & Trust Boundary

- **Zero credential leakage**: OAuth tokens, service-account keys, browser cookies, and Incoming Webhook tokens stay private inside `~/.roshi-google-chat-mcp/` (`0600` on POSIX) and are never returned in tool outputs.
- **Safeguarded mutations**: `send_message`, `send_card_message`, `send_webhook_message`, `create_space`, and `manage_message` default to `dry_run=True`.
- **Tamper-resistant CLI lock**: `.\gchat-tool.ps1 policy lock` prevents AI agents from removing ignore entries or weakening redaction presets until unlocked from your terminal.
- **Non-destructive chain-of-custody**: Local vaults (`~/RoshiGoogleChat/`) and exports (`~/GoogleChatExports/`) live outside repositories and never erase prior versions when messages are edited or deleted remotely.

## Verification

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

## License

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