gemini-app-mcp
by Xhhemoing
README.md
# gemini-app-mcp
[](https://github.com/Xhhemoing/gemini-app-mcp/actions/workflows/ci.yml)
[](LICENSE)
[](package.json)
[](package.json)
[](extension/manifest.json)
[简体中文](README.zh-CN.md) | English
A **zero-tab, minimal-permission MCP server** that bridges local AI coding agents (Claude Code, Codex, Cursor, Windsurf, T3 Code, etc.) to your already signed-in **Gemini Web App** (`https://gemini.google.com/app`)—using your existing Gemini Web subscription with **no separate API key**, **no Chrome restart or CDP debugging port**, **zero popups**, and **zero focus stealing**.
> **Disclaimer**: `gemini-app-mcp` is an unofficial community tool and is not affiliated with or endorsed by Google. It reuses your local signed-in Chrome 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.
---
## Why `gemini-app-mcp`?
- **Zero-Tab by Default**: Standard prompts, file/directory uploads (small text/code files `<=64KB` auto-inlined), `create_image`, `gemini_get_conversation`, `gemini_list_notebooks` (`notebookIds`), `gemini_list_gems` (`gemId`), `gemini_tasks` (Scheduled Actions), `gemini_usage`, and `gemini_status` all execute directly inside the Chrome MV3 Service Worker without opening a browser tab.
- **Zero-Residue History Cleanup**: One-shot `gemini_ask` calls use Gemini's native temporary-chat flag and a durable local cleanup queue so automated queries never clutter your Gemini sidebar—even if cancelled mid-stream or timed out. Pass `keepInHistory: true` or a `sessionKey` whenever you want multi-turn persistence.
- **Deep Research Cloud Detach**: Uses a brief background tab only to confirm `"Start research"`, then immediately closes the tab and polls Google's cloud zero-tab for up to 45 minutes.
- **Lock-Free Parallelism & Resilience**: Run parallel requests across models (e.g., fast `Neon` / Thinking alongside deep `Carbon` / Pro), inspect real-time streaming progress (`stage`, `textChars`, `thoughtChars`), honor exact `timeoutMs` budgets, automatically hand off long sync calls (`wait=true`) to async at 135s to avoid MCP host timeouts, and batch-poll with `gemini_poll(jobIds=[...])`.
- **Lightweight Install**: `playwright` is an optional dependency—extension mode works without downloading browser binaries.
```mermaid
flowchart LR
A["MCP Client (Claude Code / Codex / Cursor)"] -->|"stdio (--connect)"| B["Local Daemon (127.0.0.1:17321)"]
B <-->|"Loopback WS + Mutual HMAC-SHA256"| C["Chrome MV3 Service Worker (Zero Tabs)"]
C <-->|"Same-Origin Session RPC"| D["gemini.google.com"]
```
---
## Prerequisites
- **Node.js `>= 20`**
- **Google Chrome** (or Chromium-based browser such as Edge / Brave, v116+) signed in to `https://gemini.google.com/app`
---
## Quick Start (3 Minutes, Cross-Platform)
### 1. Build & Auto-Pair
```bash
git clone https://github.com/Xhhemoing/gemini-app-mcp.git
cd gemini-app-mcp
npm install --omit=optional # or `npm install` if you also want Playwright fallback
npm run build
npm run setup
```
`npm run setup` generates a local 64-char HMAC token in your OS app-data folder (`bridge.json`), writes the gitignored `extension/local-config.json` for automatic extension pairing, and prints the exact MCP config snippet for your machine.
### 2. Load the Chrome Extension
1. Open `chrome://extensions` in Google Chrome (where you are signed in to `https://gemini.google.com/app`).
2. Enable **Developer mode** (top right).
3. Click **Load unpacked** and select this repository's `extension/` directory.
4. Click the extension icon—it auto-pairs silently (EN / 中文 UI supported) and shows **Connected**.
### 3. Register in Your MCP Client
`--connect` automatically launches the local loopback background daemon (`127.0.0.1:17321`) on demand across macOS, Linux, and Windows.
**Claude Code CLI**:
```bash
claude mcp add gemini-app -e GEMINI_DRIVER=extension -- node /abs/path/to/gemini-app-mcp/dist/index.js --connect
```
**Cursor (`.cursor/mcp.json`) / Generic MCP JSON**:
```json
{
"mcpServers": {
"gemini-app": {
"command": "node",
"args": ["/abs/path/to/gemini-app-mcp/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-mcp/dist/index.js", "--connect"]
env = { GEMINI_DRIVER = "extension" }
```
---
## Common Workflows
### 1. Ground Answers on Your NotebookLM Knowledge Base
```json
// Step 1: Discover your NotebookLM notebooks zero-tab
{ "tool": "gemini_list_notebooks", "arguments": {} }
// Step 2: Mount one or more notebooks into a zero-residue ask
{
"tool": "gemini_ask",
"arguments": {
"model": "Neon",
"notebookIds": ["<notebook-id>"],
"prompt": "Summarize the key architecture constraints from these docs.",
"saveToFile": "./docs/research/summary.md"
}
}
```
### 2. Cloud Scheduled Actions (`gemini_tasks`)
Create, update, pause, resume, or delete cloud-side recurring Gemini tasks that run on Google's servers with zero local CPU:
```json
{
"tool": "gemini_tasks",
"arguments": {
"action": "create",
"title": "Weekly AI Release Digest",
"prompt": "Summarize major open-source AI agent releases from the past 7 days.",
"unit": "week",
"daysOfWeek": [1],
"hour": 9,
"minute": 0,
"timeZone": "America/Los_Angeles"
}
}
```
Supported actions: `list`, `get`, `create`, `update`, `pause`, `resume`, `confirm`, `delete`.
### 3. Async Deep Research & Batch Polling
```json
// Launch async Deep Research (auto-confirms plan, then detaches to cloud zero-tab)
{
"tool": "gemini_ask",
"arguments": {
"feature": "deep_research",
"wait": false,
"prompt": "Compare WebGPU inference runtimes for browser-side LLMs in 2026.",
"saveToFile": "./docs/research/webgpu-runtimes.md"
}
}
// Poll one or multiple background jobs efficiently
{ "tool": "gemini_poll", "arguments": { "jobIds": ["job_1", "job_2"], "waitMs": 0 } }
```
---
## 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` (file uploads), and Google usercontent hosts (image downloads). |
| **Loopback Mutual Auth** | Bridge binds only `127.0.0.1`, validates `Host` & `chrome-extension://` `Origin` (CSWSH defense), and requires mutual HMAC-SHA256 challenge-response. |
| **Zero Popups / Zero Focus Steal** | Statically enforced by `scripts/check-guardrails.mjs` (forbids `chrome.windows.create`, `focused: true`, and unconditional `active: true`). |
| **Secret & Symlink Upload Guard** | Blocks `.env*`, `bridge.json`, `local-config.json`, `auth.json`, `*.pem`, `*.key`, `*secret*`, `*credential*`, `*cookie*`, and rejects symlinks via `fs.lstat` on both single files and packed directories. |
| **No Anti-Bot / CAPTCHA Bypass** | Immediately halts and returns `needs_login` or `needs_human_verification` if Google presents sign-in, 2FA, or CAPTCHA. |
---
## Exposed MCP Tools (18)
- **Core**: `gemini_ask`, `gemini_poll` (single `jobId` or batch `jobIds`), `gemini_sessions`, `gemini_status`, `gemini_usage`, `gemini_wait_for_ready`
- **Knowledge & Automation**: `gemini_list_notebooks` (`notebookIds`), `gemini_list_gems` (`gemId`), `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)
---
## Troubleshooting
- **Extension shows `Disconnected`**: Run `npm run setup`, then click **Load Local Config** (or **Import bridge.json**) in the extension popup and verify your MCP client or daemon is running on port `17321`.
- **Port `17321` already in use**: Set `GEMINI_EXTENSION_PORT=17322` (or another free port) in both your MCP client env and the extension popup.
- **`needs_login` or `needs_human_verification`**: Open `https://gemini.google.com/app` in the same Chrome profile, complete sign-in or human verification manually, then call `gemini_status`.
- **Multi-account Google Chrome profile**: Set `authUser` (e.g., `"1"` for `/u/1/app`) in the popup or pass `authUser: "1"` in tool arguments.
- **Playwright fallback mode**: If you explicitly use `GEMINI_DRIVER=playwright` instead of the extension bridge, install Playwright with `npm install playwright`.
---
## 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
```
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues