mcp-researchpowerpack 7.1.0 → 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
@@ -87,10 +87,11 @@ capability with a clear error at call time.
87
87
  | var | default | |
88
88
  |-----|---------|---|
89
89
  | `PORT` | `3000` | http port |
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` or `MCP_URL` |
91
- | `ALLOWED_ORIGINS` | unset | comma-separated origins for host validation / cors |
92
- | `MCP_URL` | unset | public mcp url; when `ALLOWED_ORIGINS` is absent, the server derives the allowed origin and well-known resource urls from this value |
93
- | `NODE_ENV` | unset | `production` also requires `ALLOWED_ORIGINS` or `MCP_URL`, even on a local bind |
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
+ | `ALLOWED_ORIGINS` | unset | comma-separated origins for host validation / cors; merged with `MCP_URL` and platform `CSP_URLS` when present |
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, including the derived mcp-use `--br-main` host |
94
+ | `NODE_ENV` | unset | `production` also requires `ALLOWED_ORIGINS`, `MCP_URL`, or `CSP_URLS`, even on a local bind |
94
95
  | `DEBUG` | unset | `1` or `2` to bump mcp-use debug verbosity |
95
96
 
96
97
  ### providers
package/dist/index.js CHANGED
@@ -5228,15 +5228,38 @@ 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) {
5249
+ const origins = [];
5232
5250
  const explicitOrigins = parseCsvEnv(process.env.ALLOWED_ORIGINS);
5233
5251
  if (explicitOrigins && explicitOrigins.length > 0) {
5234
- return explicitOrigins.map((origin) => normalizeOrigin(origin, "ALLOWED_ORIGINS"));
5252
+ appendNormalizedOrigins(origins, explicitOrigins, "ALLOWED_ORIGINS");
5235
5253
  }
5236
5254
  if (baseUrl) {
5237
- return [normalizeOrigin(baseUrl, "MCP_URL")];
5255
+ appendNormalizedOrigins(origins, [baseUrl], "MCP_URL");
5238
5256
  }
5239
- return void 0;
5257
+ const cspUrls = parseCsvEnv(process.env.CSP_URLS);
5258
+ if (cspUrls && cspUrls.length > 0) {
5259
+ appendNormalizedOrigins(origins, cspUrls, "CSP_URLS");
5260
+ }
5261
+ const uniqueOrigins = [...new Set(origins)];
5262
+ return uniqueOrigins.length > 0 ? uniqueOrigins : void 0;
5240
5263
  }
5241
5264
  function isLoopbackHost(host) {
5242
5265
  const normalized = host.trim().toLowerCase();
@@ -5317,7 +5340,7 @@ async function main() {
5317
5340
  startupLogger.info(`Host validation enabled for origins: ${allowedOriginList.join(", ")}`);
5318
5341
  } else if (isProduction || isPublicBindHost(host)) {
5319
5342
  startupLogger.error(
5320
- "Public or production HTTP binding requires ALLOWED_ORIGINS or MCP_URL to be set. Without host validation, the server is vulnerable to DNS rebinding attacks. Set ALLOWED_ORIGINS or MCP_URL to the public deployment URL or custom domain."
5343
+ "Public or production HTTP binding requires ALLOWED_ORIGINS, MCP_URL, or CSP_URLS to be set. Without host validation, the server is vulnerable to DNS rebinding attacks. Set ALLOWED_ORIGINS, MCP_URL, or CSP_URLS to the public deployment URL or custom domain."
5321
5344
  );
5322
5345
  process.exit(1);
5323
5346
  } else {