@rbbtsn0w/adg 0.7.1-beta.1 → 0.7.1-beta.2
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.
|
@@ -1,8 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { isExposed } from "../components.js";
|
|
4
4
|
import { mcpConfigPath } from "../mcp.js";
|
|
5
5
|
export const ANTIGRAVITY_MCP_CONFIG = "mcp_config.json";
|
|
6
|
+
const ANTIGRAVITY_MCP_SERVER_KEYS = new Set([
|
|
7
|
+
"command",
|
|
8
|
+
"serverUrl",
|
|
9
|
+
"args",
|
|
10
|
+
"env",
|
|
11
|
+
"cwd",
|
|
12
|
+
"headers",
|
|
13
|
+
"authProviderType",
|
|
14
|
+
"oauth",
|
|
15
|
+
"disabled",
|
|
16
|
+
"disabledTools",
|
|
17
|
+
]);
|
|
18
|
+
const ANTIGRAVITY_MCP_KEY_ALIASES = {
|
|
19
|
+
url: "serverUrl",
|
|
20
|
+
http_headers: "headers",
|
|
21
|
+
disabled_tools: "disabledTools",
|
|
22
|
+
};
|
|
23
|
+
function toAntigravityMcpServer(value) {
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
25
|
+
return value;
|
|
26
|
+
const source = value;
|
|
27
|
+
const server = {};
|
|
28
|
+
for (const [key, field] of Object.entries(source)) {
|
|
29
|
+
if (ANTIGRAVITY_MCP_SERVER_KEYS.has(key))
|
|
30
|
+
server[key] = field;
|
|
31
|
+
}
|
|
32
|
+
for (const [sourceKey, targetKey] of Object.entries(ANTIGRAVITY_MCP_KEY_ALIASES)) {
|
|
33
|
+
if (server[targetKey] === undefined && source[sourceKey] !== undefined) {
|
|
34
|
+
server[targetKey] = source[sourceKey];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return server;
|
|
38
|
+
}
|
|
39
|
+
function toAntigravityMcpConfig(source) {
|
|
40
|
+
const parsed = JSON.parse(readFileSync(source, "utf8"));
|
|
41
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
42
|
+
return parsed;
|
|
43
|
+
const config = parsed;
|
|
44
|
+
const servers = config.mcpServers ?? config.servers;
|
|
45
|
+
if (!servers || typeof servers !== "object" || Array.isArray(servers))
|
|
46
|
+
return config;
|
|
47
|
+
const projected = {
|
|
48
|
+
...config,
|
|
49
|
+
mcpServers: {},
|
|
50
|
+
};
|
|
51
|
+
delete projected.servers;
|
|
52
|
+
for (const [name, value] of Object.entries(servers)) {
|
|
53
|
+
projected.mcpServers[name] = toAntigravityMcpServer(value);
|
|
54
|
+
}
|
|
55
|
+
return projected;
|
|
56
|
+
}
|
|
6
57
|
/**
|
|
7
58
|
* Generate an Antigravity (`agy`) plugin.json from an ADG manifest.
|
|
8
59
|
*
|
|
@@ -22,8 +73,9 @@ export function writeAntigravityMcpConfig(pluginDir, manifest, selection) {
|
|
|
22
73
|
// generated projection. Never remove or copy it onto itself.
|
|
23
74
|
if (source === resolve(target))
|
|
24
75
|
return;
|
|
25
|
-
rmSync(target, { force: true });
|
|
26
76
|
if (source && isExposed(selection, "mcp") && existsSync(source)) {
|
|
27
|
-
|
|
77
|
+
writeFileSync(target, `${JSON.stringify(toAntigravityMcpConfig(source), null, 2)}\n`);
|
|
78
|
+
return;
|
|
28
79
|
}
|
|
80
|
+
rmSync(target, { force: true });
|
|
29
81
|
}
|
|
@@ -74,9 +74,11 @@ plugin root. The ADG adapter materializes files at these conventional locations.
|
|
|
74
74
|
|
|
75
75
|
- **Config file name**: `mcp_config.json` (at plugin root — required conventional name).
|
|
76
76
|
- **Config key**: N/A (no manifest key; discovered by file presence).
|
|
77
|
-
- **Special handling**: ADG
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
- **Special handling**: ADG projects the source `.mcp.json` to `mcp_config.json`
|
|
78
|
+
at the plugin root, normalizing canonical aliases such as `url`, `http_headers`,
|
|
79
|
+
and `disabled_tools` to Antigravity's schema. Unsupported source-runtime fields
|
|
80
|
+
are omitted. If the source IS already `mcp_config.json`, it is treated as a
|
|
81
|
+
native override and left unchanged.
|
|
80
82
|
|
|
81
83
|
---
|
|
82
84
|
|
package/docs/agents-spec.md
CHANGED
|
@@ -318,8 +318,8 @@ Hooks require the most complex adapter logic. See also
|
|
|
318
318
|
| :--- | :--- | :--- | :--- |
|
|
319
319
|
| **Config file** | `.mcp.json` or inline in manifest | `.mcp.json` reference | `mcp_config.json` at plugin root |
|
|
320
320
|
| **Manifest key** | `mcpServers` | `mcpServers` | N/A (discovered by file presence) |
|
|
321
|
-
| **Format** | `{ "mcpServers": { "<name>": { "command": ... } } }` | Same as Claude |
|
|
322
|
-
| **Projection** | Passed through | Passed through |
|
|
321
|
+
| **Format** | `{ "mcpServers": { "<name>": { "command": ... } } }` | Same as Claude | Native schema (`serverUrl`, `headers`, and other camelCase fields) |
|
|
322
|
+
| **Projection** | Passed through | Passed through | Field-normalized from source `.mcp.json`; native `mcp_config.json` overrides pass through |
|
|
323
323
|
|
|
324
324
|
---
|
|
325
325
|
|