@solongate/proxy 0.5.5 → 0.5.6
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 +29 -6
- package/dist/init.js +29 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -580,7 +580,7 @@ function isAlreadyProtected(server) {
|
|
|
580
580
|
}
|
|
581
581
|
return false;
|
|
582
582
|
}
|
|
583
|
-
function wrapServer(server) {
|
|
583
|
+
function wrapServer(server, policy) {
|
|
584
584
|
const env = { ...server.env ?? {} };
|
|
585
585
|
env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
|
|
586
586
|
return {
|
|
@@ -589,7 +589,7 @@ function wrapServer(server) {
|
|
|
589
589
|
"-y",
|
|
590
590
|
"@solongate/proxy",
|
|
591
591
|
"--policy",
|
|
592
|
-
|
|
592
|
+
policy,
|
|
593
593
|
"--verbose",
|
|
594
594
|
"--",
|
|
595
595
|
server.command,
|
|
@@ -617,6 +617,9 @@ function parseInitArgs(argv) {
|
|
|
617
617
|
case "--config":
|
|
618
618
|
options.configPath = args[++i];
|
|
619
619
|
break;
|
|
620
|
+
case "--policy":
|
|
621
|
+
options.policy = args[++i];
|
|
622
|
+
break;
|
|
620
623
|
case "--api-key":
|
|
621
624
|
options.apiKey = args[++i];
|
|
622
625
|
break;
|
|
@@ -640,13 +643,15 @@ USAGE
|
|
|
640
643
|
|
|
641
644
|
OPTIONS
|
|
642
645
|
--config <path> Path to MCP config file (default: auto-detect)
|
|
646
|
+
--policy <file> Custom policy JSON file (default: restricted)
|
|
647
|
+
Auto-detects policy.json in current directory
|
|
643
648
|
--api-key <key> SolonGate API key (sg_live_... or sg_test_...)
|
|
644
649
|
--all Protect all servers without prompting
|
|
645
650
|
-h, --help Show this help message
|
|
646
651
|
|
|
647
652
|
EXAMPLES
|
|
648
|
-
npx @solongate/proxy init --all
|
|
649
|
-
npx @solongate/proxy init --
|
|
653
|
+
npx @solongate/proxy init --all # Protect everything
|
|
654
|
+
npx @solongate/proxy init --all --policy policy.json # With custom policy
|
|
650
655
|
`;
|
|
651
656
|
console.log(help);
|
|
652
657
|
}
|
|
@@ -822,8 +827,26 @@ async function main() {
|
|
|
822
827
|
console.log(" Invalid API key format. Must start with sg_live_ or sg_test_");
|
|
823
828
|
process.exit(1);
|
|
824
829
|
}
|
|
830
|
+
let policyValue = "restricted";
|
|
831
|
+
if (options.policy) {
|
|
832
|
+
const policyPath = resolve2(options.policy);
|
|
833
|
+
if (existsSync3(policyPath)) {
|
|
834
|
+
policyValue = `./${options.policy}`;
|
|
835
|
+
console.log(` Policy: ${policyPath}`);
|
|
836
|
+
} else {
|
|
837
|
+
console.log(` Policy file not found: ${options.policy}`);
|
|
838
|
+
process.exit(1);
|
|
839
|
+
}
|
|
840
|
+
} else {
|
|
841
|
+
const defaultPolicy = resolve2("policy.json");
|
|
842
|
+
if (existsSync3(defaultPolicy)) {
|
|
843
|
+
policyValue = "./policy.json";
|
|
844
|
+
console.log(` Policy: ${defaultPolicy} (auto-detected)`);
|
|
845
|
+
} else {
|
|
846
|
+
console.log(` Policy: restricted (default)`);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
825
849
|
await sleep(300);
|
|
826
|
-
console.log(` Policy: restricted`);
|
|
827
850
|
await sleep(150);
|
|
828
851
|
console.log(` API Key: ${apiKey.slice(0, 12)}...${apiKey.slice(-4)}`);
|
|
829
852
|
await sleep(150);
|
|
@@ -832,7 +855,7 @@ async function main() {
|
|
|
832
855
|
const newConfig = { mcpServers: {} };
|
|
833
856
|
for (const name of serverNames) {
|
|
834
857
|
if (toProtect.includes(name)) {
|
|
835
|
-
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name]);
|
|
858
|
+
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], policyValue);
|
|
836
859
|
} else {
|
|
837
860
|
newConfig.mcpServers[name] = config.mcpServers[name];
|
|
838
861
|
}
|
package/dist/init.js
CHANGED
|
@@ -64,7 +64,7 @@ function isAlreadyProtected(server) {
|
|
|
64
64
|
}
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
67
|
-
function wrapServer(server) {
|
|
67
|
+
function wrapServer(server, policy) {
|
|
68
68
|
const env = { ...server.env ?? {} };
|
|
69
69
|
env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
|
|
70
70
|
return {
|
|
@@ -73,7 +73,7 @@ function wrapServer(server) {
|
|
|
73
73
|
"-y",
|
|
74
74
|
"@solongate/proxy",
|
|
75
75
|
"--policy",
|
|
76
|
-
|
|
76
|
+
policy,
|
|
77
77
|
"--verbose",
|
|
78
78
|
"--",
|
|
79
79
|
server.command,
|
|
@@ -101,6 +101,9 @@ function parseInitArgs(argv) {
|
|
|
101
101
|
case "--config":
|
|
102
102
|
options.configPath = args[++i];
|
|
103
103
|
break;
|
|
104
|
+
case "--policy":
|
|
105
|
+
options.policy = args[++i];
|
|
106
|
+
break;
|
|
104
107
|
case "--api-key":
|
|
105
108
|
options.apiKey = args[++i];
|
|
106
109
|
break;
|
|
@@ -124,13 +127,15 @@ USAGE
|
|
|
124
127
|
|
|
125
128
|
OPTIONS
|
|
126
129
|
--config <path> Path to MCP config file (default: auto-detect)
|
|
130
|
+
--policy <file> Custom policy JSON file (default: restricted)
|
|
131
|
+
Auto-detects policy.json in current directory
|
|
127
132
|
--api-key <key> SolonGate API key (sg_live_... or sg_test_...)
|
|
128
133
|
--all Protect all servers without prompting
|
|
129
134
|
-h, --help Show this help message
|
|
130
135
|
|
|
131
136
|
EXAMPLES
|
|
132
|
-
npx @solongate/proxy init --all
|
|
133
|
-
npx @solongate/proxy init --
|
|
137
|
+
npx @solongate/proxy init --all # Protect everything
|
|
138
|
+
npx @solongate/proxy init --all --policy policy.json # With custom policy
|
|
134
139
|
`;
|
|
135
140
|
console.log(help);
|
|
136
141
|
}
|
|
@@ -512,8 +517,26 @@ async function main() {
|
|
|
512
517
|
console.log(" Invalid API key format. Must start with sg_live_ or sg_test_");
|
|
513
518
|
process.exit(1);
|
|
514
519
|
}
|
|
520
|
+
let policyValue = "restricted";
|
|
521
|
+
if (options.policy) {
|
|
522
|
+
const policyPath = resolve(options.policy);
|
|
523
|
+
if (existsSync(policyPath)) {
|
|
524
|
+
policyValue = `./${options.policy}`;
|
|
525
|
+
console.log(` Policy: ${policyPath}`);
|
|
526
|
+
} else {
|
|
527
|
+
console.log(` Policy file not found: ${options.policy}`);
|
|
528
|
+
process.exit(1);
|
|
529
|
+
}
|
|
530
|
+
} else {
|
|
531
|
+
const defaultPolicy = resolve("policy.json");
|
|
532
|
+
if (existsSync(defaultPolicy)) {
|
|
533
|
+
policyValue = "./policy.json";
|
|
534
|
+
console.log(` Policy: ${defaultPolicy} (auto-detected)`);
|
|
535
|
+
} else {
|
|
536
|
+
console.log(` Policy: restricted (default)`);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
515
539
|
await sleep(300);
|
|
516
|
-
console.log(` Policy: restricted`);
|
|
517
540
|
await sleep(150);
|
|
518
541
|
console.log(` API Key: ${apiKey.slice(0, 12)}...${apiKey.slice(-4)}`);
|
|
519
542
|
await sleep(150);
|
|
@@ -522,7 +545,7 @@ async function main() {
|
|
|
522
545
|
const newConfig = { mcpServers: {} };
|
|
523
546
|
for (const name of serverNames) {
|
|
524
547
|
if (toProtect.includes(name)) {
|
|
525
|
-
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name]);
|
|
548
|
+
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], policyValue);
|
|
526
549
|
} else {
|
|
527
550
|
newConfig.mcpServers[name] = config.mcpServers[name];
|
|
528
551
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
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": {
|