@solongate/proxy 0.30.1 → 0.31.0
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 +35 -4
- package/dist/init.js +32 -3
- package/dist/lib.js +3 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -534,13 +534,16 @@ function isAlreadyProtected(server) {
|
|
|
534
534
|
}
|
|
535
535
|
return false;
|
|
536
536
|
}
|
|
537
|
-
function wrapServer(serverName, server, policy) {
|
|
537
|
+
function wrapServer(serverName, server, policy, agentName) {
|
|
538
538
|
const env = { ...server.env ?? {} };
|
|
539
539
|
env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
|
|
540
540
|
const proxyArgs = ["-y", "@solongate/proxy@latest"];
|
|
541
541
|
if (policy) {
|
|
542
542
|
proxyArgs.push("--policy", policy);
|
|
543
543
|
}
|
|
544
|
+
if (agentName) {
|
|
545
|
+
proxyArgs.push("--agent-name", agentName);
|
|
546
|
+
}
|
|
544
547
|
proxyArgs.push("--verbose", "--", server.command, ...server.args ?? []);
|
|
545
548
|
return {
|
|
546
549
|
command: "npx",
|
|
@@ -814,8 +817,22 @@ function installCursorConfig(clientDir, guardCmd, auditCmd, _stopCmd, wrappedMcp
|
|
|
814
817
|
changed = true;
|
|
815
818
|
}
|
|
816
819
|
if (wrappedMcpConfig) {
|
|
820
|
+
const cursorMcpConfig = { mcpServers: {} };
|
|
821
|
+
for (const [name, server] of Object.entries(wrappedMcpConfig.mcpServers)) {
|
|
822
|
+
const args = [...server.args ?? []];
|
|
823
|
+
const agentIdx = args.indexOf("--agent-name");
|
|
824
|
+
if (agentIdx >= 0 && agentIdx + 1 < args.length) {
|
|
825
|
+
args[agentIdx + 1] = "cursor";
|
|
826
|
+
} else {
|
|
827
|
+
const sepIdx = args.indexOf("--");
|
|
828
|
+
if (sepIdx >= 0) {
|
|
829
|
+
args.splice(sepIdx, 0, "--agent-name", "cursor");
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
cursorMcpConfig.mcpServers[name] = { ...server, args };
|
|
833
|
+
}
|
|
817
834
|
const mcpPath = join(clientDir, "mcp.json");
|
|
818
|
-
const mcpStr = JSON.stringify(
|
|
835
|
+
const mcpStr = JSON.stringify(cursorMcpConfig, null, 2) + "\n";
|
|
819
836
|
const existingMcp = existsSync4(mcpPath) ? readFileSync4(mcpPath, "utf-8") : "";
|
|
820
837
|
if (mcpStr !== existingMcp) {
|
|
821
838
|
writeFileSync2(mcpPath, mcpStr);
|
|
@@ -846,7 +863,19 @@ function installGeminiConfig(clientDir, guardCmd, auditCmd, _stopCmd, wrappedMcp
|
|
|
846
863
|
}
|
|
847
864
|
const merged = { ...existing };
|
|
848
865
|
if (wrappedMcpConfig) {
|
|
849
|
-
|
|
866
|
+
const geminiMcp = {};
|
|
867
|
+
for (const [name, server] of Object.entries(wrappedMcpConfig.mcpServers)) {
|
|
868
|
+
const args = [...server.args ?? []];
|
|
869
|
+
const agentIdx = args.indexOf("--agent-name");
|
|
870
|
+
if (agentIdx >= 0 && agentIdx + 1 < args.length) {
|
|
871
|
+
args[agentIdx + 1] = "gemini-cli";
|
|
872
|
+
} else {
|
|
873
|
+
const sepIdx = args.indexOf("--");
|
|
874
|
+
if (sepIdx >= 0) args.splice(sepIdx, 0, "--agent-name", "gemini-cli");
|
|
875
|
+
}
|
|
876
|
+
geminiMcp[name] = { ...server, args };
|
|
877
|
+
}
|
|
878
|
+
merged.mcpServers = geminiMcp;
|
|
850
879
|
}
|
|
851
880
|
merged.hooks = {
|
|
852
881
|
BeforeTool: [
|
|
@@ -6220,11 +6249,13 @@ var SolonGateProxy = class {
|
|
|
6220
6249
|
if (this.server) {
|
|
6221
6250
|
const clientVersion = this.server.getClientVersion();
|
|
6222
6251
|
log2(`MCP clientInfo raw: ${JSON.stringify(clientVersion)}`);
|
|
6223
|
-
if (clientVersion?.name) {
|
|
6252
|
+
if (clientVersion?.name && !this.config.agentName) {
|
|
6224
6253
|
const normalized = this.normalizeAgentName(clientVersion.name);
|
|
6225
6254
|
this.agentId = normalized.id;
|
|
6226
6255
|
this.agentName = normalized.name;
|
|
6227
6256
|
log2(`Agent identified from MCP clientInfo: ${this.agentName} (raw: ${clientVersion.name})`);
|
|
6257
|
+
} else if (this.config.agentName) {
|
|
6258
|
+
log2(`Agent identity from --agent-name flag: ${this.agentName} (clientInfo: ${clientVersion?.name || "none"})`);
|
|
6228
6259
|
}
|
|
6229
6260
|
}
|
|
6230
6261
|
};
|
package/dist/init.js
CHANGED
|
@@ -118,13 +118,16 @@ function isAlreadyProtected(server) {
|
|
|
118
118
|
}
|
|
119
119
|
return false;
|
|
120
120
|
}
|
|
121
|
-
function wrapServer(serverName, server, policy) {
|
|
121
|
+
function wrapServer(serverName, server, policy, agentName) {
|
|
122
122
|
const env = { ...server.env ?? {} };
|
|
123
123
|
env.SOLONGATE_API_KEY = "${SOLONGATE_API_KEY}";
|
|
124
124
|
const proxyArgs = ["-y", "@solongate/proxy@latest"];
|
|
125
125
|
if (policy) {
|
|
126
126
|
proxyArgs.push("--policy", policy);
|
|
127
127
|
}
|
|
128
|
+
if (agentName) {
|
|
129
|
+
proxyArgs.push("--agent-name", agentName);
|
|
130
|
+
}
|
|
128
131
|
proxyArgs.push("--verbose", "--", server.command, ...server.args ?? []);
|
|
129
132
|
return {
|
|
130
133
|
command: "npx",
|
|
@@ -400,8 +403,22 @@ function installCursorConfig(clientDir, guardCmd, auditCmd, _stopCmd, wrappedMcp
|
|
|
400
403
|
changed = true;
|
|
401
404
|
}
|
|
402
405
|
if (wrappedMcpConfig) {
|
|
406
|
+
const cursorMcpConfig = { mcpServers: {} };
|
|
407
|
+
for (const [name, server] of Object.entries(wrappedMcpConfig.mcpServers)) {
|
|
408
|
+
const args = [...server.args ?? []];
|
|
409
|
+
const agentIdx = args.indexOf("--agent-name");
|
|
410
|
+
if (agentIdx >= 0 && agentIdx + 1 < args.length) {
|
|
411
|
+
args[agentIdx + 1] = "cursor";
|
|
412
|
+
} else {
|
|
413
|
+
const sepIdx = args.indexOf("--");
|
|
414
|
+
if (sepIdx >= 0) {
|
|
415
|
+
args.splice(sepIdx, 0, "--agent-name", "cursor");
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
cursorMcpConfig.mcpServers[name] = { ...server, args };
|
|
419
|
+
}
|
|
403
420
|
const mcpPath = join(clientDir, "mcp.json");
|
|
404
|
-
const mcpStr = JSON.stringify(
|
|
421
|
+
const mcpStr = JSON.stringify(cursorMcpConfig, null, 2) + "\n";
|
|
405
422
|
const existingMcp = existsSync(mcpPath) ? readFileSync(mcpPath, "utf-8") : "";
|
|
406
423
|
if (mcpStr !== existingMcp) {
|
|
407
424
|
writeFileSync(mcpPath, mcpStr);
|
|
@@ -432,7 +449,19 @@ function installGeminiConfig(clientDir, guardCmd, auditCmd, _stopCmd, wrappedMcp
|
|
|
432
449
|
}
|
|
433
450
|
const merged = { ...existing };
|
|
434
451
|
if (wrappedMcpConfig) {
|
|
435
|
-
|
|
452
|
+
const geminiMcp = {};
|
|
453
|
+
for (const [name, server] of Object.entries(wrappedMcpConfig.mcpServers)) {
|
|
454
|
+
const args = [...server.args ?? []];
|
|
455
|
+
const agentIdx = args.indexOf("--agent-name");
|
|
456
|
+
if (agentIdx >= 0 && agentIdx + 1 < args.length) {
|
|
457
|
+
args[agentIdx + 1] = "gemini-cli";
|
|
458
|
+
} else {
|
|
459
|
+
const sepIdx = args.indexOf("--");
|
|
460
|
+
if (sepIdx >= 0) args.splice(sepIdx, 0, "--agent-name", "gemini-cli");
|
|
461
|
+
}
|
|
462
|
+
geminiMcp[name] = { ...server, args };
|
|
463
|
+
}
|
|
464
|
+
merged.mcpServers = geminiMcp;
|
|
436
465
|
}
|
|
437
466
|
merged.hooks = {
|
|
438
467
|
BeforeTool: [
|
package/dist/lib.js
CHANGED
|
@@ -4460,11 +4460,13 @@ var SolonGateProxy = class {
|
|
|
4460
4460
|
if (this.server) {
|
|
4461
4461
|
const clientVersion = this.server.getClientVersion();
|
|
4462
4462
|
log2(`MCP clientInfo raw: ${JSON.stringify(clientVersion)}`);
|
|
4463
|
-
if (clientVersion?.name) {
|
|
4463
|
+
if (clientVersion?.name && !this.config.agentName) {
|
|
4464
4464
|
const normalized = this.normalizeAgentName(clientVersion.name);
|
|
4465
4465
|
this.agentId = normalized.id;
|
|
4466
4466
|
this.agentName = normalized.name;
|
|
4467
4467
|
log2(`Agent identified from MCP clientInfo: ${this.agentName} (raw: ${clientVersion.name})`);
|
|
4468
|
+
} else if (this.config.agentName) {
|
|
4469
|
+
log2(`Agent identity from --agent-name flag: ${this.agentName} (clientInfo: ${clientVersion?.name || "none"})`);
|
|
4468
4470
|
}
|
|
4469
4471
|
}
|
|
4470
4472
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "AI tool security proxy — protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|