@solongate/proxy 0.5.2 → 0.5.3
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 +15 -4
- package/dist/init.js +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -128,9 +128,20 @@ function parseArgs(argv) {
|
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
+
if (apiKey && /^\$\{.+\}$/.test(apiKey)) {
|
|
132
|
+
apiKey = void 0;
|
|
133
|
+
}
|
|
134
|
+
if (!apiKey) {
|
|
135
|
+
const dotenvPath = resolve(".env");
|
|
136
|
+
if (existsSync(dotenvPath)) {
|
|
137
|
+
const dotenvContent = readFileSync(dotenvPath, "utf-8");
|
|
138
|
+
const match = dotenvContent.match(/^SOLONGATE_API_KEY=(sg_(?:live|test)_\w+)/m);
|
|
139
|
+
if (match) apiKey = match[1];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
131
142
|
if (!apiKey) {
|
|
132
143
|
const envKey = process.env.SOLONGATE_API_KEY;
|
|
133
|
-
if (envKey) {
|
|
144
|
+
if (envKey && !/^\$\{.+\}$/.test(envKey)) {
|
|
134
145
|
apiKey = envKey;
|
|
135
146
|
} else {
|
|
136
147
|
throw new Error(
|
|
@@ -569,9 +580,9 @@ function isAlreadyProtected(server) {
|
|
|
569
580
|
}
|
|
570
581
|
return false;
|
|
571
582
|
}
|
|
572
|
-
function wrapServer(server, policy
|
|
583
|
+
function wrapServer(server, policy) {
|
|
573
584
|
const env = { ...server.env ?? {} };
|
|
574
|
-
env.SOLONGATE_API_KEY =
|
|
585
|
+
env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
|
|
575
586
|
return {
|
|
576
587
|
command: "npx",
|
|
577
588
|
args: [
|
|
@@ -898,7 +909,7 @@ async function main() {
|
|
|
898
909
|
const newConfig = { mcpServers: {} };
|
|
899
910
|
for (const name of serverNames) {
|
|
900
911
|
if (toProtect.includes(name)) {
|
|
901
|
-
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], options.policy
|
|
912
|
+
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], options.policy);
|
|
902
913
|
} else {
|
|
903
914
|
newConfig.mcpServers[name] = config.mcpServers[name];
|
|
904
915
|
}
|
package/dist/init.js
CHANGED
|
@@ -65,9 +65,9 @@ function isAlreadyProtected(server) {
|
|
|
65
65
|
}
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
|
-
function wrapServer(server, policy
|
|
68
|
+
function wrapServer(server, policy) {
|
|
69
69
|
const env = { ...server.env ?? {} };
|
|
70
|
-
env.SOLONGATE_API_KEY =
|
|
70
|
+
env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
|
|
71
71
|
return {
|
|
72
72
|
command: "npx",
|
|
73
73
|
args: [
|
|
@@ -600,7 +600,7 @@ async function main() {
|
|
|
600
600
|
const newConfig = { mcpServers: {} };
|
|
601
601
|
for (const name of serverNames) {
|
|
602
602
|
if (toProtect.includes(name)) {
|
|
603
|
-
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], options.policy
|
|
603
|
+
newConfig.mcpServers[name] = wrapServer(config.mcpServers[name], options.policy);
|
|
604
604
|
} else {
|
|
605
605
|
newConfig.mcpServers[name] = config.mcpServers[name];
|
|
606
606
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
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": {
|