PluginBench
MCP Server
Maintained
MIT

io.github.sshahzaiib/agy-bridge MCP Server

io.github.sshahzaiib/agy-bridge

Delegate heavy tasks from Claude Code to Antigravity CLI with quota-aware failover and multi-model routing.

What is the io.github.sshahzaiib/agy-bridge MCP server?

The agy-bridge MCP server lets Claude Code delegate computationally heavy tasks to the Antigravity CLI (agy), routing them across Gemini, Claude, and open-source models while protecting Claude's context window and token budget. It handles quota exhaustion with automatic failover, session continuity, and configurable output truncation.

agy-bridge bridges Claude Code and the Antigravity CLI, offloading large file analysis, deep git searches, web lookups, and code reviews to specialized models. Instead of consuming Claude's context, tasks are routed to the best available model in a preference chain, with automatic failover when quotas are exhausted and session-aware follow-ups to avoid resending context.

How to install io.github.sshahzaiib/agy-bridge

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Environment / auth
  • AGY_PATH

    Path to the agy binary (defaults to `agy` on PATH)

  • AGY_TIMEOUT

    Override the per-tool timeouts, in seconds

  • AGY_MAX_OUTPUT_CHARS

    Truncation cap for tool output, in characters (default 50000)

  • AGY_DEFAULT_MODEL

    Fallback model when no chain entry is available

  • AGY_ON_FAILURE

    Set to `strict` to instruct the calling agent not to absorb failed delegations (default `fallback`)

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "agy-bridge": {
      "command": "npx",
      "args": [
        "-y",
        "agy-bridge"
      ],
      "env": {
        "AGY_PATH": "<YOUR_AGY_PATH>",
        "AGY_TIMEOUT": "<YOUR_AGY_TIMEOUT>",
        "AGY_MAX_OUTPUT_CHARS": "<YOUR_AGY_MAX_OUTPUT_CHARS>",
        "AGY_DEFAULT_MODEL": "<YOUR_AGY_DEFAULT_MODEL>",
        "AGY_ON_FAILURE": "<YOUR_AGY_ON_FAILURE>"
      }
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • analyze_files — Analyze large files (>200 lines), multiple files at once, logs, dumps, and generated code. Routes to Gemini 3.5 Flash (High) → Gemini 3.1 Pro (Low).
  • deep_search — Perform git log/diff/blame archaeology and repo-wide greps. Routes to Gemini 3.5 Flash (Medium) → (High).
  • web_lookup — Look up documentation, API references, external knowledge, and current information. Routes to Gemini 3.5 Flash (Medium) → (High).
  • adversarial_review — Critique plans, design reviews, and code reviews. Routes to Gemini 3.1 Pro (High) → Claude Opus 4.6 (Thinking) → Flash (High).
  • follow_up — Continue a prior session by session_id without resending context. Inherits the session's model.
  • delegate — Delegate any other heavy task. Routes to Gemini 3.5 Flash (High).

Use cases

  • Analyze large codebases and log files without consuming Claude's context window
  • Search git history and perform repo-wide greps faster than local tools
  • Look up external documentation and APIs with current knowledge
  • Get adversarial code and design reviews from specialized models
  • Continue long-running analysis sessions without resending context
  • Automatically failover to alternative models when quota limits are hit

io.github.sshahzaiib/agy-bridge MCP server FAQ

What is agy-bridge?

agy-bridge is an MCP server that routes heavy tasks from Claude Code to the Antigravity CLI, which can delegate to Gemini, Claude, or open-source models. It saves Claude's context and tokens by offloading analysis, searches, and reviews.

Is agy-bridge free?

agy-bridge itself is free and open-source (MIT license). It requires the Antigravity CLI (agy) and authentication with your chosen model provider (Google, Anthropic, or others).

How do I install agy-bridge in Claude Code?

Run `claude mcp add-json -s user agy-bridge '{"command":"npx","args":["-y","agy-bridge"],"timeout":600000}'` to register it. The 600-second timeout prevents tool-call timeouts on cold starts and long-running tasks.

What authentication is required?

You must have the Antigravity CLI (agy) installed and authenticated with at least one model provider (Google Gemini, Anthropic Claude, or open-source via agy).

What happens if a model hits its quota?

agy-bridge detects quota exhaustion (429 errors) in real time, kills the request, and automatically retries on the next available model in the tool's preference chain. Failovers are logged in the response footer.

Can I continue a task that timed out on the client side?

Yes. Each response includes a session_id. Use the `follow_up` tool with that session_id to retrieve the result or continue the conversation without resending context.

README (reference)

Source of truth, from the repository.

<div align="center"> <img src="https://raw.githubusercontent.com/sshahzaiib/agy-bridge/main/assets/banner.svg" alt="agy-bridge — Claude Code delegates heavy tasks to the Antigravity CLI" width="100%">

agy-bridge

CI npm version npm downloads node license

Glama score

MseeP.ai Security Assessment Badge

An MCP bridge that lets Claude Code delegate heavy tasks to the Antigravity CLI (agy) — saving Claude's context window and tokens for what matters.

Claude sends a task → the bridge routes it to the best available model via agy → only the answer comes back. Large files, deep git searches, and web lookups never touch Claude's context.

Listed on

Glama MCP Market PulseMCP mcp.so MCP Servers Verified on MseeP

</div>
User → Claude Code → agy-bridge (MCP) → agy CLI → Gemini / Claude / GPT-OSS
                   ←                  ←          ←

Why this over claude-to-agy?

claude-to-agyagy-bridge
Tool surface1 generic delegate_to_agy6 purpose-built tools — Claude self-routes reliably
Model selectionnone (agy default only)per-tool routing across all agy models, with availability detection and fallback
Multi-turnstatelesssession continuity — follow_up resumes agy conversations without resending context
Output safetyunboundedconfigurable truncation cap protects Claude's context
Sandboxnooptional --sandbox mode
Installuvx (Python)npx (Node) — zero install

Requirements

Install

# 1. Register the MCP server (user scope = all projects).
#    add-json bakes in a generous client-side timeout so long analyze_files /
#    delegate calls don't trip Claude Code's tool-call deadline (see Timeouts).
claude mcp add-json -s user agy-bridge \
  '{"command":"npx","args":["-y","agy-bridge"],"timeout":600000}'

# 2. Add delegation rules to your project (or ~/.claude/CLAUDE.md for global)
curl -o CLAUDE.md https://raw.githubusercontent.com/sshahzaiib/agy-bridge/main/CLAUDE.md

The "timeout": 600000 (10 min, milliseconds) is the client-side tool-call deadline — without it, a cold-start analyze_files (~40–50s) or a long delegate can hit Claude Code's default and return timed out waiting for response while the agy run is still going. If your client doesn't honor a per-server timeout, set the global env var MCP_TOOL_TIMEOUT=600000 instead. Details and the agy-side budgets are in Timeouts and cancellation.

Tools

ToolUse forModel routing (first available)
analyze_filesFiles >200 lines, >3 files at once, logs, dumps, generated codeGemini 3.5 Flash (High) → Gemini 3.1 Pro (Low)
deep_searchgit log/diff/blame archaeology, repo-wide grepsGemini 3.5 Flash (Medium) → (High)
web_lookupDocs, API references, external/current knowledgeGemini 3.5 Flash (Medium) → (High)
adversarial_reviewPlan critiques, design and code reviewsGemini 3.1 Pro (High) → Claude Opus 4.6 (Thinking) → Flash (High)
follow_upContinue a prior session by session_id — no context resendinherits the session
delegateAnything else heavyGemini 3.5 Flash (High)

All tools accept optional cwd (project root) and model (an id or display name from agy models; validated, with available models listed on mismatch).

Every response ends with a footer:

---
[agy-bridge] model: Gemini 3.5 Flash (High) | session: 1f0c…-d4 (use follow_up to continue)

Model routing

On first use the bridge runs agy models (cached for the process lifetime) and picks the first available model in the tool's preference chain. If none is available it falls back to AGY_DEFAULT_MODEL, and finally to agy's own default. agy silently ignores unknown --model values, so the bridge validates names up front instead of letting requests land on the wrong model.

Quota-aware failover

agy never surfaces quota exhaustion in print mode — it silently retries the 429 until its print-timeout, then exits 0 with empty output, which used to look like an indefinite hang. The bridge now watches each run's log file (via --log-file) and on RESOURCE_EXHAUSTED (code 429):

  1. kills the agy process group immediately (no waiting out the timeout),
  2. parses the reset time ("Resets in 4h24m") into an in-process cooldown registry,
  3. retries the same prompt on the next model in the tool's chain,
  4. skips cooled-down models on all subsequent calls until their quota resets.

Failovers are annotated in the response footer (failover: <model>: quota exhausted (resets in 4h24m)). Only when every candidate is exhausted does the call fail — in seconds, with reset times listed — instead of hanging.

Timeouts and cancellation

Each tool has its own default timeout sized to its job: web_lookup 120s, deep_search 180s, analyze_files / adversarial_review / follow_up 300s, delegate 600s. Setting AGY_TIMEOUT explicitly overrides all of them at once. To change a single tool, set AGY_TIMEOUT_<TOOL_NAME> instead (e.g. AGY_TIMEOUT_DEEP_SEARCH=300); a per-tool override takes precedence over the global AGY_TIMEOUT and the tool's default. The full set of per-tool variables is AGY_TIMEOUT_ANALYZE_FILES, AGY_TIMEOUT_DEEP_SEARCH, AGY_TIMEOUT_WEB_LOOKUP, AGY_TIMEOUT_ADVERSARIAL_REVIEW, AGY_TIMEOUT_FOLLOW_UP, and AGY_TIMEOUT_DELEGATE. The kill path escalates SIGTERM → SIGKILL across the whole process group, and the deadline fires even if agy's helper processes hold the output pipes open. Cancelling the tool call from the MCP client (e.g. pressing Esc in Claude Code) also kills the agy run instead of orphaning it.

Two timeout layers — align them. The timeouts above are the agy-side budget. Your MCP client (Claude Code) has its own, separate tool-call timeout, and if it is shorter than the agy budget the client gives up first — you'll see Error: timed out waiting for response (note: agy-bridge's own timeout reads agy timed out after Ns instead). The work is not lost: the agy session persists, so follow_up with the returned session_id retrieves the result. But the real fix is to make the client wait at least as long as agy: the Install command already sets a per-server timeout of 600000ms (scoped to the agy-bridge entry only). If you registered the server without it, re-run the add-json command from Install, or set the global env var MCP_TOOL_TIMEOUT=600000. Rule of thumb: client timeout ≥ agy budget.

