@solongate/proxy 0.14.1 → 0.15.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/dist/index.js +45 -8
- package/dist/init.js +45 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -386,7 +386,8 @@ async function prompt(question) {
|
|
|
386
386
|
function parseInitArgs(argv) {
|
|
387
387
|
const args = argv.slice(2);
|
|
388
388
|
const options = {
|
|
389
|
-
all: false
|
|
389
|
+
all: false,
|
|
390
|
+
tools: []
|
|
390
391
|
};
|
|
391
392
|
for (let i = 0; i < args.length; i++) {
|
|
392
393
|
switch (args[i]) {
|
|
@@ -402,6 +403,24 @@ function parseInitArgs(argv) {
|
|
|
402
403
|
case "--all":
|
|
403
404
|
options.all = true;
|
|
404
405
|
break;
|
|
406
|
+
case "--claude":
|
|
407
|
+
options.tools.push("claude");
|
|
408
|
+
break;
|
|
409
|
+
case "--cursor":
|
|
410
|
+
options.tools.push("cursor");
|
|
411
|
+
break;
|
|
412
|
+
case "--gemini":
|
|
413
|
+
options.tools.push("gemini");
|
|
414
|
+
break;
|
|
415
|
+
case "--antigravity":
|
|
416
|
+
options.tools.push("antigravity");
|
|
417
|
+
break;
|
|
418
|
+
case "--openclaw":
|
|
419
|
+
options.tools.push("openclaw");
|
|
420
|
+
break;
|
|
421
|
+
case "--perplexity":
|
|
422
|
+
options.tools.push("perplexity");
|
|
423
|
+
break;
|
|
405
424
|
case "--help":
|
|
406
425
|
case "-h":
|
|
407
426
|
printHelp();
|
|
@@ -424,8 +443,17 @@ OPTIONS
|
|
|
424
443
|
--all Protect all servers without prompting
|
|
425
444
|
-h, --help Show this help message
|
|
426
445
|
|
|
446
|
+
AI TOOL HOOKS (default: all)
|
|
447
|
+
--claude Install hooks for Claude Code
|
|
448
|
+
--cursor Install hooks for Cursor
|
|
449
|
+
--gemini Install hooks for Gemini CLI
|
|
450
|
+
--antigravity Install hooks for Antigravity
|
|
451
|
+
--openclaw Install hooks for OpenClaw
|
|
452
|
+
--perplexity Install hooks for Perplexity
|
|
453
|
+
|
|
427
454
|
EXAMPLES
|
|
428
|
-
npx @solongate/proxy init --all # Protect everything
|
|
455
|
+
npx @solongate/proxy init --all # Protect everything, all tools
|
|
456
|
+
npx @solongate/proxy init --all --claude --cursor # Only Claude + Cursor hooks
|
|
429
457
|
npx @solongate/proxy init --all --policy policy.json # With custom policy
|
|
430
458
|
`;
|
|
431
459
|
console.log(help);
|
|
@@ -433,7 +461,7 @@ EXAMPLES
|
|
|
433
461
|
function readHookScript(filename) {
|
|
434
462
|
return readFileSync3(join(HOOKS_DIR, filename), "utf-8");
|
|
435
463
|
}
|
|
436
|
-
function installHooks() {
|
|
464
|
+
function installHooks(selectedTools = []) {
|
|
437
465
|
const hooksDir = resolve2(".solongate", "hooks");
|
|
438
466
|
mkdirSync2(hooksDir, { recursive: true });
|
|
439
467
|
const guardPath = join(hooksDir, "guard.mjs");
|
|
@@ -462,10 +490,16 @@ function installHooks() {
|
|
|
462
490
|
]
|
|
463
491
|
}
|
|
464
492
|
};
|
|
465
|
-
const
|
|
466
|
-
{ name: "Claude Code", dir: ".claude" },
|
|
467
|
-
{ name: "Cursor", dir: ".cursor" }
|
|
493
|
+
const allClients = [
|
|
494
|
+
{ name: "Claude Code", dir: ".claude", key: "claude" },
|
|
495
|
+
{ name: "Cursor", dir: ".cursor", key: "cursor" },
|
|
496
|
+
{ name: "Gemini CLI", dir: ".gemini", key: "gemini" },
|
|
497
|
+
{ name: "Antigravity", dir: ".antigravity", key: "antigravity" },
|
|
498
|
+
{ name: "OpenClaw", dir: ".openclaw", key: "openclaw" },
|
|
499
|
+
{ name: "Perplexity", dir: ".perplexity", key: "perplexity" }
|
|
468
500
|
];
|
|
501
|
+
const clients = selectedTools.length > 0 ? allClients.filter((c3) => selectedTools.includes(c3.key)) : allClients;
|
|
502
|
+
const activatedNames = [];
|
|
469
503
|
for (const client of clients) {
|
|
470
504
|
const clientDir = resolve2(client.dir);
|
|
471
505
|
mkdirSync2(clientDir, { recursive: true });
|
|
@@ -478,12 +512,13 @@ function installHooks() {
|
|
|
478
512
|
const merged = { ...existing, hooks: hookSettings.hooks };
|
|
479
513
|
writeFileSync2(settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
|
480
514
|
console.log(` Created ${settingsPath}`);
|
|
515
|
+
activatedNames.push(client.name);
|
|
481
516
|
}
|
|
482
517
|
console.log("");
|
|
483
518
|
console.log(" Hooks installed:");
|
|
484
519
|
console.log(" guard.mjs \u2192 blocks policy-violating calls (pre-execution)");
|
|
485
520
|
console.log(" audit.mjs \u2192 logs all calls to dashboard (post-execution)");
|
|
486
|
-
console.log(
|
|
521
|
+
console.log(` Activated for: ${activatedNames.join(", ")}`);
|
|
487
522
|
}
|
|
488
523
|
function ensureEnvFile() {
|
|
489
524
|
const envPath = resolve2(".env");
|
|
@@ -616,7 +651,7 @@ async function main() {
|
|
|
616
651
|
console.log(" All servers are already protected by SolonGate!");
|
|
617
652
|
ensureEnvFile();
|
|
618
653
|
console.log("");
|
|
619
|
-
installHooks();
|
|
654
|
+
installHooks(options.tools);
|
|
620
655
|
process.exit(0);
|
|
621
656
|
}
|
|
622
657
|
if (!options.all) {
|
|
@@ -735,6 +770,8 @@ async function main() {
|
|
|
735
770
|
console.log(" \u2502 \u2502");
|
|
736
771
|
console.log(" \u2502 MCP servers \u2192 Protected via proxy \u2502");
|
|
737
772
|
console.log(" \u2502 AI tools \u2192 Guarded via hooks \u2502");
|
|
773
|
+
console.log(" \u2502 Claude, Cursor, Gemini, Antigravity, \u2502");
|
|
774
|
+
console.log(" \u2502 OpenClaw, Perplexity \u2502");
|
|
738
775
|
console.log(" \u2502 API key \u2192 Set in .env \u2502");
|
|
739
776
|
console.log(" \u2502 \u2502");
|
|
740
777
|
console.log(" \u2502 View logs: https://dashboard.solongate.com \u2502");
|
package/dist/init.js
CHANGED
|
@@ -91,7 +91,8 @@ async function prompt(question) {
|
|
|
91
91
|
function parseInitArgs(argv) {
|
|
92
92
|
const args = argv.slice(2);
|
|
93
93
|
const options = {
|
|
94
|
-
all: false
|
|
94
|
+
all: false,
|
|
95
|
+
tools: []
|
|
95
96
|
};
|
|
96
97
|
for (let i = 0; i < args.length; i++) {
|
|
97
98
|
switch (args[i]) {
|
|
@@ -107,6 +108,24 @@ function parseInitArgs(argv) {
|
|
|
107
108
|
case "--all":
|
|
108
109
|
options.all = true;
|
|
109
110
|
break;
|
|
111
|
+
case "--claude":
|
|
112
|
+
options.tools.push("claude");
|
|
113
|
+
break;
|
|
114
|
+
case "--cursor":
|
|
115
|
+
options.tools.push("cursor");
|
|
116
|
+
break;
|
|
117
|
+
case "--gemini":
|
|
118
|
+
options.tools.push("gemini");
|
|
119
|
+
break;
|
|
120
|
+
case "--antigravity":
|
|
121
|
+
options.tools.push("antigravity");
|
|
122
|
+
break;
|
|
123
|
+
case "--openclaw":
|
|
124
|
+
options.tools.push("openclaw");
|
|
125
|
+
break;
|
|
126
|
+
case "--perplexity":
|
|
127
|
+
options.tools.push("perplexity");
|
|
128
|
+
break;
|
|
110
129
|
case "--help":
|
|
111
130
|
case "-h":
|
|
112
131
|
printHelp();
|
|
@@ -129,8 +148,17 @@ OPTIONS
|
|
|
129
148
|
--all Protect all servers without prompting
|
|
130
149
|
-h, --help Show this help message
|
|
131
150
|
|
|
151
|
+
AI TOOL HOOKS (default: all)
|
|
152
|
+
--claude Install hooks for Claude Code
|
|
153
|
+
--cursor Install hooks for Cursor
|
|
154
|
+
--gemini Install hooks for Gemini CLI
|
|
155
|
+
--antigravity Install hooks for Antigravity
|
|
156
|
+
--openclaw Install hooks for OpenClaw
|
|
157
|
+
--perplexity Install hooks for Perplexity
|
|
158
|
+
|
|
132
159
|
EXAMPLES
|
|
133
|
-
npx @solongate/proxy init --all # Protect everything
|
|
160
|
+
npx @solongate/proxy init --all # Protect everything, all tools
|
|
161
|
+
npx @solongate/proxy init --all --claude --cursor # Only Claude + Cursor hooks
|
|
134
162
|
npx @solongate/proxy init --all --policy policy.json # With custom policy
|
|
135
163
|
`;
|
|
136
164
|
console.log(help);
|
|
@@ -140,7 +168,7 @@ var HOOKS_DIR = resolve(__dirname, "..", "hooks");
|
|
|
140
168
|
function readHookScript(filename) {
|
|
141
169
|
return readFileSync(join(HOOKS_DIR, filename), "utf-8");
|
|
142
170
|
}
|
|
143
|
-
function installHooks() {
|
|
171
|
+
function installHooks(selectedTools = []) {
|
|
144
172
|
const hooksDir = resolve(".solongate", "hooks");
|
|
145
173
|
mkdirSync(hooksDir, { recursive: true });
|
|
146
174
|
const guardPath = join(hooksDir, "guard.mjs");
|
|
@@ -169,10 +197,16 @@ function installHooks() {
|
|
|
169
197
|
]
|
|
170
198
|
}
|
|
171
199
|
};
|
|
172
|
-
const
|
|
173
|
-
{ name: "Claude Code", dir: ".claude" },
|
|
174
|
-
{ name: "Cursor", dir: ".cursor" }
|
|
200
|
+
const allClients = [
|
|
201
|
+
{ name: "Claude Code", dir: ".claude", key: "claude" },
|
|
202
|
+
{ name: "Cursor", dir: ".cursor", key: "cursor" },
|
|
203
|
+
{ name: "Gemini CLI", dir: ".gemini", key: "gemini" },
|
|
204
|
+
{ name: "Antigravity", dir: ".antigravity", key: "antigravity" },
|
|
205
|
+
{ name: "OpenClaw", dir: ".openclaw", key: "openclaw" },
|
|
206
|
+
{ name: "Perplexity", dir: ".perplexity", key: "perplexity" }
|
|
175
207
|
];
|
|
208
|
+
const clients = selectedTools.length > 0 ? allClients.filter((c) => selectedTools.includes(c.key)) : allClients;
|
|
209
|
+
const activatedNames = [];
|
|
176
210
|
for (const client of clients) {
|
|
177
211
|
const clientDir = resolve(client.dir);
|
|
178
212
|
mkdirSync(clientDir, { recursive: true });
|
|
@@ -185,12 +219,13 @@ function installHooks() {
|
|
|
185
219
|
const merged = { ...existing, hooks: hookSettings.hooks };
|
|
186
220
|
writeFileSync(settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
|
187
221
|
console.log(` Created ${settingsPath}`);
|
|
222
|
+
activatedNames.push(client.name);
|
|
188
223
|
}
|
|
189
224
|
console.log("");
|
|
190
225
|
console.log(" Hooks installed:");
|
|
191
226
|
console.log(" guard.mjs \u2192 blocks policy-violating calls (pre-execution)");
|
|
192
227
|
console.log(" audit.mjs \u2192 logs all calls to dashboard (post-execution)");
|
|
193
|
-
console.log(
|
|
228
|
+
console.log(` Activated for: ${activatedNames.join(", ")}`);
|
|
194
229
|
}
|
|
195
230
|
function ensureEnvFile() {
|
|
196
231
|
const envPath = resolve(".env");
|
|
@@ -323,7 +358,7 @@ async function main() {
|
|
|
323
358
|
console.log(" All servers are already protected by SolonGate!");
|
|
324
359
|
ensureEnvFile();
|
|
325
360
|
console.log("");
|
|
326
|
-
installHooks();
|
|
361
|
+
installHooks(options.tools);
|
|
327
362
|
process.exit(0);
|
|
328
363
|
}
|
|
329
364
|
if (!options.all) {
|
|
@@ -442,6 +477,8 @@ async function main() {
|
|
|
442
477
|
console.log(" \u2502 \u2502");
|
|
443
478
|
console.log(" \u2502 MCP servers \u2192 Protected via proxy \u2502");
|
|
444
479
|
console.log(" \u2502 AI tools \u2192 Guarded via hooks \u2502");
|
|
480
|
+
console.log(" \u2502 Claude, Cursor, Gemini, Antigravity, \u2502");
|
|
481
|
+
console.log(" \u2502 OpenClaw, Perplexity \u2502");
|
|
445
482
|
console.log(" \u2502 API key \u2192 Set in .env \u2502");
|
|
446
483
|
console.log(" \u2502 \u2502");
|
|
447
484
|
console.log(" \u2502 View logs: https://dashboard.solongate.com \u2502");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "MCP security proxy — protect any MCP server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|