agy-delegate-mcp 1.0.0 → 1.2.0

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,35 @@ All notable changes to this project are documented here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.2.0] - 2026-11-22
10
+
11
+ ### Added
12
+
13
+ - `resultSource: "unfinished-tool"`: a turn that ends with a tool call still running returns agy's
14
+ message from while it ran, and `protocolWarnings` names the tool. agy ends a turn this way when
15
+ it moves a shell command to the background after the wait it set for it (`WaitMsBeforeAsync`),
16
+ which stops with agy when the delegation returns, and when it asks a question through
17
+ `ask_question`, which a resume answers. The result was empty, with a warning that agy sent no
18
+ message.
19
+
20
+ ### Fixed
21
+
22
+ - agy starts in the workspace. Started in the MCP server's directory, it listed that directory and
23
+ ran `git status` and `git diff` there during a delegation to another workspace.
24
+ - A missing agy on Windows is reported as `spawn-failed` with the install hint, and `doctor`
25
+ reports `found: false`. Launched through cmd.exe it read as `agent-exit` quoting cmd's
26
+ "is not recognized" line, and `doctor` reported `found: true`.
27
+ - `cancel` with `force` returns as soon as the turn settles, in about 60 ms, instead of waiting out
28
+ its 5 s grace.
29
+
30
+ ## [1.1.0] - 2026-11-22
31
+
32
+ ### Changed
33
+
34
+ - The README lists install steps for Cursor (one-click deeplink), VS Code (one-click install),
35
+ JetBrains AI Assistant, Devin Desktop, Visual Studio, OpenCode, Kilo Code and Kiro, and shows
36
+ npm, MCP Registry, Glama, Node and test badges.
37
+
9
38
  ## [1.0.0] - 2026-11-21
10
39
 
11
40
  First public release.
