@solongate/proxy 0.5.3 → 0.5.4

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.
Files changed (3) hide show
  1. package/dist/index.js +15 -49
  2. package/dist/init.js +15 -49
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -682,8 +682,8 @@ POLICY PRESETS
682
682
  `;
683
683
  console.log(help);
684
684
  }
685
- function installClaudeCodeHooks(apiKey) {
686
- const hooksDir = resolve2(".claude", "hooks");
685
+ function installHooks() {
686
+ const hooksDir = resolve2(".solongate", "hooks");
687
687
  mkdirSync(hooksDir, { recursive: true });
688
688
  const guardPath = join(hooksDir, "guard.mjs");
689
689
  writeFileSync2(guardPath, GUARD_SCRIPT);
@@ -691,50 +691,15 @@ function installClaudeCodeHooks(apiKey) {
691
691
  const auditPath = join(hooksDir, "audit.mjs");
692
692
  writeFileSync2(auditPath, AUDIT_SCRIPT);
693
693
  console.log(` Created ${auditPath}`);
694
- const settingsPath = resolve2(".claude", "settings.json");
695
- let settings = {};
696
- if (existsSync3(settingsPath)) {
697
- try {
698
- settings = JSON.parse(readFileSync3(settingsPath, "utf-8"));
699
- } catch {
700
- }
701
- }
702
- settings.hooks = {
703
- PreToolUse: [
704
- {
705
- matcher: ".*",
706
- hooks: [
707
- {
708
- type: "command",
709
- command: "node .claude/hooks/guard.mjs",
710
- timeout: 5
711
- }
712
- ]
713
- }
714
- ],
715
- PostToolUse: [
716
- {
717
- matcher: ".*",
718
- hooks: [
719
- {
720
- type: "command",
721
- command: "node .claude/hooks/audit.mjs",
722
- timeout: 10,
723
- async: true
724
- }
725
- ]
726
- }
727
- ]
728
- };
729
- const envObj = settings.env || {};
730
- envObj.SOLONGATE_API_KEY = apiKey;
731
- settings.env = envObj;
732
- writeFileSync2(settingsPath, JSON.stringify(settings, null, 2) + "\n");
733
- console.log(` Created ${settingsPath}`);
734
694
  console.log("");
735
- console.log(" Claude Code hooks installed!");
736
- console.log(" PreToolUse \u2192 guard.mjs (blocks dangerous calls)");
737
- console.log(" PostToolUse \u2192 audit.mjs (logs all calls to dashboard)");
695
+ console.log(" Hooks installed in .solongate/hooks/");
696
+ console.log(" guard.mjs \u2192 blocks dangerous calls (pre-execution)");
697
+ console.log(" audit.mjs \u2192 logs all calls to dashboard (post-execution)");
698
+ console.log("");
699
+ console.log(" To activate hooks in your MCP client:");
700
+ console.log(" Claude Code \u2192 .claude/settings.json");
701
+ console.log(" Cursor \u2192 .cursor/settings.json");
702
+ console.log(" Or run: node .solongate/hooks/guard.mjs (stdin: JSON)");
738
703
  }
739
704
  function ensureEnvFile() {
740
705
  const envPath = resolve2(".env");
@@ -937,7 +902,7 @@ async function main() {
937
902
  console.log(" Config updated!");
938
903
  console.log("");
939
904
  await sleep(500);
940
- installClaudeCodeHooks(apiKey);
905
+ installHooks();
941
906
  console.log("");
942
907
  await sleep(400);
943
908
  console.log(" \u2500\u2500 Summary \u2500\u2500");
@@ -959,11 +924,12 @@ async function main() {
959
924
  console.log(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
960
925
  console.log(" \u2502 Setup complete! \u2502");
961
926
  console.log(" \u2502 \u2502");
962
- console.log(" \u2502 MCP tools \u2192 Proxy audit logging \u2502");
963
- console.log(" \u2502 Built-in tools \u2192 Hook audit logging \u2502");
927
+ console.log(" \u2502 MCP servers \u2192 Protected via proxy \u2502");
928
+ console.log(" \u2502 AI tools \u2192 Guarded via hooks \u2502");
929
+ console.log(" \u2502 API key \u2192 Set in .env \u2502");
964
930
  console.log(" \u2502 \u2502");
965
931
  console.log(" \u2502 View logs: https://dashboard.solongate.com \u2502");
966
- console.log(" \u2502 To undo: solongate-init --restore \u2502");
932
+ console.log(" \u2502 To undo: npx @solongate/proxy init --restore \u2502");
967
933
  console.log(" \u2502 \u2502");
968
934
  console.log(" \u2502 Restart your MCP client to apply changes. \u2502");
969
935
  console.log(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
package/dist/init.js CHANGED
@@ -373,8 +373,8 @@ process.stdin.on('end', async () => {
373
373
  process.exit(0);
374
374
  });
375
375
  `;
