antigravity-cli-mcp-slim 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- antigravity_cli_mcp_slim/__init__.py +8 -0
- antigravity_cli_mcp_slim/py.typed +0 -0
- antigravity_cli_mcp_slim/server.py +304 -0
- antigravity_cli_mcp_slim-0.1.0.dist-info/METADATA +246 -0
- antigravity_cli_mcp_slim-0.1.0.dist-info/RECORD +9 -0
- antigravity_cli_mcp_slim-0.1.0.dist-info/WHEEL +5 -0
- antigravity_cli_mcp_slim-0.1.0.dist-info/entry_points.txt +2 -0
- antigravity_cli_mcp_slim-0.1.0.dist-info/licenses/LICENSE +21 -0
- antigravity_cli_mcp_slim-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""antigravity_cli_mcp_slim - thin auditable MCP wrapper around the Antigravity CLI (agy)."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version as _pkg_version
|
|
4
|
+
|
|
5
|
+
from .server import main
|
|
6
|
+
|
|
7
|
+
__version__ = _pkg_version("antigravity-cli-mcp-slim")
|
|
8
|
+
__all__ = ["__version__", "main"]
|
|
File without changes
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
"""antigravity_cli_mcp_slim: Thin, auditable MCP server wrapping the Antigravity CLI (agy).
|
|
2
|
+
|
|
3
|
+
Design goals:
|
|
4
|
+
* Auditable: a single file with only one third-party dependency (`mcp`),
|
|
5
|
+
readable end-to-end in one sitting.
|
|
6
|
+
* Forward-compatible: any new agy CLI flag is reachable via `extra_args`
|
|
7
|
+
without server changes; the binary itself can be swapped via $AGY_CMD.
|
|
8
|
+
* Safe: subprocess uses argv-list form (no shell), explicit cwd, hard timeout,
|
|
9
|
+
explicit env merge. Each invocation logs the exact argv to stderr.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import asyncio
|
|
15
|
+
import contextlib
|
|
16
|
+
import logging
|
|
17
|
+
import os
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
from mcp.server import Server
|
|
22
|
+
from mcp.server.stdio import stdio_server
|
|
23
|
+
from mcp.types import TextContent, Tool
|
|
24
|
+
|
|
25
|
+
logger = logging.getLogger("antigravity_cli_mcp_slim")
|
|
26
|
+
|
|
27
|
+
AGY_CMD = os.environ.get("AGY_CMD", "agy")
|
|
28
|
+
DEFAULT_TIMEOUT = int(os.environ.get("ANTIGRAVITY_CLI_MCP_SLIM_TIMEOUT", "660"))
|
|
29
|
+
|
|
30
|
+
server: Server = Server("antigravity-cli-mcp-slim")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _build_argv(
|
|
34
|
+
*,
|
|
35
|
+
query: str,
|
|
36
|
+
add_dir: list[str] | None = None,
|
|
37
|
+
dangerously_skip_permissions: bool = False,
|
|
38
|
+
sandbox: bool = False,
|
|
39
|
+
continue_: bool = False,
|
|
40
|
+
conversation: str | None = None,
|
|
41
|
+
print_timeout: str | None = None,
|
|
42
|
+
extra_args: list[str] | None = None,
|
|
43
|
+
) -> list[str]:
|
|
44
|
+
# The prompt must be the token immediately after --print. agy treats
|
|
45
|
+
# --print as a string flag, so anything placed between --print and the
|
|
46
|
+
# prompt would be swallowed as the prompt text. Keep `query` first; every
|
|
47
|
+
# other flag follows it.
|
|
48
|
+
argv: list[str] = [AGY_CMD, "--print", query]
|
|
49
|
+
for d in add_dir or []:
|
|
50
|
+
argv += ["--add-dir", d] # repeatable flag: one --add-dir per directory
|
|
51
|
+
if dangerously_skip_permissions:
|
|
52
|
+
argv.append("--dangerously-skip-permissions")
|
|
53
|
+
if sandbox:
|
|
54
|
+
argv.append("--sandbox")
|
|
55
|
+
if conversation:
|
|
56
|
+
argv += ["--conversation", conversation]
|
|
57
|
+
elif continue_:
|
|
58
|
+
argv.append("--continue")
|
|
59
|
+
if print_timeout:
|
|
60
|
+
argv += ["--print-timeout", print_timeout]
|
|
61
|
+
if extra_args:
|
|
62
|
+
argv += list(extra_args)
|
|
63
|
+
return argv
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
async def _run_agy(
|
|
67
|
+
*,
|
|
68
|
+
cwd: str,
|
|
69
|
+
argv: list[str],
|
|
70
|
+
timeout: int,
|
|
71
|
+
env_overrides: dict[str, str] | None = None,
|
|
72
|
+
stdin_text: str | None = None,
|
|
73
|
+
) -> dict[str, Any]:
|
|
74
|
+
cwd_path = Path(cwd).expanduser().resolve()
|
|
75
|
+
if not cwd_path.is_dir():
|
|
76
|
+
return {
|
|
77
|
+
"ok": False,
|
|
78
|
+
"error": f"directory does not exist: {cwd_path}",
|
|
79
|
+
"argv": argv,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
env = os.environ.copy()
|
|
83
|
+
if env_overrides:
|
|
84
|
+
env.update({k: str(v) for k, v in env_overrides.items()})
|
|
85
|
+
|
|
86
|
+
logger.info("exec %s (cwd=%s, timeout=%ss)", argv, cwd_path, timeout)
|
|
87
|
+
|
|
88
|
+
# stdin must NOT inherit the parent's stdin: when this server runs over the
|
|
89
|
+
# stdio MCP transport, the parent's stdin is the JSON-RPC channel from the
|
|
90
|
+
# MCP client. A child that reads from (or sets ioctl flags on) a shared
|
|
91
|
+
# stdin file description can corrupt that channel. agy is a Go binary and
|
|
92
|
+
# was not observed to do this, but DEVNULL is the safe default and also
|
|
93
|
+
# stops agy from blocking on an interactive auth/permission prompt that can
|
|
94
|
+
# never be answered in headless --print mode.
|
|
95
|
+
try:
|
|
96
|
+
proc = await asyncio.create_subprocess_exec(
|
|
97
|
+
*argv,
|
|
98
|
+
cwd=str(cwd_path),
|
|
99
|
+
stdin=asyncio.subprocess.PIPE if stdin_text is not None else asyncio.subprocess.DEVNULL,
|
|
100
|
+
stdout=asyncio.subprocess.PIPE,
|
|
101
|
+
stderr=asyncio.subprocess.PIPE,
|
|
102
|
+
env=env,
|
|
103
|
+
)
|
|
104
|
+
except OSError as exc:
|
|
105
|
+
return {
|
|
106
|
+
"ok": False,
|
|
107
|
+
"error": f"failed to launch agy binary: {exc} (check $AGY_CMD)",
|
|
108
|
+
"argv": argv,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
try:
|
|
112
|
+
stdout, stderr = await asyncio.wait_for(
|
|
113
|
+
proc.communicate(stdin_text.encode() if stdin_text else None),
|
|
114
|
+
timeout=timeout,
|
|
115
|
+
)
|
|
116
|
+
except asyncio.TimeoutError:
|
|
117
|
+
# The process may have exited between the timeout firing and this kill;
|
|
118
|
+
# suppress the resulting race rather than crashing the request handler.
|
|
119
|
+
with contextlib.suppress(ProcessLookupError):
|
|
120
|
+
proc.kill()
|
|
121
|
+
await proc.wait()
|
|
122
|
+
return {
|
|
123
|
+
"ok": False,
|
|
124
|
+
"error": f"timeout after {timeout}s",
|
|
125
|
+
"argv": argv,
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
"ok": proc.returncode == 0,
|
|
130
|
+
"returncode": proc.returncode,
|
|
131
|
+
"stdout": stdout.decode("utf-8", errors="replace"),
|
|
132
|
+
"stderr": stderr.decode("utf-8", errors="replace"),
|
|
133
|
+
"argv": argv,
|
|
134
|
+
"cwd": str(cwd_path),
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _format_result(result: dict[str, Any]) -> str:
|
|
139
|
+
if result["ok"]:
|
|
140
|
+
return result["stdout"]
|
|
141
|
+
parts = [f"[ERROR] {result.get('error', 'agy failed')}"]
|
|
142
|
+
if "returncode" in result:
|
|
143
|
+
parts.append(f"returncode={result['returncode']}")
|
|
144
|
+
if result.get("stderr"):
|
|
145
|
+
parts.append(f"stderr:\n{result['stderr']}")
|
|
146
|
+
if result.get("stdout"):
|
|
147
|
+
parts.append(f"stdout:\n{result['stdout']}")
|
|
148
|
+
parts.append(f"argv: {result.get('argv')}")
|
|
149
|
+
if "cwd" in result:
|
|
150
|
+
parts.append(f"cwd: {result['cwd']}")
|
|
151
|
+
return "\n\n".join(parts)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
_TOOL_PROPS: dict[str, Any] = {
|
|
155
|
+
"query": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"minLength": 1,
|
|
158
|
+
"description": (
|
|
159
|
+
"Prompt sent verbatim to agy via --print. "
|
|
160
|
+
"agy runs its full agentic loop and prints the response to stdout."
|
|
161
|
+
),
|
|
162
|
+
},
|
|
163
|
+
"directory": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"description": (
|
|
166
|
+
"Working directory (agy cwd). Defines the default workspace root agy reads from."
|
|
167
|
+
),
|
|
168
|
+
},
|
|
169
|
+
"add_dir": {
|
|
170
|
+
"type": "array",
|
|
171
|
+
"items": {"type": "string"},
|
|
172
|
+
"description": (
|
|
173
|
+
"Extra workspace directories. Each entry maps to a separate agy --add-dir flag "
|
|
174
|
+
"(repeatable, not comma-joined). Use to analyze multiple repositories in one call."
|
|
175
|
+
),
|
|
176
|
+
},
|
|
177
|
+
"dangerously_skip_permissions": {
|
|
178
|
+
"type": "boolean",
|
|
179
|
+
"description": (
|
|
180
|
+
"Pass --dangerously-skip-permissions: auto-approve ALL tool permission requests "
|
|
181
|
+
"without prompting, letting agy run commands and edit files unattended. "
|
|
182
|
+
"Leave false (the default) unless you fully trust the prompt and workspace."
|
|
183
|
+
),
|
|
184
|
+
},
|
|
185
|
+
"sandbox": {
|
|
186
|
+
"type": "boolean",
|
|
187
|
+
"description": "Pass --sandbox: run agy with terminal restrictions enabled.",
|
|
188
|
+
},
|
|
189
|
+
"continue": {
|
|
190
|
+
"type": "boolean",
|
|
191
|
+
"description": (
|
|
192
|
+
"Pass --continue: resume the most recent agy conversation. "
|
|
193
|
+
"Mutually exclusive with `conversation`. Concurrent calls that set this race on "
|
|
194
|
+
"the same 'most recent' conversation; prefer `conversation` for reliable resumption."
|
|
195
|
+
),
|
|
196
|
+
},
|
|
197
|
+
"conversation": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"description": (
|
|
200
|
+
"Pass --conversation <ID>: resume a specific past conversation by id. "
|
|
201
|
+
"Mutually exclusive with `continue`."
|
|
202
|
+
),
|
|
203
|
+
},
|
|
204
|
+
"print_timeout": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"description": (
|
|
207
|
+
"Pass --print-timeout: agy's own wait timeout as a Go duration ('5m0s', '300s'). "
|
|
208
|
+
"Keep it shorter than timeout_seconds so agy can exit cleanly before the "
|
|
209
|
+
"wrapper kills it."
|
|
210
|
+
),
|
|
211
|
+
},
|
|
212
|
+
"extra_args": {
|
|
213
|
+
"type": "array",
|
|
214
|
+
"items": {"type": "string"},
|
|
215
|
+
"description": (
|
|
216
|
+
"Raw CLI flags appended verbatim (one token per element). "
|
|
217
|
+
"Use to reach new or uncommon agy flags (e.g. --log-file) without updating this server."
|
|
218
|
+
),
|
|
219
|
+
},
|
|
220
|
+
"env": {
|
|
221
|
+
"type": "object",
|
|
222
|
+
"additionalProperties": {"type": "string"},
|
|
223
|
+
"description": "Extra environment variables for the agy subprocess.",
|
|
224
|
+
},
|
|
225
|
+
"timeout_seconds": {
|
|
226
|
+
"type": "integer",
|
|
227
|
+
"minimum": 30,
|
|
228
|
+
"maximum": 3600,
|
|
229
|
+
"description": "Hard wall-clock timeout for the agy subprocess in seconds (default 660).",
|
|
230
|
+
},
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@server.list_tools()
|
|
235
|
+
async def list_tools() -> list[Tool]:
|
|
236
|
+
return [
|
|
237
|
+
Tool(
|
|
238
|
+
name="consult_agy",
|
|
239
|
+
description=(
|
|
240
|
+
"Run a single agy (Antigravity CLI) invocation in non-interactive print mode. "
|
|
241
|
+
"agy is an agentic coding assistant that autonomously reads files and works inside "
|
|
242
|
+
"`directory` (plus any `add_dir`). Forward-compatible: unknown CLI flags can be "
|
|
243
|
+
"passed via `extra_args`. The agy binary path is configurable via $AGY_CMD."
|
|
244
|
+
),
|
|
245
|
+
inputSchema={
|
|
246
|
+
"type": "object",
|
|
247
|
+
"properties": _TOOL_PROPS,
|
|
248
|
+
"required": ["query", "directory"],
|
|
249
|
+
},
|
|
250
|
+
),
|
|
251
|
+
]
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
@server.call_tool()
|
|
255
|
+
async def call_tool(name: str, arguments: dict[str, Any]) -> list[TextContent]:
|
|
256
|
+
if name != "consult_agy":
|
|
257
|
+
return [TextContent(type="text", text=f"unknown tool: {name}")]
|
|
258
|
+
|
|
259
|
+
args = dict(arguments)
|
|
260
|
+
continue_ = bool(args.get("continue", False))
|
|
261
|
+
conversation = args.get("conversation")
|
|
262
|
+
if continue_ and conversation:
|
|
263
|
+
return [
|
|
264
|
+
TextContent(
|
|
265
|
+
type="text",
|
|
266
|
+
text="[ERROR] `continue` and `conversation` are mutually exclusive; pass only one.",
|
|
267
|
+
)
|
|
268
|
+
]
|
|
269
|
+
|
|
270
|
+
argv = _build_argv(
|
|
271
|
+
query=args["query"],
|
|
272
|
+
add_dir=args.get("add_dir"),
|
|
273
|
+
dangerously_skip_permissions=bool(args.get("dangerously_skip_permissions", False)),
|
|
274
|
+
sandbox=bool(args.get("sandbox", False)),
|
|
275
|
+
continue_=continue_,
|
|
276
|
+
conversation=conversation,
|
|
277
|
+
print_timeout=args.get("print_timeout"),
|
|
278
|
+
extra_args=args.get("extra_args"),
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
result = await _run_agy(
|
|
282
|
+
cwd=args["directory"],
|
|
283
|
+
argv=argv,
|
|
284
|
+
timeout=int(args.get("timeout_seconds") or DEFAULT_TIMEOUT),
|
|
285
|
+
env_overrides=args.get("env"),
|
|
286
|
+
)
|
|
287
|
+
return [TextContent(type="text", text=_format_result(result))]
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
async def _amain() -> None:
|
|
291
|
+
logging.basicConfig(
|
|
292
|
+
level=os.environ.get("ANTIGRAVITY_CLI_MCP_SLIM_LOG_LEVEL", "INFO"),
|
|
293
|
+
format="[antigravity-cli-mcp-slim] %(levelname)s %(message)s",
|
|
294
|
+
)
|
|
295
|
+
async with stdio_server() as (read, write):
|
|
296
|
+
await server.run(read, write, server.create_initialization_options())
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def main() -> None:
|
|
300
|
+
asyncio.run(_amain())
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
if __name__ == "__main__":
|
|
304
|
+
main()
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: antigravity-cli-mcp-slim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A thin, auditable MCP server wrapping the Antigravity CLI (agy). Forward-compatible with future CLI flags via extra_args passthrough.
|
|
5
|
+
Author-email: tksfjt1024 <tksfjt1024@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/tksfjt1024/antigravity-cli-mcp-slim
|
|
8
|
+
Project-URL: Repository, https://github.com/tksfjt1024/antigravity-cli-mcp-slim
|
|
9
|
+
Project-URL: Issues, https://github.com/tksfjt1024/antigravity-cli-mcp-slim/issues
|
|
10
|
+
Keywords: mcp,model-context-protocol,antigravity,antigravity-cli,agy,claude,anthropic,ai,llm,coding-agent
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: mcp>=1.0.0
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "test"
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "test"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# antigravity-cli-mcp-slim
|
|
36
|
+
|
|
37
|
+
A thin, auditable [MCP](https://modelcontextprotocol.io) server wrapping the [Antigravity CLI](https://github.com/google-antigravity/antigravity-cli) (`agy`).
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/antigravity-cli-mcp-slim/)
|
|
40
|
+
[](https://pypi.org/project/antigravity-cli-mcp-slim/)
|
|
41
|
+
[](https://opensource.org/licenses/MIT)
|
|
42
|
+
[](https://github.com/tksfjt1024/antigravity-cli-mcp-slim/actions/workflows/ci.yml)
|
|
43
|
+
|
|
44
|
+
## Why
|
|
45
|
+
|
|
46
|
+
When you add an MCP server to your AI coding tool, every prompt and code snippet
|
|
47
|
+
you send flows through that wrapper. Most CLI-wrapping MCP servers are small,
|
|
48
|
+
individually maintained packages — and recent supply-chain incidents
|
|
49
|
+
(`xz-utils`, `postmark-mcp`, the npm `chalk`/`debug` compromise) show that
|
|
50
|
+
"small and useful" is not the same as "safe to trust blindly."
|
|
51
|
+
|
|
52
|
+
This project takes the opposite stance: instead of asking you to trust it, it
|
|
53
|
+
tries to be **easy to audit**.
|
|
54
|
+
|
|
55
|
+
- **Single file** — the whole server is `src/antigravity_cli_mcp_slim/server.py`,
|
|
56
|
+
readable end-to-end in one sitting
|
|
57
|
+
- **One third-party dependency** (`mcp`) — minimal supply-chain surface
|
|
58
|
+
- **Faithful CLI mapping** — every typed parameter mirrors a real `agy` flag by
|
|
59
|
+
name, so it is obvious which flags an invocation actually sets
|
|
60
|
+
- **Forward-compatible** — any new or uncommon `agy` flag is reachable via
|
|
61
|
+
`extra_args` without touching this server
|
|
62
|
+
- **Configurable binary path** — `$AGY_CMD` lets you swap or wrap the `agy` binary
|
|
63
|
+
- **Transparent** — every invocation logs the exact argv to stderr
|
|
64
|
+
|
|
65
|
+
Read `server.py` before you install. That is the point.
|
|
66
|
+
|
|
67
|
+
## Prerequisites
|
|
68
|
+
|
|
69
|
+
- The `agy` CLI installed and on `$PATH` (or pointed to via `$AGY_CMD`). See the
|
|
70
|
+
[official Antigravity CLI repository](https://github.com/google-antigravity/antigravity-cli)
|
|
71
|
+
and [install docs](https://antigravity.google/docs/cli-overview).
|
|
72
|
+
- `agy` already **authenticated** — this wrapper does not manage login; it
|
|
73
|
+
surfaces `agy`'s own error output if the CLI is not ready.
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Run directly without installing
|
|
79
|
+
uvx antigravity-cli-mcp-slim
|
|
80
|
+
|
|
81
|
+
# Install from PyPI
|
|
82
|
+
pip install antigravity-cli-mcp-slim
|
|
83
|
+
|
|
84
|
+
# Run from GitHub HEAD
|
|
85
|
+
uvx --from git+https://github.com/tksfjt1024/antigravity-cli-mcp-slim antigravity-cli-mcp-slim
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Usage as an MCP server
|
|
89
|
+
|
|
90
|
+
### Claude Code
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
claude mcp add antigravity-cli uvx antigravity-cli-mcp-slim
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Or manually in `~/.claude.json`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"antigravity-cli": {
|
|
102
|
+
"type": "stdio",
|
|
103
|
+
"command": "uvx",
|
|
104
|
+
"args": ["antigravity-cli-mcp-slim"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If `agy` is not on the launching process's `$PATH`, point `$AGY_CMD` at it:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"antigravity-cli": {
|
|
116
|
+
"type": "stdio",
|
|
117
|
+
"command": "uvx",
|
|
118
|
+
"args": ["antigravity-cli-mcp-slim"],
|
|
119
|
+
"env": { "AGY_CMD": "/absolute/path/to/agy" }
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Other MCP clients
|
|
126
|
+
|
|
127
|
+
Any MCP-compatible client can launch the server via stdio:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
uvx antigravity-cli-mcp-slim
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Tool: `consult_agy`
|
|
134
|
+
|
|
135
|
+
Runs a single `agy` invocation in non-interactive print mode (`agy --print`).
|
|
136
|
+
`agy` is an agentic assistant: it autonomously reads files in `directory`
|
|
137
|
+
(and any `add_dir`) to fulfill the request, then prints the response.
|
|
138
|
+
|
|
139
|
+
| Parameter | Type | Description |
|
|
140
|
+
| ------------------------------- | -------- | --------------------------------------------------------------------------------------------- |
|
|
141
|
+
| `query` (required) | string | Prompt sent verbatim to `agy --print` |
|
|
142
|
+
| `directory` (required) | string | Working directory (`agy` cwd); the default workspace root |
|
|
143
|
+
| `add_dir` | string[] | Extra workspace directories; each maps to one `--add-dir` (repeatable, not comma-joined) |
|
|
144
|
+
| `dangerously_skip_permissions` | bool | Pass `--dangerously-skip-permissions` (auto-approve all tool requests). See warning below |
|
|
145
|
+
| `sandbox` | bool | Pass `--sandbox` (terminal restrictions enabled) |
|
|
146
|
+
| `continue` | bool | Pass `--continue` (resume the most recent conversation). Mutually exclusive with `conversation` |
|
|
147
|
+
| `conversation` | string | Pass `--conversation <ID>` (resume a specific conversation). Mutually exclusive with `continue` |
|
|
148
|
+
| `print_timeout` | string | Pass `--print-timeout` (Go duration, e.g. `5m0s`). Keep shorter than `timeout_seconds` |
|
|
149
|
+
| `extra_args` | string[] | Raw CLI flags appended verbatim. Use for new/uncommon `agy` flags |
|
|
150
|
+
| `env` | object | Extra environment variables for the `agy` subprocess |
|
|
151
|
+
| `timeout_seconds` | int | Hard wall-clock timeout for the subprocess (default 660) |
|
|
152
|
+
|
|
153
|
+
### Security note: `dangerously_skip_permissions`
|
|
154
|
+
|
|
155
|
+
`dangerously_skip_permissions: true` passes `--dangerously-skip-permissions`,
|
|
156
|
+
which auto-approves **all** of `agy`'s tool permission requests — including
|
|
157
|
+
running shell commands and editing files — with no prompt. The parameter keeps
|
|
158
|
+
the `dangerously_` prefix on purpose: enable it only in a trusted, isolated
|
|
159
|
+
workspace where you fully trust the prompt. It defaults to `false`.
|
|
160
|
+
|
|
161
|
+
## Cross-repository analysis example
|
|
162
|
+
|
|
163
|
+
Analyze multiple repositories from a single invocation by adding directories to
|
|
164
|
+
the workspace:
|
|
165
|
+
|
|
166
|
+
```jsonc
|
|
167
|
+
{
|
|
168
|
+
"name": "consult_agy",
|
|
169
|
+
"arguments": {
|
|
170
|
+
"query": "Compare the API surface of the main service with the clients that call it",
|
|
171
|
+
"directory": "/path/to/main-service",
|
|
172
|
+
"add_dir": [
|
|
173
|
+
"/path/to/client-a",
|
|
174
|
+
"/path/to/client-b"
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
This launches `agy --print "..." --add-dir /path/to/client-a --add-dir /path/to/client-b`,
|
|
181
|
+
giving the agent read access to all three workspaces in one session.
|
|
182
|
+
|
|
183
|
+
## Conversation continuity
|
|
184
|
+
|
|
185
|
+
`agy` can resume prior conversations. This wrapper exposes that directly and
|
|
186
|
+
stays stateless itself:
|
|
187
|
+
|
|
188
|
+
- `continue: true` resumes the most recent conversation. Because "most recent"
|
|
189
|
+
is shared state, concurrent calls can race on it — prefer `conversation` when
|
|
190
|
+
it matters.
|
|
191
|
+
- `conversation: "<ID>"` resumes a specific conversation by id.
|
|
192
|
+
|
|
193
|
+
The two are mutually exclusive; passing both returns an error.
|
|
194
|
+
|
|
195
|
+
## Timeout configuration
|
|
196
|
+
|
|
197
|
+
There are two independent timeouts:
|
|
198
|
+
|
|
199
|
+
- `print_timeout` — `agy`'s own wait timeout (Go duration; `agy` defaults to
|
|
200
|
+
about 5 minutes).
|
|
201
|
+
- `timeout_seconds` — this wrapper's hard wall-clock limit (default 660).
|
|
202
|
+
|
|
203
|
+
Keep `timeout_seconds` longer than `print_timeout` so `agy` can finish or time
|
|
204
|
+
out cleanly before the wrapper force-kills the subprocess. When you raise
|
|
205
|
+
`print_timeout` for a long task, raise `timeout_seconds` to match.
|
|
206
|
+
|
|
207
|
+
## Forward-compatibility example
|
|
208
|
+
|
|
209
|
+
If a future `agy` release adds a new flag (say `--super-mode`), use it
|
|
210
|
+
immediately without updating this server:
|
|
211
|
+
|
|
212
|
+
```jsonc
|
|
213
|
+
{
|
|
214
|
+
"name": "consult_agy",
|
|
215
|
+
"arguments": {
|
|
216
|
+
"query": "...",
|
|
217
|
+
"directory": "...",
|
|
218
|
+
"extra_args": ["--super-mode"]
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Configuration
|
|
224
|
+
|
|
225
|
+
| Environment variable | Default | Purpose |
|
|
226
|
+
| ------------------------------------- | ------- | ---------------------------------------- |
|
|
227
|
+
| `AGY_CMD` | `agy` | Path to the `agy` CLI binary |
|
|
228
|
+
| `ANTIGRAVITY_CLI_MCP_SLIM_TIMEOUT` | `660` | Default subprocess timeout in seconds |
|
|
229
|
+
| `ANTIGRAVITY_CLI_MCP_SLIM_LOG_LEVEL` | `INFO` | Logging level for stderr diagnostics |
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Install dev dependencies
|
|
235
|
+
pip install -e ".[test,dev]"
|
|
236
|
+
|
|
237
|
+
# Lint
|
|
238
|
+
ruff check .
|
|
239
|
+
|
|
240
|
+
# Test
|
|
241
|
+
pytest
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
[MIT](./LICENSE) © tksfjt1024
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
antigravity_cli_mcp_slim/__init__.py,sha256=ML8GJQx2GBP-rqYlBjnRx2Sbv7QEh-mGAepeMW0gg5A,266
|
|
2
|
+
antigravity_cli_mcp_slim/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
antigravity_cli_mcp_slim/server.py,sha256=vI0BqAIbc6oTFrBnFJw6VqvL2TzXZqVFfErZ8sln3gs,10440
|
|
4
|
+
antigravity_cli_mcp_slim-0.1.0.dist-info/licenses/LICENSE,sha256=Tr5DgZN5ASK_iNxUlQLjINkMg2zUJZuSh3JEStppNV4,1067
|
|
5
|
+
antigravity_cli_mcp_slim-0.1.0.dist-info/METADATA,sha256=6AGP4G9Ahkg8y1mT8MTW6mXRPInxCb_wtFM7U6YZq5o,9807
|
|
6
|
+
antigravity_cli_mcp_slim-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
7
|
+
antigravity_cli_mcp_slim-0.1.0.dist-info/entry_points.txt,sha256=7_qndqWNwux67p-Yev3EdBztJJzbPGerBCsOdEgIuoA,82
|
|
8
|
+
antigravity_cli_mcp_slim-0.1.0.dist-info/top_level.txt,sha256=Q5Vjc4LcQk5jdzaX-lw4qFcewI_t2OLiQA2tnZIL4NI,25
|
|
9
|
+
antigravity_cli_mcp_slim-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 tksfjt1024
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
antigravity_cli_mcp_slim
|