Agy Bridge

io.github.sshahzaiib由 GitHub 帳號 sshahzaiib 發布v0.3.1更新於 Oct 24, 2026

Delegate heavy tasks from Claude Code to the Antigravity CLI (Gemini) with quota-aware failover.

已驗證STDIO僅桌面開發者工具AI 與機器學習

概覽

AI 產生的概覽

一個 MCP 橋接服務,讓 Claude Code 把繁重任務交給 Antigravity CLI(agy),只取回答案,並具備模型路由與配額感知的容錯切換。

可以做什麼
  • 分析大型檔案、日誌與傾印,或對方案與程式碼做對抗式審查
  • 執行 git log/diff/blame 考古式檢索與全儲存庫 grep,結果不進入呼叫端上下文
  • 透過 CLI 的模型查詢文件與外部知識
  • 依 session id 接續先前的委派工作階段,無需重送上下文
  • 委派其他繁重任務,可依呼叫指定模型或工作目錄
適用情境
適合 Claude Code 工作階段因大型檔案、儲存庫檢索或網路查詢而大量消耗上下文時,把這類工作外包給另一個模型。也適合需要在模型配額用盡時自動切換的場景。
執行需求
透過 npx 啟動的本機 stdio 程序,需要 Node.js 18+。需安裝並完成驗證的 Antigravity CLI(agy),預期用戶端為 Claude Code。選用環境變數:AGY_PATH、AGY_TIMEOUT、AGY_TIMEOUT_ 、AGY_MAX_OUTPUT_CHARS、AGY_DEFAULT_MODEL、AGY_SANDBOX、AGY_ON_FAILURE。建議把用戶端工具逾時設得足夠長。
安裝前請注意
預設 AGY_SKIP_PERMISSIONS 為 true,即 agy 以 --dangerously-skip-permissions 執行;可設 AGY_SANDBOX 改為沙箱執行。委派任務會把提示詞及檔案或儲存庫內容傳送給 agy CLI 及其上游模型。長時間執行可能超過用戶端工具呼叫逾時;失敗後若未將 AGY_ON_FAILURE 設為 strict,呼叫端代理可能自行重做該工作。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Agy Bridge,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[agy-bridge — Claude Code delegates heavy tasks to the Antigravity CLI]

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]

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

bash
# 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 Flash (High) → Gemini Pro (Low) → fallback
deep_searchgit log/diff/blame archaeology, repo-wide grepsGemini Flash (Medium) → (High) → fallback
web_lookupDocs, API references, external/current knowledgeGemini Flash (Medium) → (High) → fallback
adversarial_reviewPlan critiques, design and code reviewsGemini Pro (High) → Gemini Flash (High) → fallback
follow_upContinue a prior session by session_id — no context resendinherits the session
delegateAnything else heavyGemini Flash (High) → fallback

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 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. Chain entries name a family and tier rather than a version (Gemini * Flash (High)), and * resolves to the newest version agy currently lists, so a Gemini release never silently breaks routing. Chains are Gemini-first; Claude Opus and GPT-OSS are appended as a last resort and only used when no Gemini model is listed. 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 (name, id, or * pattern)
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

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

Support

agy-bridge is free and MIT-licensed. If it saves you tokens every day, Ko-fi keeps it maintained.

Contributors

Contributions are welcome — open an issue or PR.

[Contributors]

Star History

[Star History Chart]

License

MIT

來源:README.md,提交 02c5fa0

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分