package/README.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  Delegate edits to Google Antigravity's CLI agent (`agy`) — your agent writes the brief and reviews the diff.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/agy-delegate-mcp)](https://www.npmjs.com/package/agy-delegate-mcp)
6
+ [![npm downloads](https://img.shields.io/npm/dt/agy-delegate-mcp)](https://www.npmjs.com/package/agy-delegate-mcp)
7
+ [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-listed-blue)](https://registry.modelcontextprotocol.io/v0.1/servers?search=agy-delegate&version=latest)
8
+ [![agy-delegate-mcp MCP server](https://glama.ai/mcp/servers/andreilungeanu/agy-delegate-mcp/badges/score.svg)](https://glama.ai/mcp/servers/andreilungeanu/agy-delegate-mcp)
9
+ [![node](https://img.shields.io/node/v/agy-delegate-mcp)](https://nodejs.org)
5
10
  [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
11
+ [![tests](https://github.com/andreilungeanu/agy-delegate-mcp/actions/workflows/test.yml/badge.svg)](https://github.com/andreilungeanu/agy-delegate-mcp/actions/workflows/test.yml)
6
12
 
7
13
  <img src="assets/logo-light.png" alt="Antigravity Delegate logo" width="150" align="left" hspace="15">
8
14
 
@@ -40,6 +46,23 @@ Then ask:
40
46
 
41
47
  > Delegate to Antigravity: migrate src/api from callbacks to async/await and update the tests, then walk me through what changed.
42
48
 
49
+ ### Cursor
50
+
51
+ [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=agy-delegate&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImFneS1kZWxlZ2F0ZS1tY3AiXX0%3D)
52
+
53
+ Or add it under **Customize → MCPs** in the sidebar, or in `~/.cursor/mcp.json` (every project) or `.cursor/mcp.json` (this project):
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "agy-delegate": {
59
+ "command": "npx",
60
+ "args": ["-y", "agy-delegate-mcp"]
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
43
66
  ### ChatGPT desktop / Codex
44
67
 
45
68
  ```shell
@@ -54,7 +77,52 @@ copilot plugin marketplace add andreilungeanu/agy-delegate-mcp
54
77
  copilot plugin install agy-delegate@agy-delegate-mcp
55
78
  ```
56
79
 
57
- ### Any other MCP client
80
+ The server alone, without the skill: `copilot mcp add agy-delegate -- npx -y agy-delegate-mcp`.
81
+
82
+ ### More clients
83
+
84
+ <details>
85
+ <summary><strong>VS Code</strong> — one-click install, or <code>.vscode/mcp.json</code></summary>
86
+
87
+ [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_server-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=agy-delegate&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22agy-delegate-mcp%22%5D%7D)
88
+ [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_server-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=agy-delegate&config=%7B%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22agy-delegate-mcp%22%5D%7D&quality=insiders)
89
+
90
+ ```json
91
+ {
92
+ "servers": {
93
+ "agy-delegate": {
94
+ "type": "stdio",
95
+ "command": "npx",
96
+ "args": ["-y", "agy-delegate-mcp"]
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
102
+ </details>
103
+
104
+ <details>
105
+ <summary><strong>JetBrains AI Assistant</strong> — Settings → Tools → AI Assistant → MCP</summary>
106
+
107
+ Under **Settings → Tools → AI Assistant → Model Context Protocol (MCP)**, click **Add** and paste this JSON:
108
+
109
+ ```json
110
+ {
111
+ "mcpServers": {
112
+ "agy-delegate": {
113
+ "command": "npx",
114
+ "args": ["-y", "agy-delegate-mcp"]
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ </details>
121
+
122
+ <details>
123
+ <summary><strong>Devin Desktop (formerly Windsurf)</strong> — <code>~/.config/devin/mcp_config.json</code></summary>
124
+
125
+ This config is for Devin Local, the default agent (Local 3.6+). On Windows the file is `%APPDATA%\devin\mcp_config.json`. Legacy Cascade and older Windsurf builds read `~/.codeium/windsurf/mcp_config.json`.
58
126
 
59
127
  ```json
60
128
  {
@@ -67,10 +135,89 @@ copilot plugin install agy-delegate@agy-delegate-mcp
67
135
  }
68
136
  ```
69
137
 
70
- VS Code uses `servers` with `"type": "stdio"` in `.vscode/mcp.json`; OpenCode and Kilo Code use `mcp` with `"type": "local"` and `command` as one array.
138
+ Heads-up: Devin Desktop's Cascade agent caps you at 100 tools across all servers.
139
+
140
+ </details>
141
+
142
+ <details>
143
+ <summary><strong>Visual Studio 2026 / 2022</strong> — <code>%USERPROFILE%\.mcp.json</code></summary>
144
+
145
+ ```json
146
+ {
147
+ "servers": {
148
+ "agy-delegate": {
149
+ "type": "stdio",
150
+ "command": "npx",
151
+ "args": ["-y", "agy-delegate-mcp"]
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
157
+ Visual Studio 2022 needs 17.14+. Note the top-level key is `servers`, not `mcpServers`. A `.mcp.json` in the solution directory scopes it to that solution.
158
+
159
+ </details>
160
+
161
+ <details>
162
+ <summary><strong>OpenCode</strong> — <code>~/.config/opencode/opencode.json</code> or project <code>opencode.json</code></summary>
163
+
164
+ OpenCode does **not** use `mcpServers`. Local servers go under `mcp`, with `type: "local"` and `command` as one array:
165
+
166
+ ```json
167
+ {
168
+ "$schema": "https://opencode.ai/config.json",
169
+ "mcp": {
170
+ "agy-delegate": {
171
+ "type": "local",
172
+ "command": ["npx", "-y", "agy-delegate-mcp"],
173
+ "enabled": true
174
+ }
175
+ }
176
+ }
177
+ ```
178
+
179
+ This is the v1 shape, which OpenCode v2 still reads (v2's native form is `mcp.servers`).
180
+
181
+ </details>
182
+
183
+ <details>
184
+ <summary><strong>Kilo Code</strong> — <code>kilo.jsonc</code> (<code>mcp</code> key, not <code>mcpServers</code>)</summary>
185
+
186
+ Same shape as OpenCode: `type: "local"` and `command` as one array.
187
+
188
+ ```json
189
+ {
190
+ "mcp": {
191
+ "agy-delegate": {
192
+ "type": "local",
193
+ "command": ["npx", "-y", "agy-delegate-mcp"],
194
+ "enabled": true
195
+ }
196
+ }
197
+ }
198
+ ```
199
+
200
+ In the VS Code extension: **Settings → MCP → Add Server → Local (stdio)**. On Windows, if `npx` is not found, use command `cmd` with arguments `/c`, `npx`, `-y`, `agy-delegate-mcp`.
201
+
202
+ </details>
203
+
204
+ ### Kiro and any other MCP client
205
+
206
+ Add the following server to the client's MCP config — for Kiro, `~/.kiro/settings/mcp.json` (user) or `.kiro/settings/mcp.json` (workspace):
207
+
208
+ ```json
209
+ {
210
+ "mcpServers": {
211
+ "agy-delegate": {
212
+ "command": "npx",
213
+ "args": ["-y", "agy-delegate-mcp"]
214
+ }
215
+ }
216
+ }
217
+ ```
71
218
 
72
219
  ## License
73
220
 
74
221
  MIT © [Andrei Lungeanu](https://github.com/andreilungeanu)
75
222
 
76
- <sub>[Technical reference](TECHNICAL.md) · [Security](SECURITY.md) · [Privacy](PRIVACY.md) · [Terms](TERMS.md)</sub>
223
+ <sub>[Technical reference](TECHNICAL.md) · [Security](SECURITY.md) · [Privacy](PRIVACY.md) · [Terms](TERMS.md) · [Changelog](CHANGELOG.md)</sub>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agy-delegate-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "mcpName": "io.github.andreilungeanu/agy-delegate-mcp",
5
5
  "type": "module",
6
6
  "description": "Delegate multi-file coding work from Claude Code, Codex, Copilot, or any MCP client to Google's Antigravity CLI (agy) — structured results, plan mode, and changed files.",
package/src/acp-client.js CHANGED
@@ -3,7 +3,7 @@ import { EventEmitter } from "node:events";
3
3
  import { StringDecoder } from "node:string_decoder";
4
4
  import { JsonRpcPeer } from "./jsonrpc.js";
5
5
  import { createRequestRouter } from "./request-router.js";
6
- import { resolveAcpSpawn } from "./spawn.js";
6
+ import { commandExists, resolveAcpSpawn } from "./spawn.js";
7
7
  import { DETACHED, isChildAlive, treeKill } from "./proc.js";
8
8
  import { VERSION } from "./version.js";
9
9
  import { makeError } from "./errors.js";
@@ -19,9 +19,14 @@ export class AcpClient extends EventEmitter {
19
19
  * spawnSpec?: { command: string, args: string[], options?: object },
20
20
  * }} [opts]
21
21
  */
22
- constructor({ spawnSpec } = {}) {
22
+ /** @param {{ spawnSpec?: any, cwd?: string }} [opts] */
23
+ constructor({ spawnSpec, cwd } = {}) {
23
24
  super();
24
25
  this.spawnSpec = spawnSpec || resolveAcpSpawn();
26
+ // agy treats its process directory as part of the workspace, not only the session's cwd:
27
+ // started from the MCP server's directory it listed that directory and ran git status and
28
+ // git diff there (measured, agy 1.5.14). Started in the workspace, there is nothing else to see.
29
+ this.cwd = cwd;
25
30
  this._stderrChunks = [];
26
31
  this._stderrLength = 0;
27
32
  /** @type {Promise<boolean> | null} */
@@ -41,11 +46,14 @@ export class AcpClient extends EventEmitter {
41
46
 
42
47
  start() {
43
48
  const { command, args, options } = this.spawnSpec;
49
+ if (/** @type {{ shell?: boolean }} */ (options)?.shell && !commandExists(command)) {
50
+ return Promise.reject(makeError("spawn-failed", `Failed to spawn agent (${command}): not found on PATH. Install the Antigravity CLI (agy) and sign in by running agy once.`));
51
+ }
44
52
  this._stderrChunks = [];
45
53
  this._stderrLength = 0;
46
54
  const stderrDecoder = new StringDecoder("utf8");
47
55
  this._exitEmitted = false;
48
- this.child = spawn(command, args, { ...options, detached: DETACHED, stdio: ["pipe", "pipe", "pipe"] });
56
+ this.child = spawn(command, args, { ...options, ...(this.cwd ? { cwd: this.cwd } : {}), detached: DETACHED, stdio: ["pipe", "pipe", "pipe"] });
49
57
  this.child.stderr.on("data", (chunk) => {
50
58
  const text = stderrDecoder.write(chunk);
51
59
  if (text) {
package/src/delegate.js CHANGED
@@ -271,7 +271,7 @@ export async function runDelegate({
271
271
  const state = makeTurnState({ onProgress, progressThrottleMs });
272
272
 
273
273
  const make = clientFactory || ((opts) => new AcpClient(opts));
274
- const client = make({});
274
+ const client = make({ cwd: workspace });
275
275
  // Handed over before the spawn, because from client.start() there is an agent process and the
276
276
  // caller needs something that can stop it.
277
277
  onClientReady?.(client);
@@ -362,6 +362,7 @@ export async function runDelegate({
362
362
  if (up.sessionUpdate === "agent_message_chunk" && up.content?.text) {
363
363
  const text = up.content.text;
364
364
  if (state.collectingResult()) state.appendResult(text);
365
+ else if (state.activeToolCalls.size > 0) state.unfinishedToolText += text;
365
366
  state.messages.push(text);
366
367
  }
367
368
  });
@@ -421,7 +422,21 @@ export async function runDelegate({
421
422
  ? (state.sawToolCall ? "post-tool" : "tool-free-stream")
422
423
  : "none";
423
424
  const protocolWarnings = [];
424
- if (!finalMessageAvailable && state.discardedResult) {
425
+ if (!finalMessageAvailable && state.activeToolCalls.size > 0) {
426
+ // agy ends a turn with a call unfinished in two measured cases (agy 1.5.14): it moves a
427
+ // shell command to the background once it outlasts the call's WaitMsBeforeAsync, a wait agy
428
+ // picks per command, or it waits on ask_question.
429
+ // The bridge stops agy when the delegation returns, so a backgrounded command stops with it.
430
+ result = state.unfinishedToolText;
431
+ resultSource = result ? "unfinished-tool" : "none";
432
+ protocolWarnings.push(
433
+ `the turn ended with a tool call still running (${state.lastToolLabel ?? "unnamed tool"}).`
434
+ + " agy does this when it moves a shell command to the background after the wait it set for it (WaitMsBeforeAsync) —"
435
+ + " the command stops when the bridge stops agy — and when it asks a question (ask_question),"
436
+ + " which a resume answers."
437
+ + (result ? " result is agy's message from while it ran." : " agy sent no message while it ran.")
438
+ );
439
+ } else if (!finalMessageAvailable && state.discardedResult) {
425
440
  result = state.discardedResult;
426
441
  resultSource = "pre-tool-fallback";
427
442
  protocolWarnings.push(
package/src/doctor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import process from "node:process";
2
2
  import { spawn } from "node:child_process";
3
3
  import { AcpClient } from "./acp-client.js";
4
- import { resolveAcpSpawn } from "./spawn.js";
4
+ import { commandExists, resolveAcpSpawn } from "./spawn.js";
5
5
  import { DETACHED, treeKill } from "./proc.js";
6
6
  import { readPackageVersion } from "./version.js";
7
7
  import { allowedValues, describeOptions } from "./model-options.js";
@@ -40,6 +40,8 @@ export function probeAgentVersion(spawnSpec, timeoutMs = VERSION_PROBE_TIMEOUT_M
40
40
  const isJsScript = isJsLauncher(launcher);
41
41
  const execCommand = isJsScript ? process.execPath : command;
42
42
  const execArgs = isJsScript ? [launcher, "--version"] : ["--version"];
43
+ // Through a shell, a missing launcher still spawns (the shell does) and would read as found.
44
+ if (options?.shell && !isJsScript && !commandExists(launcher)) return Promise.resolve({ found: false, version: null });
43
45
  return new Promise((resolve) => {
44
46
  let settled = false;
45
47
  let stdout = "";
@@ -83,8 +85,8 @@ export function probeAgentVersion(spawnSpec, timeoutMs = VERSION_PROBE_TIMEOUT_M
83
85
  }
84
86
 
85
87
  async function runDeepHandshake({ spawnSpec, clientFactory, workspace, timeoutMs }) {
86
- const client = clientFactory({ spawnSpec });
87
88
  const workspaceDir = workspace || process.cwd();
89
+ const client = clientFactory({ spawnSpec, cwd: workspaceDir });
88
90
  let timer;
89
91
  try {
90
92
  const details = {};
package/src/server.js CHANGED
@@ -76,7 +76,7 @@ export const SERVER_INSTRUCTIONS = `Delegate coding work to Antigravity (agy) th
76
76
  // its tool description.
77
77
  export const delegateOutputShape = {
78
78
  result: z.string(),
79
- resultSource: z.enum(["pre-tool-fallback", "none"]).optional(),
79
+ resultSource: z.enum(["pre-tool-fallback", "unfinished-tool", "none"]).optional(),
80
80
  effectiveModel: z.string().optional(),
81
81
  effectiveEffort: z.record(z.string(), z.string()).optional(),
82
82
  stopReason: z.string().optional(),
@@ -305,7 +305,12 @@ export function buildServer({ runDelegate: runDelegateInjected, runDoctor: runDo
305
305
  // finally removes its handle when the turn actually settles.
306
306
  return cancelResult("cancelled", sessionId);
307
307
  }
308
- await new Promise((r) => setTimeout(r, forceGraceMs));
308
+ // Watched rather than slept through: agy stops a cancelled turn in milliseconds, and the
309
+ // delegation's finally drops its handle the moment the turn settles.
310
+ const graceEnds = Date.now() + forceGraceMs;
311
+ while (Date.now() < graceEnds && inFlight.get(sessionId)?.size) {
312
+ await new Promise((r) => setTimeout(r, Math.min(50, Math.max(1, graceEnds - Date.now()))));
313
+ }
309
314
  const stillRunning = inFlight.get(sessionId);
310
315
  if (!stillRunning || stillRunning.size === 0) return cancelResult("cancelled", sessionId);
311
316
  // Snapshot before awaiting stop. A resume that registers during teardown must not be
package/src/spawn.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import process from "node:process";
2
+ import { existsSync, statSync } from "node:fs";
3
+ import path from "node:path";
2
4
 
3
5
  export function splitArgs(raw) {
4
6
  const args = [];
@@ -27,3 +29,21 @@ export function resolveAcpSpawn() {
27
29
  : [...DEFAULT_AGENT_ARGS];
28
30
  return { command, args, options: { shell: process.platform === "win32" } };
29
31
  }
32
+
33
+ // Through a shell the spawn itself always succeeds: cmd.exe starts, fails to find the launcher and
34
+ // exits 1 with a localized "is not recognized" line, so Node's spawn 'error' event never fires and
35
+ // a missing agy reads as an agent crash. Resolving the launcher first is what lets that case be
36
+ // reported as not installed. Mirrors cmd's lookup: a path is checked as given, a bare name against
37
+ // each PATH entry, both with and without each PATHEXT extension.
38
+ export function commandExists(command, env = process.env) {
39
+ const name = String(command || "").replace(/^["']|["']$/g, "");
40
+ if (!name) return false;
41
+ const pathKey = Object.keys(env).find((k) => k.toUpperCase() === "PATH");
42
+ const extKey = Object.keys(env).find((k) => k.toUpperCase() === "PATHEXT");
43
+ const exts = ["", ...String((extKey && env[extKey]) || ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean)];
44
+ const isFile = (p) => { try { return existsSync(p) && statSync(p).isFile(); } catch { return false; } };
45
+ const hit = (base) => exts.some((ext) => isFile(base + ext) || isFile(base + ext.toLowerCase()));
46
+ if (/[\\/]/.test(name)) return hit(name);
47
+ const dirs = String((pathKey && env[pathKey]) || "").split(path.delimiter).filter(Boolean);
48
+ return dirs.some((dir) => hit(path.join(dir.replace(/^"|"$/g, ""), name)));
49
+ }
package/src/turn-state.js CHANGED
@@ -52,6 +52,10 @@ function freshFields() {
52
52
  // caller "" with stopReason end_turn and no error. Kept so it can be handed back when
53
53
  // nothing survived — labelled, never blended with a real final message.
54
54
  discardedResult: "",
55
+ // Message text sent while a tool call was still running, since that call started. Not part of
56
+ // the result: it is handed back only when the turn ends with the call still unfinished, which
57
+ // is how agy reports moving a long shell command to the background.
58
+ unfinishedToolText: "",
55
59
  sawToolCall: false,
56
60
  collectingPostToolResult: false,
57
61
  activeToolCalls: new Set(),
@@ -100,6 +104,7 @@ export function makeTurnState({ onProgress, progressThrottleMs = 2000 } = {}) {
100
104
  },
101
105
 
102
106
  startTool(toolCallId, status) {
107
+ state.unfinishedToolText = "";
103
108
  state.sawToolCall = true;
104
109
  state.collectingPostToolResult = false;
105
110
  state.resetResult();