antigravity-cli-mcp-slim
v0.2.4A thin, auditable MCP server wrapping the Antigravity CLI (agy).
A thin, auditable MCP server wrapping the Antigravity CLI (agy). When you add an MCP server to your AI coding tool, every prompt and code snippet you send flows through that wrapper. Most CLI-wrapping MCP servers are small, individually maintained packages — and recent supply-chain incidents (xz-utils, postmark-mcp, the npm chalk/debug compromise) show that "small and useful" is not the same as "safe to trust blindly." This project takes the opposite stance: instead of asking you to trust it, it tries to be easy to audit.
Summary extracted from the README.
antigravity-cli-mcp-slim
A thin, auditable MCP server wrapping the Antigravity CLI (agy).
Why
When you add an MCP server to your AI coding tool, every prompt and code snippet
you send flows through that wrapper. Most CLI-wrapping MCP servers are small,
individually maintained packages — and recent supply-chain incidents
(xz-utils, postmark-mcp, the npm chalk/debug compromise) show that
"small and useful" is not the same as "safe to trust blindly."
This project takes the opposite stance: instead of asking you to trust it, it tries to be easy to audit.
- Single file — the whole server is
src/antigravity_cli_mcp_slim/server.py, readable end-to-end in one sitting - One third-party dependency (
mcp) — minimal supply-chain surface - Faithful CLI mapping — every typed parameter mirrors a real
agyflag by name, so it is obvious which flags an invocation actually sets - Forward-compatible — any new or uncommon
agyflag is reachable viaextra_argswithout touching this server - Configurable binary path —
$AGY_CMDlets you swap or wrap theagybinary - Transparent — every invocation logs the exact argv to stderr
Read server.py before you install. That is the point.
Prerequisites
- The
agyCLI, version 1.1.8 or newer, installed and on$PATH(or pointed to via$AGY_CMD). See the official Antigravity CLI repository and install docs. This server always passes--output-format json, and 1.1.8 is the first release to document and support that flag. agyalready authenticated — this wrapper does not manage login; it surfacesagy's own error output if the CLI is not ready.
Installation
# Run directly without installing
uvx antigravity-cli-mcp-slim
# Install from PyPI
pip install antigravity-cli-mcp-slim
# Run from GitHub HEAD
uvx --from git+https://github.com/tksfjt1024/antigravity-cli-mcp-slim antigravity-cli-mcp-slim
Usage as an MCP server
Claude Code
claude mcp add antigravity-cli uvx antigravity-cli-mcp-slim
Or manually in ~/.claude.json:
{
"mcpServers": {
"antigravity-cli": {
"type": "stdio",
"command": "uvx",
"args": ["antigravity-cli-mcp-slim"]
}
}
}
If agy is not on the launching process's $PATH, point $AGY_CMD at it:
{
"mcpServers": {
"antigravity-cli": {
"type": "stdio",
"command": "uvx",
"args": ["antigravity-cli-mcp-slim"],
"env": { "AGY_CMD": "/absolute/path/to/agy" }
}
}
}
Other MCP clients
Any MCP-compatible client can launch the server via stdio:
uvx antigravity-cli-mcp-slim
Tool: consult_agy
Runs a single agy invocation in non-interactive print mode (agy --print).
agy is an agentic assistant: it autonomously reads files in directory
(and any add_dir) to fulfill the request, then prints the response. Depending on its
own permission settings, it can also edit files and run commands.
The tool returns agy's response text followed by one metadata line:
[agy] status=SUCCESS conversation_id=00000000-0000-4000-8000-000000000001 total_tokens=18035
status is whatever agy reported for the run and is always present; the other fields
appear only when the run produced them. The values shown here are examples, not the full
set agy can return. A run agy itself calls failed also carries its reason in error,
and the tool result is flagged isError instead of coming back as a successful call:
[agy] status=ERROR error=timeout waiting for response conversation_id=00000000-0000-4000-8000-000000000002
Starting in agy 1.4.11, a turn that stops early (a print_timeout hit, an error, or
an interruption) records the cause in finished_reason. The tool result for such a
turn is flagged isError, even when agy reports status=SUCCESS or returns a
partial answer, and finished_reason on the metadata line is what tells a timeout
apart from other failures. How the output starts depends on agy's exit code:
- When
agyexits 0, the output starts with[ERROR] agy did not finish the turn (finished_reason=…), followed by the metadata line and, if present, the partial answer underpartial response:. Onagy1.4.12, aprint_timeouthit and a mid-turn error both exited 0. - When
agyexits non-zero, the output starts with an[ERROR] agy failedline and areturncode=…line, followed by the metadata line,agy's stderr and its raw stdout. A partial answer, if any, stays in theresponsefield of the stdout JSON. Starting inagy1.5.0, aprint_timeouthit exits 3.
On a print_timeout hit, agy's stderr can hold a line of its own that also starts
with [agy] ([agy] print timeout after …); the metadata line is the one before
stderr:.
Either way the metadata line carries finished_reason. A print_timeout hit on 1.4.12
(first line) and on 1.5.0 (second line):
[agy] status=SUCCESS finished_reason=print_timeout conversation_id=00000000-0000-4000-8000-000000000003
[agy] status=ERROR error=print timeout after 3s with the turn still in progress; the response is partial finished_reason=print_timeout conversation_id=00000000-0000-4000-8000-000000000004 total_tokens=0
Pass the conversation_id from the metadata line back as conversation to resume the
same run.
Prefer it over continue, which races with any other invocation for whichever
conversation happens to be the most recent one.
| Parameter | Type | Description |
|---|---|---|
query (required) |
string | Prompt sent verbatim to agy --print |
directory (required) |
string | Working directory (agy cwd); the default workspace root |
add_dir |
string[] | Extra workspace directories; each maps to one --add-dir (repeatable, not comma-joined) |
dangerously_skip_permissions |
bool | Pass --dangerously-skip-permissions (auto-approve all tool requests). See warning below |
sandbox |
bool | Pass --sandbox (terminal restrictions enabled) |
continue |
bool | Pass --continue (resume the most recent conversation). Mutually exclusive with conversation |
conversation |
string | Pass --conversation <ID> (resume a specific conversation). Mutually exclusive with continue |
print_timeout |
string | Pass --print-timeout (Go duration, e.g. 5m0s). Keep shorter than timeout_seconds |
extra_args |
string[] | Raw CLI flags appended verbatim. Use for new/uncommon agy flags |
env |
object | Extra environment variables for the agy subprocess |
timeout_seconds |
int | Hard wall-clock timeout for the subprocess (default 660) |
Security note: dangerously_skip_permissions
dangerously_skip_permissions: true passes --dangerously-skip-permissions,
which auto-approves all of agy's tool permission requests — including
running shell commands and editing files — with no prompt. The parameter keeps
the dangerously_ prefix on purpose: enable it only in a trusted, isolated
workspace where you fully trust the prompt. It defaults to false.
Cross-repository analysis example
Analyze multiple repositories from a single invocation by adding directories to the workspace:
{
"name": "consult_agy",
"arguments": {
"query": "Compare the API surface of the main service with the clients that call it",
"directory": "/path/to/main-service",
"add_dir": [
"/path/to/client-a",
"/path/to/client-b"
]
}
}
This launches agy --print "..." --output-format json --add-dir /path/to/client-a --add-dir /path/to/client-b,
giving the agent read access to all three workspaces in one session.
Conversation continuity
agy can resume prior conversations. This wrapper exposes that directly and
stays stateless itself:
continue: trueresumes the most recent conversation. Because "most recent" is shared state, concurrent calls can race on it — preferconversationwhen it matters.conversation: "<ID>"resumes a specific conversation by id.
The two are mutually exclusive; passing both returns an error.
Timeout configuration
There are two independent timeouts:
print_timeout—agy's own wait timeout (Go duration;agy1.5.0 defaults to0s, which waits until the turn completes).timeout_seconds— this wrapper's hard wall-clock limit (default 660).
Keep timeout_seconds longer than print_timeout so agy can finish or time
out cleanly before the wrapper force-kills the subprocess. When you raise
print_timeout for a long task, raise timeout_seconds to match. On agy 1.5.0,
without print_timeout, only timeout_seconds bounds the run.
On timeout, the wrapper kills the subprocess's whole process group and then
waits up to 20 additional seconds to collect any buffered output and reap the
process, so the effective wall-clock ceiling is timeout_seconds + 20.
Forward-compatibility example
If a future agy release adds a new flag (say --super-mode), use it
immediately without updating this server:
{
"name": "consult_agy",
"arguments": {
"query": "...",
"directory": "...",
"extra_args": ["--super-mode"]
}
}
Letting the client run calls concurrently (readOnlyHint)
Claude Code (2.1.326) runs calls to tools that declare readOnlyHint: true
concurrently with each other when they are next to each other in one response. A
call to a tool without the declaration runs on its own, after the calls before it
have finished, so several consult_agy calls placed in one response wait for each
other. This server does not make the declaration by default. Set
ANTIGRAVITY_CLI_MCP_SLIM_READ_ONLY_HINT=1 in the entry's env block to have it list
consult_agy with annotations: {"readOnlyHint": true} (and no other annotation):
{
"mcpServers": {
"antigravity-cli": {
"type": "stdio",
"command": "uvx",
"args": ["antigravity-cli-mcp-slim"],
"env": { "ANTIGRAVITY_CLI_MCP_SLIM_READ_ONLY_HINT": "1" }
}
}
}
The value is 1 or true to turn it on and 0, false or an empty string to leave it
off (case does not matter); any other value makes the server exit at startup. Without
the variable, the tool list is unchanged.
Read this before turning it on:
- The declaration is stronger than what
consult_agydoes. The MCP specification definesreadOnlyHint: trueas "the tool does not modify its environment".agyis an agentic assistant: depending on its own permission settings, it can create, edit and delete files and run commands in print mode, anddangerously_skip_permissionsapproves all of them. Claude Code's documentation also describes the hint as "the tool changes nothing"; this setting is for the concurrency, not because the tool is read-only. Concurrent calls that write to the same directory can interfere with each other, andcontinueresumes the most recent conversation, which concurrent calls share, so useconversationfor calls that run together. - The client may use the same declaration for more than concurrency. Claude Code's documentation describes what the hint does for retrying a call after a dropped connection and for concurrency, and does not say whether the declaration also affects its permission decisions; this project has not checked that. The MCP specification says clients should never make tool use decisions based on annotations from untrusted servers, and other clients may read the hint when they decide whether to ask you before a call. Check your client's documentation before enabling it for a server that can write.
Configuration
| Environment variable | Default | Purpose |
|---|---|---|
AGY_CMD |
agy |
Path to the agy CLI binary |
ANTIGRAVITY_CLI_MCP_SLIM_TIMEOUT |
660 |
Default subprocess timeout in seconds |
ANTIGRAVITY_CLI_MCP_SLIM_LOG_LEVEL |
INFO |
Logging level for stderr diagnostics |
ANTIGRAVITY_CLI_MCP_SLIM_READ_ONLY_HINT |
off | 1 or true lists the tool with readOnlyHint: true (above) |
Development
# Install dev dependencies
pip install -e ".[test,dev]"
# Lint
ruff check .
# Test
pytest
License
MIT © tksfjt1024