@solongate/proxy 0.2.0 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +15 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3495,11 +3495,25 @@ var SolonGateProxy = class {
3495
3495
  if (this.config.apiKey && !this.config.apiKey.startsWith("sg_test_")) {
3496
3496
  const apiUrl = this.config.apiUrl ?? "https://api.solongate.com";
3497
3497
  log(`Sending audit log: ${name} \u2192 ${decision} (key: ${this.config.apiKey.slice(0, 16)}...)`);
3498
+ let reason = "allowed";
3499
+ let matchedRule;
3500
+ if (result.isError) {
3501
+ const rawText = result.content[0]?.text ?? "denied";
3502
+ try {
3503
+ const parsed = JSON.parse(rawText);
3504
+ reason = parsed.message ?? rawText;
3505
+ const ruleMatch = reason.match(/^Matched rule "([^"]+)":/);
3506
+ if (ruleMatch) matchedRule = ruleMatch[1];
3507
+ } catch {
3508
+ reason = rawText;
3509
+ }
3510
+ }
3498
3511
  sendAuditLog(this.config.apiKey, apiUrl, {
3499
3512
  tool: name,
3500
3513
  arguments: args ?? {},
3501
3514
  decision,
3502
- reason: result.isError ? result.content[0]?.text ?? "denied" : "allowed",
3515
+ reason,
3516
+ matchedRule,
3503
3517
  evaluationTimeMs
3504
3518
  });
3505
3519
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "MCP security proxy \u00e2\u20ac\u201d protect any MCP server with policies, input validation, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {