gemini-handoff
Offloads heavy reasoning, architecture design, long-document review, and standalone code generation to Google Gemini via Gemini Desktop, the official Gemini CLI, or the Generative Language API, then captures replies and returns compact summaries with code section indexes.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Antigravity Gemini Handoff (gemini-handoff)
An open-source Antigravity plugin (MCP Server + Skill) that automatically offloads heavy-reasoning, architecture design, long-document review, and standalone code generation subtasks from Antigravity to Gemini — with zero manual copy-paste, zero-token-relay disk packing, hybrid execution engines, and strict Token ROI caps.
You only decide two things: ① whether the plugin is on (
ask/manual/off), and ② which recommended subtasks to check off. Packing, sending, waiting, and compact summary collection all happen automatically.
Why This Exists
Save Antigravity Quota: Offload heavy thinking / long-output tasks to Gemini Desktop or Web while keeping rapid file editing, testing, and debugging inside Antigravity.
Compliant & Resilient: No cookie scraping, no undocumented private APIs, no brittle GUI click automation. You pick the exact model in Gemini Desktop and stay in full control.
Zero-Token-Relay Packing: Antigravity passes only file paths + a brief goal; the local MCP server reads, trims, and packs files directly from disk into your clipboard and
.handoff/outbox/— large source files never enter Antigravity's context just to be forwarded.Summary-First Collection: Long replies from Gemini Desktop are saved verbatim to
.handoff/inbox/, while Antigravity receives only a compact summary + structured code section index (<= 4KBhard cap) and pulls specific code blocks on demand.
Related MCP server: antigravity-mcp
Architecture
flowchart LR
A["Antigravity Agent"] -->|"1. User checks subtasks → handoff_run(goal + filePaths)"| B["gemini-handoff MCP Server"]
B -->|"2. Read disk directly + trim (0 tokens relayed)"| C["Hybrid Transport Engine"]
C -->|"desktop_auto (UIA) / gemini_cli / api"| D["Gemini Desktop or Headless Gemini"]
D -->|"3. Auto-capture reply → .handoff/inbox/"| B
B -->|"4. Return <=4KB summary + section index"| A
A -->|"5. Pull only needed code blocks & verify"| AHybrid Transport Engines (Switch Anytime)
Configure transport via handoff_config:
Transport | How It Works | Cost / Trade-off |
| Automatically launches/focuses local Gemini Desktop ( | Zero extra API cost (uses your Gemini Desktop subscription). |
| Spawns Google's official | 100% background, zero window focus stealing, parallelizable (uses Gemini CLI OAuth quota). |
| Calls official Google Generative Language REST API using | 100% background & deterministic (uses AI Studio API key). |
| Classic manual clipboard + desktop launch mode. | Zero automation dependencies; always available as fallback. |
Operating Modes (Toggle Anytime)
Switch modes anytime via handoff_config (or just tell Antigravity):
Mode | Behavior |
| For complex tasks, Antigravity splits subtasks and asks you (multi-select) which ones to hand off to Gemini Desktop, with model suggestions. |
| Silent during normal work; activates only when you explicitly ask to hand off or collect a task. |
| Disabled; zero intervention. |
Built-in Guardrails
Token ROI Protection
Direct Disk Packing: Files are read directly by the local MCP server, never echoed through Antigravity's LLM context.
Hard Size Caps: Enforces
maxFilesPerTask(20),maxFileBytes(40 KB),maxPackBytes(120 KB), andmaxResponseBytes(4 KB) on tool outputs.Built-in ROI Ledger: Every pack & collect logs estimated bypassed input tokens and compressed output tokens (
handoff_stats).
Stability & Security
Pure
stdioMCP Stream:console.logis redirected tostderr; JSON-RPC stdout can never be polluted.Non-blocking & Crash-Proof: Global
uncaughtException/unhandledRejectionhandlers, detached desktop launch, clipboard subprocess timeouts (5s), and structured error responses.Path Traversal Protection: Every packed file and every
file=...target in collected code blocks is checked againstworkspaceRootviapath.resolve/path.relative.
Installation (Antigravity Plugin)
Clone this repository into your Antigravity plugins directory:
git clone <your-repo-url> ~/.gemini/config/plugins/gemini-handoff cd ~/.gemini/config/plugins/gemini-handoff npm install npm run buildRun the verification suite:
npm testConfigure your local Gemini Desktop path (optional — e.g. on Windows): Tell Antigravity:
Configure
gemini-handoffwithdesktopAppPathset toF:\Gemini\Appand modeask.
MCP Tools Provided
Tool | Purpose |
| Get/set |
| Primary zero-copy-paste tool: reads files directly from disk, dispatches via configured transport, waits for Gemini's reply, saves full output to |
| Read a single parsed code block ( |
| Display cumulative Token ROI ledger and recent tasks. |
| Manual two-step pack & collect tools kept for custom workflows and clipboard fallback. |
Verification & Real A/B Token Benchmark
Measured E2E Handoff (Windows + Gemini Desktop F:\Gemini\App)
Real task: Full Security & Ergonomics Audit of gemini-handoff (8 TypeScript source & test files, 47,609 bytes packed directly from disk → Gemini Desktop → collected via clipboard).
Metric | Without Handoff (Direct in Antigravity) | With | Savings |
Input context loaded into Antigravity | ~11,902 tokens (8 files read into context) | ~330 tokens (path list + brief goal only) | 11,572 tokens bypassed (-97.2%) |
Output loaded back into Antigravity | ~2,246 tokens (8,990 B full audit reply) | 173 tokens ( | 2,073 tokens compressed (-92.3%) |
Total Antigravity Token Footprint | ~14,148 tokens | ~503 tokens | ~13,645 net tokens saved (-96.4%) |
Tip: In Gemini Desktop/Web, click the "Copy" icon on the response (rather than dragging to highlight rendered HTML) so fenced code blocks (
```ts) are preserved forhandoff_read_section.
Pre-Release Checklist
Unit tests: config recovery, path traversal & symlink defense, UTF-8 byte truncation, binary skip, ROI ledger (
npm test)Live MCP
stdiointegration test: fullinitialize→tools/list→tools/calllifecycle + error survival (npm test)Local E2E smoke test with Gemini Desktop client (
F:\Gemini\App\Gemini.exe) via live Antigravity MCP serverReal A/B Token comparison recorded in this README
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hand a brief from ChatGPT, Claude or Gemini to your own coding agent or Grok Bot. Send only.
Context, runtime and review for AI coding agents. One local install.
Long-term memory and file coordination for coding agents, shared across tools and sessions.
Project memory, documentation and controlled secret access for AI coding agents.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables Claude Code and Claude Desktop to delegate token-heavy tasks to Antigravity headless subagents, offloading file edits, test runs, and exploration while preserving Claude's context window.121MIT
- AlicenseBqualityNot gradedmaintenanceEnables MCP-compatible AI clients like Claude Code, Cursor, and Codex to invoke Google Antigravity's Gemini coding agent for repository-aware file operations, command execution, code review, test generation, and quota checks, while also providing a standalone dual-mode CLI.7MIT
- AlicenseAqualityCmaintenanceLets MCP clients such as Claude Code, Claude Desktop, Cursor, or Codex hand tasks to the Antigravity CLI (agy) so the work runs on the user's Antigravity plan instead of the client's. Exposes tools for delegated coding tasks and reviews, web search with sources, image/PDF analysis, shell command generation or execution, brainstorming, and model/quota checks.7MIT
- AlicenseBqualityCmaintenanceEnables MCP clients such as Claude Code and Cursor to delegate long multi-step coding tasks to Google Antigravity CLI, generate read-only plans and code reviews, digest large codebases, and manage background sessions in isolated git worktrees.15152 npm2MIT