agent-gate-installer 1.2.0 → 1.3.1
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/bin/install.mjs +3 -40
- package/package.json +1 -1
package/bin/install.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { execSync } from "node:child_process";
|
|
4
|
-
import { existsSync, mkdirSync, readFileSync,
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
|
5
5
|
import { createInterface } from "node:readline";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
-
import { homedir, platform
|
|
7
|
+
import { homedir, platform } from "node:os";
|
|
8
8
|
|
|
9
9
|
const CLAUDE_HOME = join(homedir(), ".claude");
|
|
10
10
|
const INSTALL_DIR = join(CLAUDE_HOME, "agent-gate");
|
|
@@ -129,39 +129,7 @@ function registerMcpServer(settings, venvPython) {
|
|
|
129
129
|
command: venvPython,
|
|
130
130
|
args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
|
|
131
131
|
};
|
|
132
|
-
log(" + Registered agent-gate MCP server
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function patchWebMcpConfigs(venvPython) {
|
|
136
|
-
const tmp = tmpdir();
|
|
137
|
-
let patched = 0;
|
|
138
|
-
let files;
|
|
139
|
-
try {
|
|
140
|
-
files = readdirSync(tmp);
|
|
141
|
-
} catch {
|
|
142
|
-
return patched;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
for (const file of files) {
|
|
146
|
-
if (!file.startsWith("mcp-config-") || !file.endsWith(".json")) continue;
|
|
147
|
-
const filePath = join(tmp, file);
|
|
148
|
-
try {
|
|
149
|
-
const raw = readFileSync(filePath, "utf8");
|
|
150
|
-
const config = JSON.parse(raw);
|
|
151
|
-
if (config.mcpServers?.["agent-gate"]) continue;
|
|
152
|
-
config.mcpServers = config.mcpServers || {};
|
|
153
|
-
config.mcpServers["agent-gate"] = {
|
|
154
|
-
type: "stdio",
|
|
155
|
-
command: venvPython,
|
|
156
|
-
args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
|
|
157
|
-
};
|
|
158
|
-
writeFileSync(filePath, JSON.stringify(config) + "\n", "utf8");
|
|
159
|
-
patched++;
|
|
160
|
-
} catch {
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return patched;
|
|
132
|
+
log(" + Registered agent-gate MCP server");
|
|
165
133
|
}
|
|
166
134
|
|
|
167
135
|
async function promptForToken() {
|
|
@@ -253,11 +221,6 @@ async function install() {
|
|
|
253
221
|
registerMcpServer(settings, venvPython);
|
|
254
222
|
writeSettings(settings);
|
|
255
223
|
|
|
256
|
-
const webPatched = patchWebMcpConfigs(venvPython);
|
|
257
|
-
if (webPatched > 0) {
|
|
258
|
-
log(` + Patched ${webPatched} web session MCP config(s) in ${tmpdir()}`);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
224
|
log(" + Verifying installation...");
|
|
262
225
|
try {
|
|
263
226
|
run(`"${venvPython}" -c "from agent_gate.server import create_mcp; print('OK')"`);
|