agy-mcp-bridge 0.1.36 → 0.1.38
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/README.md +4 -2
- package/dist/src/agents/antigravity.js +1 -1
- package/dist/src/antigravity/process.js +11 -4
- package/dist/src/runtime.js +1 -1
- package/docs/HARDENING.md +2 -2
- package/docs/VERIFICATION.md +26 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
[](https://m8ven.ai/mcp/thanhdo257205-mcp-bridge-1d8jgl?s=readme)
|
|
2
|
+
|
|
1
3
|
# agy-mcp-bridge.
|
|
2
4
|
|
|
3
5
|
**An MCP server that hands bounded coding tasks to the CLI agents already logged in on your machine.** One TypeScript process speaks MCP Streamable HTTP on `127.0.0.1` and drives `agy` (Antigravity) and/or `codex`. Every task declares its workspace, acceptance criteria, which agent runs it, how isolated it is, and how much it may self-approve. The orchestrating agent (Codex, Claude Code, any MCP client) keeps the review; the bridge does the reading, writing and waiting.
|
|
4
6
|
|
|
5
7
|
> **There is no authentication, on purpose.** The bridge binds `127.0.0.1` only, but any process running as your user on this machine can call its tools, read and cancel tasks, and shut it down. Do not expose the port, do not put it behind a public reverse proxy, do not run it where you do not control local processes. [Security model](#security-model).
|
|
6
8
|
|
|
7
|
-
Package `agy-mcp-bridge` on npm · requires Node.js ≥ 20 · Git · a logged-in `agy` 1.
|
|
9
|
+
Package `agy-mcp-bridge` on npm · requires Node.js ≥ 20 · Git · a logged-in `agy` 1.x and/or Codex CLI.
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -18,7 +20,7 @@ Fastest first run: from inside the project you want to work on, `agy-mcp-bridge
|
|
|
18
20
|
|
|
19
21
|
`agy-mcp-bridge check | setup codex|claude|freebuff|both | delegation on|off|status | skill install | config | update | help`. `--open` launches the web UI in your browser. Config and task history live in the user data directory (`%APPDATA%\agy-mcp-bridge`, `~/.config/agy-mcp-bridge`, `~/Library/Application Support/agy-mcp-bridge`; override with `BRIDGE_HOME`), so an upgrade never deletes them. `agy-mcp-bridge config` prints the real paths.
|
|
20
22
|
|
|
21
|
-
At startup the bridge probes each CLI. An agent that is missing or unsupported is marked unavailable and takes no task; if `agy` is unavailable, the default agent silently becomes the next enabled one, so check `agents_list` after changing machines. Priority and per-agent switches live under `agents` in `config/workspaces.json`.
|
|
23
|
+
At startup the bridge probes each CLI. An agent that is missing or unsupported is marked unavailable and takes no task; if `agy` is unavailable, the default agent silently becomes the next enabled one, so check `agents_list` after changing machines. Priority and per-agent switches live under `agents` in `config/workspaces.json`. The `agy` gate is the 1.x line plus the flags the bridge actually passes, read from the CLI's own help — `agy` updates itself, so pinning one minor would stop delegation on a machine whose CLI is fine. Real agent execution verified on 1.4.3, 1.4.7, 1.4.8, 1.4.9, 1.5.1 and 1.5.2; any other 1.x release runs with a logged warning; a release missing a required flag, or a different major, is refused.
|
|
22
24
|
|
|
23
25
|
From a git clone instead of npm: `npm ci && npm run build && npm start`, then `npm run check` in a second terminal. `npm run dev` builds and runs; there is no hot reload, because an automatic restart would cut off a task mid-edit.
|
|
24
26
|
|
|
@@ -61,7 +61,7 @@ export function legacyAntigravityAgent(runtime, transport) {
|
|
|
61
61
|
const status = {
|
|
62
62
|
id: 'antigravity', label: 'Antigravity', available: runtime.supported,
|
|
63
63
|
version: null, executable: runtime.executable || null, capabilities: CAPABILITIES,
|
|
64
|
-
warnings: runtime.supported ? [] : ['Requires agy 1.
|
|
64
|
+
warnings: runtime.supported ? [] : ['Requires agy 1.x and all required print/output/timeout flags']
|
|
65
65
|
};
|
|
66
66
|
return { adapter: antigravityAdapter(runtime.executable, transport), status, enabled: true, prefixArgs: runtime.prefixArgs, launch: runtime.launch };
|
|
67
67
|
}
|
|
@@ -2,8 +2,12 @@ import { spawn } from 'node:child_process';
|
|
|
2
2
|
import { access, readFile, realpath } from 'node:fs/promises';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { inside } from '../security/workspace.js';
|
|
5
|
-
/**
|
|
6
|
-
export const VERIFIED_AGY_VERSIONS = ['1.4.3', '1.4.7', '1.4.8', '1.4.9'];
|
|
5
|
+
/** Releases exercised with a real agent run; any other release of the 1.x line still runs, with a warning. */
|
|
6
|
+
export const VERIFIED_AGY_VERSIONS = ['1.4.3', '1.4.7', '1.4.8', '1.4.9', '1.5.1', '1.5.2'];
|
|
7
|
+
/** The version family the bridge accepts. Exported because the live verifier has to ask the same question of the CLI it is about to spend real tasks on. */
|
|
8
|
+
export function isSupportedAgyVersion(version) {
|
|
9
|
+
return /^1\.\d+\.\d+$/.test(version);
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* Resolve a command without ever going through a shell. On Windows an npm-installed CLI is usually a `.cmd`
|
|
9
13
|
* shim; spawning it with shell:false fails, and spawning it through cmd.exe would allow argument injection.
|
|
@@ -166,10 +170,13 @@ export async function inspectCli(command, cwd, run = startProcess, requireStdin
|
|
|
166
170
|
const version = await capture(['--version']);
|
|
167
171
|
const help = await capture(['--help']);
|
|
168
172
|
const actual = version.text.trim();
|
|
169
|
-
|
|
173
|
+
// The family is the agy 1.x line, not one minor of it: agy updates itself, and a minor bump it ships would otherwise
|
|
174
|
+
// mark the agent unavailable and stop every delegation on a machine that is otherwise fine. What has to hold is the
|
|
175
|
+
// flags this bridge passes, checked against the CLI's own help, so a release that drops one is still refused.
|
|
176
|
+
const supported = version.code === 0 && isSupportedAgyVersion(actual) && help.code === 0 &&
|
|
170
177
|
['--print', '--output-format', '--print-timeout', '--disable-slash-commands', ...(requireStdin ? ['--input-format'] : [])].every(flag => new RegExp(`(?:^|\\s)${flag}(?=\\s|$)`).test(help.text));
|
|
171
178
|
const verified = VERIFIED_AGY_VERSIONS.includes(actual);
|
|
172
|
-
const warnings = supported && !verified ? [`agy ${actual} is compatible by 1.
|
|
179
|
+
const warnings = supported && !verified ? [`agy ${actual} is compatible by 1.x version/help checks, but only ${VERIFIED_AGY_VERSIONS.join(' and ')} have been verified with real agent execution`] : [];
|
|
173
180
|
return { version: actual, supported, executable: command.executable, prefixArgs: command.prefixArgs, warnings, conversationResume: /(?:^|\s)--conversation(?=\s|$)/.test(help.text) };
|
|
174
181
|
}
|
|
175
182
|
//# sourceMappingURL=process.js.map
|
package/dist/src/runtime.js
CHANGED
|
@@ -84,7 +84,7 @@ export async function createRuntime() {
|
|
|
84
84
|
authentication: 'Each agent CLI uses its own cached login; only a live task verifies it.',
|
|
85
85
|
limits: { max_timeout_seconds: config.max_timeout_seconds, max_output_bytes_per_stream: config.max_output_bytes, max_retained_tasks: config.max_retained_tasks, max_mission_steps: MAX_STEPS_PER_MISSION, max_retained_missions: MAX_RETAINED_MISSIONS, concurrent_tasks: maxParallelWorktrees + 1, concurrent_normal_tasks: 1, max_parallel_worktrees: maxParallelWorktrees, max_queued_tasks: config.max_queued_tasks },
|
|
86
86
|
limitations: [
|
|
87
|
-
`Antigravity requires agy 1.
|
|
87
|
+
`Antigravity requires the agy 1.x line with all required flags; real execution was verified on ${VERIFIED_AGY_VERSIONS.join(' and ')}.`,
|
|
88
88
|
'Codex defaults to sandbox workspace-write; the bridge owner may raise sandbox/approval in config (danger-full-access / ask-for-approval never), which is surfaced as agent warnings.',
|
|
89
89
|
'Ordinary tasks are serialized globally. Only tasks with isolation "worktree" run concurrently, each in its own git worktree and branch.',
|
|
90
90
|
'Mission plans are recorded and gated by the bridge, but the bridge never dispatches a step by itself: every step starts on a client call, and a canceled or completed plan grants nothing.',
|
package/docs/HARDENING.md
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
2. Task queued được validate lại trước launch. Chuyển sang running được ghi trước spawn để restore không kết luận sai rằng task chưa từng sửa file. Recheck trạng thái ngay trước spawn ngăn launch tiếp sau cancel/shutdown trong lúc chờ I/O.
|
|
9
9
|
3. POSIX SIGTERM cả nhóm, tối đa 8 giây rồi SIGKILL. Windows vẫn taskkill theo PID/cây thuộc server khi hủy; khi agent tự thoát, bridge còn giải phóng các cây con mà agent để lại (mục "Dọn cây tiến trình agent" dưới đây). Bridge watchdog chạy sau CLI timeout thêm 10 giây; cancellation có thể chờ thêm thời gian cleanup.
|
|
10
10
|
4. Startup và acquisition tự thu hồi lock chỉ khi cả hai PID trong owner đều hợp lệ và không còn sống. Record thiếu/hỏng, PID còn sống, ownership đổi hoặc owner cũ hơn lock thì giữ nguyên. `agy-mcp-bridge unlock` dùng cùng logic và không kill process. PID reuse và server crash vẫn cần xử lý thận trọng; chưa có Windows Job Object.
|
|
11
|
-
5. Family 1.
|
|
11
|
+
5. Family 1.x phải có đủ cờ bắt buộc trong help. Mỗi bản 1.4.3, 1.4.7, 1.4.8, 1.4.9, 1.5.1 và 1.5.2 đều có một lần `npm run test:live` đạt trên CLI thật (smoke + hủy task + shutdown; 1.4.8, 1.4.9, 1.5.1 và 1.5.2 thêm mission ba bước); bản 1.x khác có cảnh báo log/environment; major khác không chạy. Gate không khóa theo minor vì `agy` tự cập nhật: khóa 1.4.x từng làm bridge từ chối mọi task trên máy chỉ vì CLI lên 1.5.1, rồi lại lên 1.5.2 trong vòng ~20 phút sau (đo ngày 2026-11-06, xem VERIFICATION).
|
|
12
12
|
6. Môi trường child mặc định chỉ có PATH, HOME, USERPROFILE, APPDATA, LOCALAPPDATA, TEMP, TMP, TMPDIR, SystemRoot, ComSpec, LANG, LC_*, XDG_*, HTTP_PROXY, HTTPS_PROXY, NO_PROXY; tên không phân biệt hoa thường. Tên chứa TOKEN/SECRET/PASSWORD/API_KEY chỉ được truyền khi có trong `extra_env_passthrough`. Các thiết lập auth/tool phụ thuộc env khác có thể cần opt-in.
|
|
13
13
|
7. Bridge không có bearer token. Chỉ bind 127.0.0.1 và giữ kiểm tra Host/Origin; bất kỳ tiến trình cục bộ cùng user đều có thể điều khiển agent, hủy task hoặc tắt server. Đây là mô hình tin cậy cục bộ có chủ đích, không dùng cho máy chia sẻ hoặc mạng ngoài.
|
|
14
|
-
8. Prompt mặc định vẫn đi qua argv với print/json, là đường đã được chạy thật với `agy` 1.4.3, 1.4.7, 1.4.8
|
|
14
|
+
8. Prompt mặc định vẫn đi qua argv với print/json, là đường đã được chạy thật với `agy` 1.4.3, 1.4.7, 1.4.8, 1.4.9, 1.5.1 và 1.5.2. Chế độ `"prompt_transport": "stdin"` (tùy chọn, chưa mặc định) gửi NDJSON qua stdin để prompt không hiện trong danh sách tiến trình: một event user rồi end, stdout phải có đúng một event result hợp lệ. Chỉ bật khi đã xác nhận bằng một lần chạy `agy` thật; nếu định dạng không khớp, task fail và lỗi có gợi ý quay lại argv. Cap API 24000 ký tự và output cap không thay đổi; progress/init cũng tính vào output.
|
|
15
15
|
9. Output được gom vào mảng chunk; decode/redact snapshot tối đa mỗi giây, cuối task flush đầy đủ. Byte counts và truncated giữ ngữ nghĩa cũ.
|
|
16
16
|
10. Repeated SIGINT/SIGTERM không bỏ cleanup; in thông báo chờ.
|
|
17
17
|
11. Prompt nhận clientLabel thực tế; MCP/UI version đọc manifest. Prerelease được so từng phần, numeric so bằng BigInt, ví dụ rc.2 < rc.10; build metadata không ảnh hưởng precedence.
|
package/docs/VERIFICATION.md
CHANGED
|
@@ -99,4 +99,29 @@ Máy thật, `agy` 1.4.12 (`%LOCALAPPDATA%\agy\bin\agy.exe`), tài khoản đang
|
|
|
99
99
|
- Bridge **không** dùng `-c` / `--continue` ("Continue the most recent conversation", có trong help 1.5.1): nó trỏ tới hội thoại mới nhất của toàn máy, kể cả phiên tương tác mà chính chủ máy đang dùng, nên một task headless có thể ghi đè ngữ cảnh đó. `--conversation <id>` cộng với hai lớp chặn ở trên là lựa chọn có chủ đích, không phải thiếu sót.
|
|
100
100
|
- `--conversation` dùng chung với `--json-schema` vẫn chạy: cùng `conversation_id`, và CLI thêm trường `structured_output` chứa object đã_validate (trường `response` vẫn lẫn văn bản model tự viết, nên muốn tin thì phải đọc `structured_output`). Lượt đó mất 4 turn và 702 giây — bridge chưa dùng `--json-schema`, mục này chỉ ghi lại rằng hai cờ không xung đột.
|
|
101
101
|
- Không đo: `agy_acp_server.par` (artifact Google có trên CDN cho Windows x64/arm64, bản 1.4.1). Đó là hướng thay đổi adapter, không thuộc phạm vi bổ sung này.
|
|
102
|
-
- Đo lúc 2026-11-06 (sau khi các dòng trên đã ghi): `agy --version` trên máy này là **1.5.1** — CLI tự cập nhật, còn các số liệu token/help ở trên lấy khi nó là 1.4.12. Help 1.5.1 vẫn liệt kê đầy đủ mọi cờ mà probe yêu cầu (`--print`, `--output-format`, `--print-timeout`, `--disable-slash-commands`, `--input-format`, thêm cả `--conversation`, `--json-schema`, `--mode`, `--effort`, `--log-file`), nhưng `supported` ở `src/antigravity/process.ts` đòi `/^1\.4\.\d+$/`, nên bridge hiện đánh dấu Antigravity unavailable và **từ chối mọi delegation trên chính máy này**.
|
|
102
|
+
- Đo lúc 2026-11-06 (sau khi các dòng trên đã ghi): `agy --version` trên máy này là **1.5.1** — CLI tự cập nhật, còn các số liệu token/help ở trên lấy khi nó là 1.4.12. Help 1.5.1 vẫn liệt kê đầy đủ mọi cờ mà probe yêu cầu (`--print`, `--output-format`, `--print-timeout`, `--disable-slash-commands`, `--input-format`, thêm cả `--conversation`, `--json-schema`, `--mode`, `--effort`, `--log-file`), nhưng `supported` ở `src/antigravity/process.ts` đòi `/^1\.4\.\d+$/`, nên bridge hiện đánh dấu Antigravity unavailable và **từ chối mọi delegation trên chính máy này**. Bản sửa và bằng chứng chạy thật ở mục dưới.
|
|
103
|
+
|
|
104
|
+
## Bổ sung 2026-11-06 — gate họ CLI khi `agy` tự lên 1.5.1
|
|
105
|
+
|
|
106
|
+
Máy thật, cùng máy với các đo ở trên. `agy` đã tự cập nhật **1.4.12 → 1.5.1** giữa lúc đang đo resume.
|
|
107
|
+
|
|
108
|
+
- Help 1.5.1 vẫn liệt kê đủ mọi cờ probe yêu cầu và cả `--conversation`, `--json-schema`, `--mode`, `--effort`, `--log-file` (đếm trên `agy --help`, không suy từ tài liệu). Vậy 1.5.1 không mất gì so với 1.4.12 về phía cờ.
|
|
109
|
+
- Trước bản sửa: `supported` = false vì `/^1\.4\.\d+$/`, agent báo unavailable, delegation chết hẳn trên máy đang chạy tốt. Đây là bug do pin theo minor, trái với ý định đã ghi trong HARDENING ("minor/major khác không chạy" nhưng agy tự lên minor).
|
|
110
|
+
- Bản sửa: gate là họ `^1\.\d+\.\d+$` + đúng bộ cờ help; major khác vẫn từ chối. `isSupportedAgyVersion` export từ `src/antigravity/process.ts` để **một chỗ duy nhất** trả lời câu hỏi này.
|
|
111
|
+
- Lần chạy `npm run test:live` đầu tiên **thất bại vì chính script verifier**: phần `assert` trong `scripts/live.ts` giữ bản sao `/^1\.4\.\d+$/` riêng và đo `environment.cli_version` theo nó, nên bridge đã nhận 1.5.1 mà live vẫn abort (`error: "The input did not match the regular expression /^1\\.4\\.\\d+$/. Input: '1.5.1'"`, `server_exit_code=0`, `success=false`). Nếu chỉ sửa regex trong `src` mà không chạy live, bug này lọt. `live.ts` nay dùng `isSupportedAgyVersion`.
|
|
112
|
+
- Lần chạy `npm run test:live` thứ hai trên CLI thật 1.5.1: **exit 0**, `success: true`, 14:23:56Z → 14:25:13Z (77 s), smoke `completed` với đúng `BRIDGE_SMOKE_OK`, `response_verified=true`, `workspace_unchanged=true`, `reconnected=true`, mission ba bước `a/b/c` đều `completed`, cancel `canceled`, `shutdown_with_active_task_verified=true`, `server_exit_code=0`.
|
|
113
|
+
- Bằng chứng cộng thêm cho resume: task live trên 1.5.1 trả `conversation_id` thật (`5de8322b-19f0-47bc-ae57-4e735a95a6b5`), tức field bridge đọc từ envelope không phải chỉ có trong fixture.
|
|
114
|
+
- Vì có một loạt task thật đạt, `1.5.1` được thêm vào `VERIFIED_AGY_VERSIONS`; environment trên máy này không còn in cảnh báo "only ... verified".
|
|
115
|
+
- Mutation check (bỏ bản sửa là test phải đỏ): đổi thân `isSupportedAgyVersion` về `/^1\.4\.\d+$/` rồi build lại → `tests/hardening-inspection.test.ts` **đỏ** ngay tại `AssertionError [ERR_ASSERTION]: 1.5.0, actual: false, expected: true`; khôi phục regex họ 1.x → xanh (2/2 test của file).
|
|
116
|
+
- Suite đầy đủ trên nội dung cuối (Windows, Node **24.15.0** — `node -v` trên máy chạy suite): **351 test / 344 pass / 0 fail / 7 skipped**, 370 s, exit 0. `skills/` không đổi nên không đăng ký hash mới.
|
|
117
|
+
- Chưa đo: behavior khác của 1.5.1 và 1.5.2 so với 1.4.x ngoài bộ cờ và các đường live trên (ví dụ `--remote-agent`, `agy_acp_server`).
|
|
118
|
+
|
|
119
|
+
## Bổ sung 2026-11-06 (lần 2) — `agy` lên 1.5.2 ngay khi PR gate đang mở
|
|
120
|
+
|
|
121
|
+
Cùng máy, cùng ngày. Lần đo 1.5.1 kết thúc 14:25:13Z; server build từ nhánh gate khởi động lúc ~14:41Z đã thấy **1.5.2**.
|
|
122
|
+
|
|
123
|
+
- `npm run check` trên built server (không task AI nào): `bridge_status: ready`, `antigravity.available: true`, `version: 1.5.2`, `conversation_resume: true`, kèm đúng cảnh báo dự kiến `agy 1.5.2 is compatible by 1.x version/help checks, but only 1.4.3 and 1.4.7 and 1.4.8 and 1.4.9 and 1.5.1 have been verified with real agent execution`. Đây chính là đường "họ 1.x chấp nhận + cảnh báo" mà bản sửa mở ra; với gate `^1\.4\.\d+$` cũ, 1.5.2 cũng chết delegation như 1.5.1.
|
|
124
|
+
- `npm run test:live` trên CLI thật 1.5.2: **exit 0**, `success: true`, 14:43:01Z → 14:44:07Z (66 s), smoke `completed` exit 0 trả đúng `BRIDGE_SMOKE_OK`, `response_verified=true`, `workspace_unchanged=true`, `reconnected=true`, mission ba bước đều `completed`, cancel `canceled` exit 1 với `process_running=false` và `denied_actions=[]`, `shutdown_with_active_task_verified=true`, `server_exit_code=0`. Task smoke trả `conversation_id` thật `9254265e-acfc-45c1-8e33-a3ef02b59f90`.
|
|
125
|
+
- Theo chuẩn đã ghi (một lần `test:live` **đầy đủ** đạt, không phải một task lẻ), `1.5.2` được thêm vào `VERIFIED_AGY_VERSIONS`, kèm dòng `['1.5.2','',true,false]` trong bảng `tests/hardening-inspection.test.ts`.
|
|
126
|
+
- Mutation check cho chính danh sách: bỏ `1.5.2` khỏi constant rồi build lại → test inspection **đỏ** (`fail 1`, `actual: true, expected: false` — đúng cái cờ `warn` của dòng `['1.5.2','',true,false]`, tức CLI chưa đo phải còn bị cảnh báo); khôi phục constant → xanh (2/2).
|
|
127
|
+
- Suite đầy đủ trên nội dung cuối (Windows, Node 24.15.0): **351 test / 344 pass / 0 fail / 7 skipped**, 384 s, exit 0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-mcp-bridge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.38",
|
|
4
4
|
"description": "Local loopback HTTP MCP bridge that delegates bounded coding tasks to multiple agent CLIs (Antigravity, Codex) with optional parallel git worktrees",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|