@ai-ecoverse/mcpcat 0.17.10 → 0.17.11

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.
@@ -13284,23 +13284,29 @@ function resolveProxyUrl(target, headers, version) {
13284
13284
  const url = target.startsWith("http") ? target : `https://${target}`;
13285
13285
  return { url, headers, version };
13286
13286
  }
13287
+ function unsetIn(header, value, env) {
13288
+ const missing = missingPlaceholders(value, env);
13289
+ if (missing.length === 0) return void 0;
13290
+ return `unset variable ${missing.join(", ")} in header '${header}'`;
13291
+ }
13292
+ function hide(hidden, template, expanded, env) {
13293
+ if (template) hidden.add(template);
13294
+ if (expanded) hidden.add(expanded);
13295
+ for (const p of placeholderValues(template, env)) hidden.add(p);
13296
+ }
13287
13297
  async function resolveProxyConfig(platform2, target, connectHeaders, hiddenValues, version) {
13288
13298
  const config = await MergedConfigSource.load(platform2);
13289
13299
  const entry = await config.get(target);
13290
13300
  if (!entry) return `unknown target '${target}'`;
13291
13301
  if ("url" in entry && entry.url) {
13292
- const expanded = expandHeaders(entry.headers, platform2.env, (msg) => {
13293
- platform2.write(2, `mcpcat serve --proxy: warning: ${msg}
13294
- `).catch(() => {
13295
- });
13296
- });
13297
- const merged = { ...expanded, ...connectHeaders };
13298
- if (entry.headers) {
13299
- for (const v of Object.values(entry.headers)) {
13300
- hiddenValues.add(v);
13301
- for (const p of placeholderValues(v, platform2.env)) hiddenValues.add(p);
13302
- }
13302
+ const expanded = {};
13303
+ for (const [k, v] of Object.entries(entry.headers ?? {})) {
13304
+ const missing = unsetIn(k, v, platform2.env);
13305
+ if (missing) return missing;
13306
+ expanded[k] = expandPlaceholders(v, platform2.env);
13307
+ hide(hiddenValues, v, expanded[k], platform2.env);
13303
13308
  }
13309
+ const merged = { ...expanded, ...connectHeaders };
13304
13310
  return { url: entry.url, headers: merged, version };
13305
13311
  }
13306
13312
  if ("command" in entry && entry.command) {
@@ -13319,12 +13325,12 @@ async function buildProxyConnectOpts(platform2, options, version) {
13319
13325
  const connectHeaders = {};
13320
13326
  const hiddenValues = /* @__PURE__ */ new Set();
13321
13327
  for (const [k, v] of options.proxyHeaders) {
13322
- const expanded = expandPlaceholdersStrict(v, platform2.env);
13323
- if (expanded === void 0) return { error: `unset variable in header '${k}'` };
13328
+ const missing = unsetIn(k, v, platform2.env);
13329
+ if (missing) return { error: missing };
13330
+ const expanded = expandPlaceholders(v, platform2.env);
13324
13331
  const key = k.toLowerCase() === "authorization" ? "Authorization" : k;
13325
13332
  connectHeaders[key] = expanded;
13326
- hiddenValues.add(expanded);
13327
- for (const p of placeholderValues(v, platform2.env)) hiddenValues.add(p);
13333
+ hide(hiddenValues, v, expanded, platform2.env);
13328
13334
  }
13329
13335
  const isUrl = target.startsWith("http://") || target.startsWith("https://") || target.includes(".");
13330
13336
  let connectOpts;
@@ -17072,5 +17078,5 @@ try {
17072
17078
  });
17073
17079
  } catch {
17074
17080
  }
17075
- var code = await run(platform, "0.17.10", args);
17081
+ var code = await run(platform, "0.17.11", args);
17076
17082
  process.exit(code);
@@ -12905,23 +12905,29 @@ function resolveProxyUrl(target, headers, version) {
12905
12905
  const url = target.startsWith("http") ? target : `https://${target}`;
12906
12906
  return { url, headers, version };
12907
12907
  }
12908
+ function unsetIn(header, value, env2) {
12909
+ const missing = missingPlaceholders(value, env2);
12910
+ if (missing.length === 0) return void 0;
12911
+ return `unset variable ${missing.join(", ")} in header '${header}'`;
12912
+ }
12913
+ function hide(hidden, template, expanded, env2) {
12914
+ if (template) hidden.add(template);
12915
+ if (expanded) hidden.add(expanded);
12916
+ for (const p of placeholderValues(template, env2)) hidden.add(p);
12917
+ }
12908
12918
  async function resolveProxyConfig(platform2, target, connectHeaders, hiddenValues, version) {
12909
12919
  const config = await MergedConfigSource.load(platform2);
12910
12920
  const entry = await config.get(target);
12911
12921
  if (!entry) return `unknown target '${target}'`;
12912
12922
  if ("url" in entry && entry.url) {
12913
- const expanded = expandHeaders(entry.headers, platform2.env, (msg) => {
12914
- platform2.write(2, `mcpcat serve --proxy: warning: ${msg}
12915
- `).catch(() => {
12916
- });
12917
- });
12918
- const merged = { ...expanded, ...connectHeaders };
12919
- if (entry.headers) {
12920
- for (const v of Object.values(entry.headers)) {
12921
- hiddenValues.add(v);
12922
- for (const p of placeholderValues(v, platform2.env)) hiddenValues.add(p);
12923
- }
12923
+ const expanded = {};
12924
+ for (const [k, v] of Object.entries(entry.headers ?? {})) {
12925
+ const missing = unsetIn(k, v, platform2.env);
12926
+ if (missing) return missing;
12927
+ expanded[k] = expandPlaceholders(v, platform2.env);
12928
+ hide(hiddenValues, v, expanded[k], platform2.env);
12924
12929
  }
12930
+ const merged = { ...expanded, ...connectHeaders };
12925
12931
  return { url: entry.url, headers: merged, version };
12926
12932
  }
12927
12933
  if ("command" in entry && entry.command) {
@@ -12940,12 +12946,12 @@ async function buildProxyConnectOpts(platform2, options, version) {
12940
12946
  const connectHeaders = {};
12941
12947
  const hiddenValues = /* @__PURE__ */ new Set();
12942
12948
  for (const [k, v] of options.proxyHeaders) {
12943
- const expanded = expandPlaceholdersStrict(v, platform2.env);
12944
- if (expanded === void 0) return { error: `unset variable in header '${k}'` };
12949
+ const missing = unsetIn(k, v, platform2.env);
12950
+ if (missing) return { error: missing };
12951
+ const expanded = expandPlaceholders(v, platform2.env);
12945
12952
  const key = k.toLowerCase() === "authorization" ? "Authorization" : k;
12946
12953
  connectHeaders[key] = expanded;
12947
- hiddenValues.add(expanded);
12948
- for (const p of placeholderValues(v, platform2.env)) hiddenValues.add(p);
12954
+ hide(hiddenValues, v, expanded, platform2.env);
12949
12955
  }
12950
12956
  const isUrl = target.startsWith("http://") || target.startsWith("https://") || target.includes(".");
12951
12957
  let connectOpts;
@@ -16794,7 +16800,7 @@ async function main(ctx) {
16794
16800
  packageDir: "/node_modules/@ai-ecoverse/mcpcat"
16795
16801
  });
16796
16802
  const args = ctx.argv.slice(1);
16797
- return run(platform2, "0.17.10", args);
16803
+ return run(platform2, "0.17.11", args);
16798
16804
  }
16799
16805
  export {
16800
16806
  main as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/mcpcat",
3
- "version": "0.17.10",
3
+ "version": "0.17.11",
4
4
  "description": "A curl for the Model Context Protocol",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -63,7 +63,7 @@
63
63
  "devDependencies": {
64
64
  "@ai-ecoverse/slicc-bios": "1.38.0",
65
65
  "@ai-ecoverse/slicc-kernel": "1.142.1",
66
- "@ai-ecoverse/slicc-shared-web": "1.29.13",
66
+ "@ai-ecoverse/slicc-shared-web": "1.29.16",
67
67
  "@biomejs/biome": "2.5.15",
68
68
  "@earendil-works/pi-codemode": "1.2.0",
69
69
  "@earendil-works/pi-mcp": "1.2.0",