mcp-researchpowerpack 7.1.1 → 7.1.2

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/README.md CHANGED
@@ -90,7 +90,7 @@ capability with a clear error at call time.
90
90
  | `HOST` | `127.0.0.1` | bind address; cloud runtimes that set `PORT` auto-switch to `0.0.0.0`. public binds require `ALLOWED_ORIGINS`, `MCP_URL`, or `CSP_URLS` |
91
91
  | `ALLOWED_ORIGINS` | unset | comma-separated origins for host validation / cors; merged with `MCP_URL` and platform `CSP_URLS` when present |
92
92
  | `MCP_URL` | unset | public mcp url; contributes its origin to host validation and well-known resource urls |
93
- | `CSP_URLS` | unset | platform-provided comma-separated public origins; also contributes to host validation |
93
+ | `CSP_URLS` | unset | platform-provided comma-separated public origins; also contributes to host validation, including the derived mcp-use `--br-main` host |
94
94
  | `NODE_ENV` | unset | `production` also requires `ALLOWED_ORIGINS`, `MCP_URL`, or `CSP_URLS`, even on a local bind |
95
95
  | `DEBUG` | unset | `1` or `2` to bump mcp-use debug verbosity |
96
96
 
package/dist/index.js CHANGED
@@ -5228,18 +5228,35 @@ function normalizeOrigin(value, envName) {
5228
5228
  throw new Error(`${envName} must contain absolute URLs with protocol. Received: ${value}`);
5229
5229
  }
5230
5230
  }
5231
+ function expandMcpUseMainBranchOrigin(origin) {
5232
+ const parsed = new URL(origin);
5233
+ const hostname = parsed.hostname.toLowerCase();
5234
+ const suffix = ".run.mcp-use.com";
5235
+ if (!hostname.endsWith(suffix) || hostname.includes("--br-")) {
5236
+ return [origin];
5237
+ }
5238
+ const slug = hostname.slice(0, -suffix.length);
5239
+ const branchOrigin = `${parsed.protocol}//${slug}--br-main${suffix}${parsed.port ? `:${parsed.port}` : ""}`;
5240
+ return [origin, branchOrigin];
5241
+ }
5242
+ function appendNormalizedOrigins(target, values, envName) {
5243
+ for (const value of values) {
5244
+ const origin = normalizeOrigin(value, envName);
5245
+ target.push(...expandMcpUseMainBranchOrigin(origin));
5246
+ }
5247
+ }
5231
5248
  function resolveAllowedOrigins(baseUrl) {
5232
5249
  const origins = [];
5233
5250
  const explicitOrigins = parseCsvEnv(process.env.ALLOWED_ORIGINS);
5234
5251
  if (explicitOrigins && explicitOrigins.length > 0) {
5235
- origins.push(...explicitOrigins.map((origin) => normalizeOrigin(origin, "ALLOWED_ORIGINS")));
5252
+ appendNormalizedOrigins(origins, explicitOrigins, "ALLOWED_ORIGINS");
5236
5253
  }
5237
5254
  if (baseUrl) {
5238
- origins.push(normalizeOrigin(baseUrl, "MCP_URL"));
5255
+ appendNormalizedOrigins(origins, [baseUrl], "MCP_URL");
5239
5256
  }
5240
5257
  const cspUrls = parseCsvEnv(process.env.CSP_URLS);
5241
5258
  if (cspUrls && cspUrls.length > 0) {
5242
- origins.push(...cspUrls.map((origin) => normalizeOrigin(origin, "CSP_URLS")));
5259
+ appendNormalizedOrigins(origins, cspUrls, "CSP_URLS");
5243
5260
  }
5244
5261
  const uniqueOrigins = [...new Set(origins)];
5245
5262
  return uniqueOrigins.length > 0 ? uniqueOrigins : void 0;