@solongate/proxy 0.5.0 → 0.5.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 +17 -1
- package/dist/init.js +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -792,6 +792,7 @@ async function main() {
|
|
|
792
792
|
console.log("");
|
|
793
793
|
console.log(` ${_c.dim}${_c.italic}Init Setup${_c.reset}`);
|
|
794
794
|
console.log("");
|
|
795
|
+
await sleep(400);
|
|
795
796
|
const configInfo = findConfigFile(options.configPath, true);
|
|
796
797
|
if (!configInfo) {
|
|
797
798
|
console.log(" No MCP config found and could not create one.");
|
|
@@ -816,6 +817,7 @@ async function main() {
|
|
|
816
817
|
console.log(" No MCP servers found in config.");
|
|
817
818
|
process.exit(1);
|
|
818
819
|
}
|
|
820
|
+
await sleep(300);
|
|
819
821
|
console.log(` Found ${serverNames.length} MCP server(s):`);
|
|
820
822
|
console.log("");
|
|
821
823
|
const toProtect = [];
|
|
@@ -823,6 +825,7 @@ async function main() {
|
|
|
823
825
|
const skipped = [];
|
|
824
826
|
for (const name of serverNames) {
|
|
825
827
|
const server = config.mcpServers[name];
|
|
828
|
+
await sleep(200);
|
|
826
829
|
if (isAlreadyProtected(server)) {
|
|
827
830
|
alreadyProtected.push(name);
|
|
828
831
|
console.log(` [protected] ${name}`);
|
|
@@ -856,6 +859,7 @@ async function main() {
|
|
|
856
859
|
process.exit(0);
|
|
857
860
|
}
|
|
858
861
|
console.log("");
|
|
862
|
+
await sleep(300);
|
|
859
863
|
ensureEnvFile();
|
|
860
864
|
console.log("");
|
|
861
865
|
let apiKey = options.apiKey || process.env.SOLONGATE_API_KEY || "";
|
|
@@ -885,8 +889,11 @@ async function main() {
|
|
|
885
889
|
console.log(" Invalid API key format. Must start with sg_live_ or sg_test_");
|
|
886
890
|
process.exit(1);
|
|
887
891
|
}
|
|
892
|
+
await sleep(300);
|
|
888
893
|
console.log(` Policy: ${options.policy}`);
|
|
894
|
+
await sleep(150);
|
|
889
895
|
console.log(` API Key: ${apiKey.slice(0, 12)}...${apiKey.slice(-4)}`);
|
|
896
|
+
await sleep(150);
|
|
890
897
|
console.log(` Protecting: ${toProtect.join(", ")}`);
|
|
891
898
|
console.log("");
|
|
892
899
|
const newConfig = { mcpServers: {} };
|
|
@@ -904,6 +911,7 @@ async function main() {
|
|
|
904
911
|
console.log(JSON.stringify(newConfig, null, 2));
|
|
905
912
|
process.exit(0);
|
|
906
913
|
}
|
|
914
|
+
await sleep(400);
|
|
907
915
|
if (!configInfo.created && !existsSync3(backupPath)) {
|
|
908
916
|
copyFileSync(configInfo.path, backupPath);
|
|
909
917
|
console.log(` Backup: ${backupPath}`);
|
|
@@ -915,22 +923,29 @@ async function main() {
|
|
|
915
923
|
} else {
|
|
916
924
|
writeFileSync2(configInfo.path, JSON.stringify(newConfig, null, 2) + "\n");
|
|
917
925
|
}
|
|
926
|
+
await sleep(300);
|
|
918
927
|
console.log(" Config updated!");
|
|
919
928
|
console.log("");
|
|
929
|
+
await sleep(500);
|
|
920
930
|
installClaudeCodeHooks(apiKey);
|
|
921
931
|
console.log("");
|
|
932
|
+
await sleep(400);
|
|
922
933
|
console.log(" \u2500\u2500 Summary \u2500\u2500");
|
|
923
934
|
console.log("");
|
|
924
935
|
for (const name of toProtect) {
|
|
936
|
+
await sleep(200);
|
|
925
937
|
console.log(` \u2713 ${name} \u2014 protected (${options.policy})`);
|
|
926
938
|
}
|
|
927
939
|
for (const name of alreadyProtected) {
|
|
940
|
+
await sleep(200);
|
|
928
941
|
console.log(` \u25CF ${name} \u2014 already protected`);
|
|
929
942
|
}
|
|
930
943
|
for (const name of skipped) {
|
|
944
|
+
await sleep(200);
|
|
931
945
|
console.log(` \u25CB ${name} \u2014 skipped`);
|
|
932
946
|
}
|
|
933
947
|
console.log("");
|
|
948
|
+
await sleep(500);
|
|
934
949
|
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");
|
|
935
950
|
console.log(" \u2502 Setup complete! \u2502");
|
|
936
951
|
console.log(" \u2502 \u2502");
|
|
@@ -944,7 +959,7 @@ async function main() {
|
|
|
944
959
|
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");
|
|
945
960
|
console.log("");
|
|
946
961
|
}
|
|
947
|
-
var POLICY_PRESETS, SEARCH_PATHS, CLAUDE_DESKTOP_PATHS, GUARD_SCRIPT, AUDIT_SCRIPT;
|
|
962
|
+
var POLICY_PRESETS, SEARCH_PATHS, CLAUDE_DESKTOP_PATHS, sleep, GUARD_SCRIPT, AUDIT_SCRIPT;
|
|
948
963
|
var init_init = __esm({
|
|
949
964
|
"src/init.ts"() {
|
|
950
965
|
"use strict";
|
|
@@ -955,6 +970,7 @@ var init_init = __esm({
|
|
|
955
970
|
".claude/mcp.json"
|
|
956
971
|
];
|
|
957
972
|
CLAUDE_DESKTOP_PATHS = process.platform === "win32" ? [join(process.env["APPDATA"] ?? "", "Claude", "claude_desktop_config.json")] : process.platform === "darwin" ? [join(process.env["HOME"] ?? "", "Library", "Application Support", "Claude", "claude_desktop_config.json")] : [join(process.env["HOME"] ?? "", ".config", "claude", "claude_desktop_config.json")];
|
|
973
|
+
sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
958
974
|
GUARD_SCRIPT = `#!/usr/bin/env node
|
|
959
975
|
/**
|
|
960
976
|
* SolonGate Guard Hook for Claude Code (PreToolUse)
|
package/dist/init.js
CHANGED
|
@@ -11,6 +11,7 @@ var SEARCH_PATHS = [
|
|
|
11
11
|
".claude/mcp.json"
|
|
12
12
|
];
|
|
13
13
|
var CLAUDE_DESKTOP_PATHS = process.platform === "win32" ? [join(process.env["APPDATA"] ?? "", "Claude", "claude_desktop_config.json")] : process.platform === "darwin" ? [join(process.env["HOME"] ?? "", "Library", "Application Support", "Claude", "claude_desktop_config.json")] : [join(process.env["HOME"] ?? "", ".config", "claude", "claude_desktop_config.json")];
|
|
14
|
+
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
14
15
|
function findConfigFile(explicitPath, createIfMissing = false) {
|
|
15
16
|
if (explicitPath) {
|
|
16
17
|
if (existsSync(explicitPath)) {
|
|
@@ -493,6 +494,7 @@ async function main() {
|
|
|
493
494
|
console.log("");
|
|
494
495
|
console.log(` ${_c.dim}${_c.italic}Init Setup${_c.reset}`);
|
|
495
496
|
console.log("");
|
|
497
|
+
await sleep(400);
|
|
496
498
|
const configInfo = findConfigFile(options.configPath, true);
|
|
497
499
|
if (!configInfo) {
|
|
498
500
|
console.log(" No MCP config found and could not create one.");
|
|
@@ -517,6 +519,7 @@ async function main() {
|
|
|
517
519
|
console.log(" No MCP servers found in config.");
|
|
518
520
|
process.exit(1);
|
|
519
521
|
}
|
|
522
|
+
await sleep(300);
|
|
520
523
|
console.log(` Found ${serverNames.length} MCP server(s):`);
|
|
521
524
|
console.log("");
|
|
522
525
|
const toProtect = [];
|
|
@@ -524,6 +527,7 @@ async function main() {
|
|
|
524
527
|
const skipped = [];
|
|
525
528
|
for (const name of serverNames) {
|
|
526
529
|
const server = config.mcpServers[name];
|
|
530
|
+
await sleep(200);
|
|
527
531
|
if (isAlreadyProtected(server)) {
|
|
528
532
|
alreadyProtected.push(name);
|
|
529
533
|
console.log(` [protected] ${name}`);
|
|
@@ -557,6 +561,7 @@ async function main() {
|
|
|
557
561
|
process.exit(0);
|
|
558
562
|
}
|
|
559
563
|
console.log("");
|
|
564
|
+
await sleep(300);
|
|
560
565
|
ensureEnvFile();
|
|
561
566
|
console.log("");
|
|
562
567
|
let apiKey = options.apiKey || process.env.SOLONGATE_API_KEY || "";
|
|
@@ -586,8 +591,11 @@ async function main() {
|
|
|
586
591
|
console.log(" Invalid API key format. Must start with sg_live_ or sg_test_");
|
|
587
592
|
process.exit(1);
|
|
588
593
|
}
|
|
594
|
+
await sleep(300);
|
|
589
595
|
console.log(` Policy: ${options.policy}`);
|
|
596
|
+
await sleep(150);
|
|
590
597
|
console.log(` API Key: ${apiKey.slice(0, 12)}...${apiKey.slice(-4)}`);
|
|
598
|
+
await sleep(150);
|
|
591
599
|
console.log(` Protecting: ${toProtect.join(", ")}`);
|
|
592
600
|
console.log("");
|
|
593
601
|
const newConfig = { mcpServers: {} };
|
|
@@ -605,6 +613,7 @@ async function main() {
|
|
|
605
613
|
console.log(JSON.stringify(newConfig, null, 2));
|
|
606
614
|
process.exit(0);
|
|
607
615
|
}
|
|
616
|
+
await sleep(400);
|
|
608
617
|
if (!configInfo.created && !existsSync(backupPath)) {
|
|
609
618
|
copyFileSync(configInfo.path, backupPath);
|
|
610
619
|
console.log(` Backup: ${backupPath}`);
|
|
@@ -616,22 +625,29 @@ async function main() {
|
|
|
616
625
|
} else {
|
|
617
626
|
writeFileSync(configInfo.path, JSON.stringify(newConfig, null, 2) + "\n");
|
|
618
627
|
}
|
|
628
|
+
await sleep(300);
|
|
619
629
|
console.log(" Config updated!");
|
|
620
630
|
console.log("");
|
|
631
|
+
await sleep(500);
|
|
621
632
|
installClaudeCodeHooks(apiKey);
|
|
622
633
|
console.log("");
|
|
634
|
+
await sleep(400);
|
|
623
635
|
console.log(" \u2500\u2500 Summary \u2500\u2500");
|
|
624
636
|
console.log("");
|
|
625
637
|
for (const name of toProtect) {
|
|
638
|
+
await sleep(200);
|
|
626
639
|
console.log(` \u2713 ${name} \u2014 protected (${options.policy})`);
|
|
627
640
|
}
|
|
628
641
|
for (const name of alreadyProtected) {
|
|
642
|
+
await sleep(200);
|
|
629
643
|
console.log(` \u25CF ${name} \u2014 already protected`);
|
|
630
644
|
}
|
|
631
645
|
for (const name of skipped) {
|
|
646
|
+
await sleep(200);
|
|
632
647
|
console.log(` \u25CB ${name} \u2014 skipped`);
|
|
633
648
|
}
|
|
634
649
|
console.log("");
|
|
650
|
+
await sleep(500);
|
|
635
651
|
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");
|
|
636
652
|
console.log(" \u2502 Setup complete! \u2502");
|
|
637
653
|
console.log(" \u2502 \u2502");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.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": {
|