376
- function installClaudeCodeHooks(apiKey) {
377
- const hooksDir = resolve(".claude", "hooks");
376
+ function installHooks() {
377
+ const hooksDir = resolve(".solongate", "hooks");
378
378
  mkdirSync(hooksDir, { recursive: true });
379
379
  const guardPath = join(hooksDir, "guard.mjs");
380
380
  writeFileSync(guardPath, GUARD_SCRIPT);
@@ -382,50 +382,15 @@ function installClaudeCodeHooks(apiKey) {
382
382
  const auditPath = join(hooksDir, "audit.mjs");
383
383
  writeFileSync(auditPath, AUDIT_SCRIPT);
384
384
  console.log(` Created ${auditPath}`);
385
- const settingsPath = resolve(".claude", "settings.json");
386
- let settings = {};
387
- if (existsSync(settingsPath)) {
388
- try {
389
- settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
390
- } catch {
391
- }
392
- }
393
- settings.hooks = {
394
- PreToolUse: [
395
- {
396
- matcher: ".*",
397
- hooks: [
398
- {
399
- type: "command",
400
- command: "node .claude/hooks/guard.mjs",
401
- timeout: 5
402
- }
403
- ]
404
- }
405
- ],
406
- PostToolUse: [
407
- {
408
- matcher: ".*",
409
- hooks: [
410
- {
411
- type: "command",
412
- command: "node .claude/hooks/audit.mjs",
413
- timeout: 10,
414
- async: true
415
- }
416
- ]
417
- }
418
- ]
419
- };
420
- const envObj = settings.env || {};
421
- envObj.SOLONGATE_API_KEY = apiKey;
422
- settings.env = envObj;
423
- writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
424
- console.log(` Created ${settingsPath}`);
425
385
  console.log("");
426
- console.log(" Claude Code hooks installed!");
427
- console.log(" PreToolUse \u2192 guard.mjs (blocks dangerous calls)");
428
- console.log(" PostToolUse \u2192 audit.mjs (logs all calls to dashboard)");
386
+ console.log(" Hooks installed in .solongate/hooks/");
387
+ console.log(" guard.mjs \u2192 blocks dangerous calls (pre-execution)");
388
+ console.log(" audit.mjs \u2192 logs all calls to dashboard (post-execution)");
389
+ console.log("");
390
+ console.log(" To activate hooks in your MCP client:");
391
+ console.log(" Claude Code \u2192 .claude/settings.json");
392
+ console.log(" Cursor \u2192 .cursor/settings.json");
393
+ console.log(" Or run: node .solongate/hooks/guard.mjs (stdin: JSON)");
429
394
  }
430
395
  function ensureEnvFile() {
431
396
  const envPath = resolve(".env");
@@ -628,7 +593,7 @@ async function main() {
628
593
  console.log(" Config updated!");
629
594
  console.log("");
630
595
  await sleep(500);
631
- installClaudeCodeHooks(apiKey);
596
+ installHooks();
632
597
  console.log("");
633
598
  await sleep(400);
634
599
  console.log(" \u2500\u2500 Summary \u2500\u2500");
@@ -650,11 +615,12 @@ async function main() {
650
615
  console.log(" \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
651
616
  console.log(" \u2502 Setup complete! \u2502");
652
617
  console.log(" \u2502 \u2502");
653
- console.log(" \u2502 MCP tools \u2192 Proxy audit logging \u2502");
654
- console.log(" \u2502 Built-in tools \u2192 Hook audit logging \u2502");
618
+ console.log(" \u2502 MCP servers \u2192 Protected via proxy \u2502");
619
+ console.log(" \u2502 AI tools \u2192 Guarded via hooks \u2502");
620
+ console.log(" \u2502 API key \u2192 Set in .env \u2502");
655
621
  console.log(" \u2502 \u2502");
656
622
  console.log(" \u2502 View logs: https://dashboard.solongate.com \u2502");
657
- console.log(" \u2502 To undo: solongate-init --restore \u2502");
623
+ console.log(" \u2502 To undo: npx @solongate/proxy init --restore \u2502");
658
624
  console.log(" \u2502 \u2502");
659
625
  console.log(" \u2502 Restart your MCP client to apply changes. \u2502");
660
626
  console.log(" \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
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": {