Skip to main content
Glama
README.md
# gemini-app-bridge

[![CI](https://github.com/nariahlamb/gemini-app-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/nariahlamb/gemini-app-bridge/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-339933.svg)](package.json)
[![Version](https://img.shields.io/badge/Version-2.12.0-6366f1.svg)](package.json)
[![Chrome MV3](https://img.shields.io/badge/Chrome%20Extension-MV3-4285F4.svg)](extension/manifest.json)

[简体中文](README.zh-CN.md) | English

A **zero-tab, minimal-permission Gemini Web App MCP bridge + turnkey Antigravity (AGY) plugin** that lets local AI coding agents (Antigravity, Claude Code, Codex, Cursor, Windsurf, etc.) reuse your signed-in **Gemini Web App** subscription (`https://gemini.google.com/app`)—with **no API key**, **no cookie export**, **no Chrome CDP flags**, **zero popups**, **zero focus stealing**, plus **Gemini 4 Native `/skills` cloud sync** and **one-command account switching (`npm run onboard`)**.

> **Disclaimer**: This is an unofficial community tool and is not affiliated with or endorsed by Google. It reuses your local signed-in browser session and non-public Gemini Web endpoints, which Google may change at any time. Intended strictly for personal local development and research—never use it to bypass login, CAPTCHA, rate limits, or Google's Terms of Service.

---

## Highlights (v2.12.0)

- **Silent Zero-Tab Execution**: Prompts, file/directory uploads (small text files `<=64KB` auto-inlined), `create_image` (use `downloadImagesDir` to save images to disk), NotebookLM lookups, and usage checks run directly inside the MV3 Service Worker—no new windows, no tab switching, no focus stealing.
- **Native Gemini 4 `/skills` Cloud Sync**: Manage cloud Skills zero-tab with zero popups. The 5 built-in specialist skills stay hosted with `enabled: false` by default and mount only when explicitly requested (e.g., `gemId: "agy-code-auditor"`), keeping your everyday Gemini Web chats 100% unpolluted (never touches global Saved Info).
- **Zero-Residue Cleanup & Clear Model Tiers**: One-shot asks use temporary chats plus a durable cleanup queue so your Gemini sidebar stays clean. Generous timeouts by tier: `Carbon` (Web UI **Code & complex**, 420s default), `Neon` (Web UI **Pro / Deeper analysis**, alias `"Pro"`, 300s default), and `Hydrogen` (Web UI **Fast / Everyday help**, alias `"Fast"`). Supports lock-free parallel runs, 135s sync-to-async handoff, and `GEMINI_AUTH_USER_POOL=0,1` multi-account failover.
- **Turnkey Antigravity Plugin + One-Command Account Switch**: Ships 5 ready-to-use specialist cloud skills and a cross-platform `npm run onboard` command that starts the daemon, clears stale session caches, checks quota, and syncs all 5 skills in one shot whenever you switch Google accounts.

```mermaid
flowchart LR
  A["AI Agent (Antigravity / Claude Code / Cursor / Codex)"] -->|"stdio (--connect)"| B["Local Daemon (127.0.0.1:17321)"]
  B <-->|"Loopback WS + Mutual HMAC-SHA256"| C["Chrome / Vivaldi MV3 Service Worker (Zero Tabs)"]
  C <-->|"Same-Origin Session RPC"| D["gemini.google.com (/app & /skills)"]
```

---

## Prerequisites

- **Node.js `>= 20`**
- **Python `>= 3.10`** (only needed for `npm run onboard` / `sync-skills` / `health`)
- **Chrome / Vivaldi / Edge / Brave** (Chromium 116+) signed in to `https://gemini.google.com/app` (keep the browser running; no Gemini tab needs to stay open)

---

## Quick Start (3 Minutes, Cross-Platform)

### 1. Clone & Build

```bash
git clone https://github.com/nariahlamb/gemini-app-bridge.git
cd gemini-app-bridge
npm install --omit=optional   # or `npm install` if you also want Playwright fallback
npm run build
```

### 2. Auto-Pair & Install (Pick One)

- **Antigravity (AGY) users (recommended — pairs bridge + installs plugin + writes machine-local `mcp_config.json`)**:
  ```bash
  npm run setup:agy
  ```
- **Claude Code / Cursor / Codex / Generic MCP clients**:
  ```bash
  npm run setup
  ```

This generates a local 64-char HMAC token in your OS app-data folder (`bridge.json`) and writes the gitignored `extension/local-config.json` for zero-copy pairing.

### 3. Load the Extension

1. Open `chrome://extensions` (or `vivaldi://extensions` / `edge://extensions`) in your signed-in browser.
2. Enable **Developer mode**.
3. Click **Load unpacked** and select this repository's `extension/` directory.
4. **Expected initial state**: Because the local daemon has not started yet, the extension popup will show **Disconnected / standby** right after loading—this is normal. Once you run `npm run onboard` in Step 4 (or connect from your MCP client in Step 5, which auto-starts `127.0.0.1:17321`), it switches to **Connected** within ~1 second.

### 4. One-Command Onboarding & Cloud Skill Sync (All Clients & OSes)

Works across Windows CMD, PowerShell, macOS, and Linux from the repo root—whether you use Antigravity, Claude Code, or Cursor:

```bash
# First-time onboarding, or anytime you switch Google accounts in your browser:
npm run onboard

# Switch to a secondary account slot (/u/1) and save it as default:
npm run onboard -- --auth-user 1 --set-default
```

> Also available: `npm run health` and `npm run sync-skills`.

### 5. Register in Generic MCP Clients

> **Windows JSON note**: Always use **forward slashes** (e.g. `"E:/github/gemini-app-bridge/dist/index.js"`) or **escaped backslashes `\\`** in JSON files—single backslashes `\` will break JSON parsing.

**Claude Code CLI**:
```bash
claude mcp add gemini-app -e GEMINI_DRIVER=extension -- node /abs/path/to/gemini-app-bridge/dist/index.js --connect
```

**Cursor (`.cursor/mcp.json`) / Generic MCP JSON**:
```json
{
  "mcpServers": {
    "gemini-app": {
      "command": "node",
      "args": ["E:/github/gemini-app-bridge/dist/index.js", "--connect"],
      "env": {
        "GEMINI_DRIVER": "extension"
      }
    }
  }
}
```

**Codex (`~/.codex/config.toml`)**:
```toml
[mcp_servers.gemini-app]
command = "node"
args = ["/abs/path/to/gemini-app-bridge/dist/index.js", "--connect"]
env = { GEMINI_DRIVER = "extension" }
```

### 6. Everyday Usage (Just Ask in Plain Language)

No need to memorize the 19 tool names—just prompt your agent naturally:

- **Second-opinion code review**: *"Use `gemini-app` with `agy-code-auditor` to audit my uncommitted diff for concurrency or security bugs."*
- **Primary-source research**: *"Ask `gemini-app` with `agy-evidence-scout` to check breaking changes in library X and include official links."*
- **NotebookLM spec check**: *"List my NotebookLM notebooks, mount the Architecture Spec notebook, and verify whether my new endpoint conflicts with it."*

---

## Built-In Cloud Specialist Skills (5, Default `enabled: false`)

| `gemId` (slug) | Recommended Model (Web UI Tier) | Focus |
| --- | --- | --- |
| `agy-memory-distiller` | `Carbon` (Code & complex) | Deduplicates and distills workspace `MEMORY.md` / `LEARNINGS.md` |
| `agy-evidence-scout` | `Neon` (Pro / Deeper analysis) | Primary-source research (GitHub, papers, official docs with links & conflicts) |
| `agy-code-auditor` | `Carbon` (Code & complex) | Independent code & security second opinion (`P0/P1/P2` + `Gate Verdict`) |
| `agy-prose-critic` | `Carbon` (Code & complex) | Editorial critique for AI clichés and stiffness (reports symptoms only) |
| `agy-continuity-checker` | `Carbon` (Code & complex) | Paired with NotebookLM (`notebookIds`) to audit large engineering specs, architecture docs, or long-form lore for contradictions |

---

## Exposed MCP Tools (19)

- **Core**: `gemini_ask`, `gemini_poll` (single `jobId` or batch `jobIds`), `gemini_sessions`, `gemini_status`, `gemini_usage`, `gemini_wait_for_ready`
- **Native Skills, Knowledge & Automation**: `gemini_gems` (v2.12 zero-tab `/skills` CRUD & toggle via pure-JS PKZIP + CRC-32 and Scotty `agent_skills`), `gemini_list_gems`, `gemini_list_notebooks` (`notebookIds`), `gemini_tasks` (`list/get/create/update/pause/resume/confirm/delete`)
- **History & Models**: `gemini_list_conversations`, `gemini_get_conversation`, `gemini_open_conversation`, `gemini_new_chat`, `gemini_list_models`, `gemini_select_model`
- **DOM / Fallback**: `gemini_send_message`, `gemini_stop_generation`, `gemini_screenshot` (Playwright/CDP mode only)

---

## Security & Privacy Matrix

See [SECURITY.md](SECURITY.md) for the full threat model and disclosure policy.

| Control | Guarantee (Enforced by `npm run check`) |
| --- | --- |
| **Minimal Extension Permissions** | Only `tabs`, `scripting`, `storage`, `alarms`. **Never requests** `cookies`, `<all_urls>`, `debugger`, `activeTab`, or `webRequest`. |
| **Strict Host Permissions** | Scoped strictly to `gemini.google.com`, `content-push.googleapis.com`, and Google usercontent CDN hosts. |
| **Loopback Mutual Auth** | Binds only `127.0.0.1`, validates `Host` & `chrome-extension://` `Origin`, and requires mutual HMAC-SHA256 authentication. |
| **Zero Popups / Zero Focus Steal** | Statically enforced by `scripts/check-guardrails.mjs`. |
| **Secret & Symlink Upload Guard** | Engine upload guards + `cli.py redact-check` block `.env*`, private keys, tokens, cookies, and symlinks. |
| **No Anti-Bot / CAPTCHA Bypass** | Immediately halts and returns `needs_login` or `needs_human_verification`. |

---

## Development & Verification

```bash
npm run check      # Minimal-permission, zero-popup, version-sync & hygiene guardrails
npm run build      # TypeScript compile
npm test           # Full unit + extension E2E + Playwright integration test suite (105 tests)
```

## Attribution & License

- Built on top of the MIT-licensed [Xhhemoing/gemini-app-mcp](https://github.com/Xhhemoing/gemini-app-mcp) engine and extended to `v2.12.0` with Gemini 4 Native `/skills` zero-tab lifecycle management, cross-platform `npm run onboard`, resilience fixes, and the Antigravity plugin suite.
- License: [MIT](LICENSE)