@solongate/proxy 0.6.7 → 0.6.8

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 +16 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ function parseArgs(argv) {
88
88
  let upstreamUrl;
89
89
  let upstreamTransport;
90
90
  let port;
91
+ let policyId;
91
92
  let separatorIndex = args.indexOf("--");
92
93
  const flags = separatorIndex >= 0 ? args.slice(0, separatorIndex) : args;
93
94
  const upstreamArgs = separatorIndex >= 0 ? args.slice(separatorIndex + 1) : [];
@@ -126,6 +127,10 @@ function parseArgs(argv) {
126
127
  case "--port":
127
128
  port = parseInt(flags[++i], 10);
128
129
  break;
130
+ case "--policy-id":
131
+ case "--id":
132
+ policyId = flags[++i];
133
+ break;
129
134
  }
130
135
  }
131
136
  if (apiKey && /^\$\{.+\}$/.test(apiKey)) {
@@ -173,7 +178,8 @@ function parseArgs(argv) {
173
178
  apiKey: apiKey ?? fileConfig.apiKey,
174
179
  apiUrl: apiUrl ?? fileConfig.apiUrl,
175
180
  port: port ?? fileConfig.port,
176
- policyPath: resolvePolicyPath(cfgPolicySource) ?? void 0
181
+ policyPath: resolvePolicyPath(cfgPolicySource) ?? void 0,
182
+ policyId: policyId ?? fileConfig.policyId
177
183
  };
178
184
  }
179
185
  if (upstreamUrl) {
@@ -193,7 +199,8 @@ function parseArgs(argv) {
193
199
  apiKey,
194
200
  apiUrl,
195
201
  port,
196
- policyPath: resolvedPolicyPath ?? void 0
202
+ policyPath: resolvedPolicyPath ?? void 0,
203
+ policyId
197
204
  };
198
205
  }
199
206
  if (upstreamArgs.length === 0) {
@@ -217,7 +224,8 @@ function parseArgs(argv) {
217
224
  apiKey,
218
225
  apiUrl,
219
226
  port,
220
- policyPath: resolvedPolicyPath ?? void 0
227
+ policyPath: resolvedPolicyPath ?? void 0,
228
+ policyId
221
229
  };
222
230
  }
223
231
  function resolvePolicyPath(source) {
@@ -3736,10 +3744,12 @@ var PolicySyncManager = class {
3736
3744
  pollTimer = null;
3737
3745
  watcher = null;
3738
3746
  isLiveKey;
3747
+ policyId;
3739
3748
  constructor(opts) {
3740
3749
  this.localPath = opts.localPath;
3741
3750
  this.apiKey = opts.apiKey;
3742
3751
  this.apiUrl = opts.apiUrl;
3752
+ this.policyId = opts.policyId;
3743
3753
  this.pollIntervalMs = opts.pollIntervalMs ?? 6e4;
3744
3754
  this.onPolicyUpdate = opts.onPolicyUpdate;
3745
3755
  this.currentPolicy = opts.initialPolicy;
@@ -3841,7 +3851,7 @@ var PolicySyncManager = class {
3841
3851
  */
3842
3852
  async onPollTick() {
3843
3853
  try {
3844
- const cloudPolicy = await fetchCloudPolicy(this.apiKey, this.apiUrl);
3854
+ const cloudPolicy = await fetchCloudPolicy(this.apiKey, this.apiUrl, this.policyId);
3845
3855
  const cloudVer = cloudPolicy.version ?? 0;
3846
3856
  if (cloudVer <= this.localVersion && this.policiesEqual(cloudPolicy, this.currentPolicy)) {
3847
3857
  return;
@@ -3995,7 +4005,7 @@ var SolonGateProxy = class {
3995
4005
  }
3996
4006
  if (!this.config.apiKey.startsWith("sg_test_")) {
3997
4007
  try {
3998
- const cloudPolicy = await fetchCloudPolicy(this.config.apiKey, apiUrl);
4008
+ const cloudPolicy = await fetchCloudPolicy(this.config.apiKey, apiUrl, this.config.policyId);
3999
4009
  this.config.policy = cloudPolicy;
4000
4010
  log2(`Loaded cloud policy: ${cloudPolicy.name} (${cloudPolicy.rules.length} rules)`);
4001
4011
  } catch (err) {
@@ -4310,6 +4320,7 @@ var SolonGateProxy = class {
4310
4320
  apiUrl,
4311
4321
  pollIntervalMs: 6e4,
4312
4322
  initialPolicy: this.config.policy,
4323
+ policyId: this.config.policyId,
4313
4324
  onPolicyUpdate: (policy) => {
4314
4325
  this.config.policy = policy;
4315
4326
  this.gate.loadPolicy(policy);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.6.7",
3
+ "version": "0.6.8",
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": {