Expected latency. Most of the perceived "slowness" is cold start: the first call in a session spawns the agy CLI and warms the model. A simple analyze_files over 3 files measures around 40–50s cold (≈46s observed), dropping on subsequent same-session calls. A first call that also hits a quota 429 takes longer while the bridge fails over. So a client timeout below ~60s will intermittently trip on cold starts even for "simple" questions — size it generously.

Configuration

All optional, via environment variables:

VariableDefaultDescription
AGY_PATHagyPath to the agy binary
AGY_TIMEOUTper-toolSeconds; overrides all per-tool timeouts at once (see above), passed as --print-timeout, enforced with a 15s kill grace
AGY_TIMEOUT_<TOOL>per-toolSeconds; overrides the timeout for a single tool only, e.g. AGY_TIMEOUT_DEEP_SEARCH=300. Wins over AGY_TIMEOUT
AGY_MAX_OUTPUT_CHARS50000Truncation cap for tool output
AGY_DEFAULT_MODELunsetFallback model when no chain entry is available
AGY_SKIP_PERMISSIONStruePass --dangerously-skip-permissions to agy
AGY_SANDBOXfalseRun agy with --sandbox
AGY_ON_FAILUREfallbackstrict appends an instruction to failed-tool errors telling the calling agent not to absorb the work itself

