Skip to main content
Glama

ag-mcp

An MCP server that lets Claude Code drive agy (Google's Antigravity CLI) as a cheap, sandboxed exploration agent.

agy defaults to inexpensive Gemini Flash models and is fast at broad, greedy exploration — but it hallucinates more than Claude does. This server is built around that tradeoff: it exposes agy as a delegate that Claude can send exploration/search/summarization tasks to, with an explicit per-call permission preset, and every result comes back tagged with a reminder that agy's claims (file paths, line numbers, quoted code) need to be verified with Claude's own tools before being trusted or repeated to the user.

How permissions work

agy runs in headless print mode (agy -p ...), where every tool call is auto-denied unless pre-approved in its ~/.gemini/antigravity-cli/settings.json. This server does not permanently change that file. Instead, for each call it:

  1. Reads the current real settings.json and remembers its exact bytes.

  2. Writes a temporary version with permissions.allow set to just the tools for the requested preset.

  3. Runs agy.

  4. Restores the original file byte-for-byte (or deletes it if it didn't exist before), even on error or if the process is killed mid-call.

Calls are serialized in-process so concurrent tool calls can't race on that file.

Three presets, chosen per call via the permission argument:

preset

what agy can do

none

Nothing — answers from its own context only, no tool calls at all.

read_only

read_file, glob, codebase_search, plus a curated set of read-only shell commands: ls, cat, head, tail, wc, pwd, file, stat, du, and git log/diff/show/status/blame (any arguments, but no chaining/piping/substitution/redirection — verified empirically, see src/permissions.js). Cannot write anything. Default.

read_write

Full access via --dangerously-skip-permissions (read, write, edit, run shell commands). No guardrails — only use when you actually want agy to make changes.

Every call also gets a prompt prefix (src/agy.js) telling agy up front exactly what it can and can't reach for the given preset — without it, cheap/low-effort models tend to reach for a denied shell command first and give up instead of falling back to an allowed tool.

Related MCP server: agent-delegation-mcp

Streaming and progress

Calls run with agy --output-format stream-json, parsed event-by-event as they arrive (not buffered and parsed as one blob at the end). Each event — agy starting, a tool call starting/finishing, incremental response text — is forwarded live:

  • If the calling client requested progress tracking (sent a progressToken), it gets real notifications/progress events tied to that call.

  • Otherwise it gets notifications/message (logging) events instead — a connection-level stream that needs no client opt-in, as a fallback for clients that don't support per-call progress tracking.

Either way the final tool result is unchanged; this only affects what you see while it's running.

Watching a background task without polling

agy_status's wait_seconds long-polls, but it's capped at 25s: a real observed failure was a 120s long-poll exceeding the calling client's own tool-call timeout, which caused the client to kill/restart this MCP server to recover — destroying every task tracked in it, including whatever was still running. Long-polling this server is inherently risky for that reason.

The more robust pattern is log_file: pass a path on agy_ask/agy_continue (with background: true) and the task's activity streams to that file as plain text. The file is created immediately — before anything async even starts — so a wait-loop never spins on one that doesn't exist yet. Once the task reaches a terminal state (success, a real error, or even a crash before it properly started), the raw response/error text is appended between ###AGY_RESPONSE_START### / ###AGY_RESPONSE_END### lines, then the full JSON result, then a closing marker — ###AGY_TASK_DONE### on success, ###AGY_TASK_ERROR### on any failure, always exactly one of the two, guaranteed (see finalizeLog / the top-level try/catch in runOrBackground, src/index.js). Wait on that file with your own Bash tool's run_in_background: true instead of polling this server:

until grep -qE '###AGY_TASK_DONE###|###AGY_TASK_ERROR###' /path/to/log; do sleep 5; done

That gets you an ordinary background-task completion notification from your own tooling — on success or failure — with no risk of a long-poll tripping a client-side timeout and taking the whole server down with it.

To extract just the response/error text without JSON-parsing the full result block:

sed -n '/###AGY_RESPONSE_START###/,/###AGY_RESPONSE_END###/p' /path/to/log | sed '1d;$d'

This matters in practice: agy can return status: "ERROR" (e.g. a network failure finalizing a huge-context turn) while response still contains a complete, valid answer — the error status doesn't mean the content is worthless, so pull response out and check it before assuming a failed call produced nothing useful.

A full home-directory sandbox (fake $HOME) was tried first so presets wouldn't need to touch the real settings file at all, but agy also validates auth against the macOS Keychain, which isn't affected by $HOME — so that approach breaks login and was dropped in favor of the transient-swap approach above.

Tools

  • agy_ask(prompt, permission?, cwd?, add_dir?, model?, effort?, mode?, timeout_seconds?, background?, log_file?) Starts a new agy conversation. Returns conversation_id, status, response, token usage, and duration. timeout_seconds maxes out at 3600, but for a blocking call (default) that just wastes the whole call sitting there — prefer background: true for anything that might run long. log_file streams activity to a file ending in a ###AGY_TASK_DONE### marker — see "Watching a background task without polling" below.

  • agy_continue(conversation_id, prompt, permission?, ...) Sends a follow-up into an existing conversation, preserving its context. Same parameters (including background) as agy_ask.

  • agy_status(task_id, wait_seconds?) Checks a background task started with background: true. Returns its status (running/done/error), a log of recent activity (tool calls, response text as it streamed in), and — once finished — the same result object a blocking call would have returned. wait_seconds (max 120) long-polls instead of returning running immediately.

  • agy_list_tasks() Lists every background task from this session (any status), so a lost task_id can be recovered.

  • agy_cancel(task_id) Kills a still-running background task.

  • agy_list_models() Lists models available to agy (mostly Gemini Flash tiers at various reasoning efforts, plus a couple of Claude/GPT-OSS options) for use with the model parameter.

Background tasks are tracked in-memory for the life of this server process (src/tasks.js) — they don't survive an MCP reconnect/restart, and (like the underlying permission-preset mutation) none/read_only tasks still queue behind each other one at a time; only read_write calls, which skip the settings-file swap entirely, can truly run concurrently with another call.

Install

cd /path/to/AG-mcp
npm install

Register with Claude Code:

claude mcp add ag-mcp -- node /path/to/AG-mcp/src/index.js

Or add directly to your Claude Code MCP config:

{
  "mcpServers": {
    "ag-mcp": {
      "command": "node",
      "args": ["/path/to/AG-mcp/src/index.js"]
    }
  }
}

Requires agy to already be authenticated (agy will prompt to log in on first interactive run if it isn't) and on $PATH as agy (override with the AGY_MCP_BIN env var if it's installed elsewhere).

Known limitations

  • Headless mode has no interactive "always allow" flow, so agy shouldn't legitimately write to settings.json mid-call — but if it ever did, this server's restore-on-finally would discard that write along with the temporary permission patch.

  • read_write gives agy unrestricted shell/file access for the duration of that single call. Scope cwd / add_dir tightly and only use it when you mean it.

Available Tools

6 tools
agy_askAsk agyA

Delegate a task to agy (Google's Antigravity CLI), a cheap agentic model that's good at broad exploration but prone to hallucination. Use it to cast a wide net over a codebase or question — locating candidate files, summarizing structure, drafting an approach — before you commit your own more expensive tool calls to verifying and acting on it. Starts a brand-new agy conversation; use agy_continue to follow up on this one. agy is a cheap, fast model and explores well, but it fabricates file paths, line numbers, function names, and quoted code with some regularity. Treat everything in response as an unverified lead, not fact: before repeating a specific claim (a path, a symbol, a line number, an exact quote) to the user or acting on it, confirm it yourself with Read/Grep/Glob.

Inputs: prompt (required), cwd, mode, model, +6 more.

agy_cancelCancel a background agy taskA

Kill a still-running background agy task started with agy_ask/agy_continue's background:true.

Inputs: task_id (required).

agy_continueContinue an agy conversationA

Send a follow-up prompt into an existing agy conversation (from a prior agy_ask/agy_continue result's conversation_id), keeping its prior context. agy is a cheap, fast model and explores well, but it fabricates file paths, line numbers, function names, and quoted code with some regularity. Treat everything in response as an unverified lead, not fact: before repeating a specific claim (a path, a symbol, a line number, an exact quote) to the user or acting on it, confirm it yourself with Read/Grep/Glob.

Inputs: prompt (required), conversation_id (required), cwd, mode, +7 more.

agy_list_modelsList agy modelsA

List the models available to agy (mostly cheap Gemini Flash tiers, plus a couple of Claude/GPT-OSS options), for use with the model parameter on agy_ask / agy_continue.

Inputs: no named parameters.

agy_list_tasksList background agy tasksA

List every background agy task started in this session (running, done, or errored) with its task_id, so you can recover a task_id you've lost track of and check it with agy_status.

Inputs: no named parameters.

agy_statusCheck a background agy taskA

Check on a background agy task started with agy_ask/agy_continue's background:true. Returns its current status, recent activity (tool calls, response text as it streams in), and — once it's done or errored — the same result object a blocking call would have returned. Pass the response's next_cursor back as after_cursor on your next call so repeat polls only show what's new, instead of re-showing the same overlapping window of recent activity every time. agy is a cheap, fast model and explores well, but it fabricates file paths, line numbers, function names, and quoted code with some regularity. Treat everything in response as an unverified lead, not fact: before repeating a specific claim (a path, a symbol, a line number, an exact quote) to the user or acting on it, confirm it yourself with Read/Grep/Glob.

Inputs: task_id (required), after_cursor, wait_seconds.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct operation: start a conversation (agy_ask), continue one (agy_continue), enumerate models (agy_list_models), poll a background task (agy_status), enumerate tasks (agy_list_tasks), and kill a task (agy_cancel). The ask/continue split is explicitly clarified in the descriptions, and status vs list_tasks serve clearly different roles (single task detail vs session-wide inventory). No two tools appear interchangeable.

    Naming Consistency4/5

    All tools share the agy_ prefix and follow a verb_noun or verb pattern (ask, continue, list_models, list_tasks, cancel), which is predictable and readable. The only deviation is agy_status, which uses a noun rather than a verb like get_status, a minor inconsistency.

    Tool Count5/5

    Six tools is well-scoped for a wrapper around a single CLI agent: one entry point, one continuation, and a small background-task lifecycle plus model discovery. Every tool maps to a real need (start, follow up, monitor, enumerate, cancel, discover models) with no filler.

    Completeness4/5

    The surface covers the full lifecycle of a delegation session: initiate, continue with context, run in background, poll status, list tasks, cancel, and pick a model. Minor gaps exist — no way to enumerate or resume conversations from prior sessions, and no tool to abort a blocking call — but agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Lets Claude Code use Google's Antigravity CLI (agy) to review plans or execute them in isolated git worktrees, with safety controls like secret scanning.
      4
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Lets 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.
      7
      MIT