Failure behavior

The bridge always fails loudly: agy errors surface as MCP tool errors with agy's actual stderr, and degraded model routing is annotated in the response footer. By default the calling agent (Claude) will typically do the work itself after a failure — visible in the transcript, but easy to stop noticing in a long session. Set AGY_ON_FAILURE=strict to append an explicit "do NOT perform this work yourself — report the failure to the user" instruction to every delegation error, so you keep control over when token savings are silently lost.

Development

npm install
npm test           # vitest unit tests (exec mocked — no agy needed)
npm run typecheck
npm run build      # tsup → dist/index.js

Contributors

Contributions are welcome — open an issue or PR.

<a href="https://github.com/sshahzaiib/agy-bridge/graphs/contributors"> <img src="https://contrib.rocks/image?repo=sshahzaiib/agy-bridge" alt="Contributors" /> </a>

Star History

Star History Chart

License

MIT

Related MCP servers

Shared visual canvas (Excalidraw) for collaborative whiteboarding between AI agents and humans.

1
TypeScript
MIT
View repository →
VKVK MCP Server logo

VK MCP Server

Maintained

MCP server for VK API with 180+ tools: users, wall, groups, friends, photos, messages.

1
JavaScript
MIT
View repository →

OpenJuno — Social network for AI agents. Post, follow, search, and interact with other AI agents.

0
TypeScript
View repository →

Read MyFigureCollection.net: search figures, JAN barcode lookup, shop prices, collections and clubs.

0
Python
MIT
View repository →

Remote MCP server for Scanduro QR codes, scan analytics and controlled code actions.

View repository →

AI debugging with 980+ verified fixes. Search the YanHui KB — never repeat a mistake.

View repository →