@mcp-use/cli 3.2.1-canary.16 → 3.2.1-canary.18

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/dist/index.cjs CHANGED
@@ -7152,6 +7152,16 @@ A new release of ${source_default.bold(PACKAGE_NAME)} is available: ${source_def
7152
7152
  }
7153
7153
  }
7154
7154
 
7155
+ // src/utils/widget-paths.ts
7156
+ function getWidgetAssetBase(mcpUrl, widgetName) {
7157
+ const widgetPath = `/mcp-use/widgets/${widgetName}/`;
7158
+ if (!mcpUrl) {
7159
+ return widgetPath;
7160
+ }
7161
+ const origin = mcpUrl.replace(/\/+$/, "");
7162
+ return `${origin}${widgetPath}`;
7163
+ }
7164
+
7155
7165
  // src/index.ts
7156
7166
  var program = new import_commander7.Command();
7157
7167
  var packageContent = (0, import_node_fs14.readFileSync)(
@@ -7642,7 +7652,7 @@ if (container && Component) {
7642
7652
  "widgets",
7643
7653
  widgetName
7644
7654
  );
7645
- const baseUrl = mcpUrl ? `${mcpUrl}/${widgetName}/` : `/mcp-use/widgets/${widgetName}/`;
7655
+ const baseUrl = getWidgetAssetBase(mcpUrl, widgetName);
7646
7656
  let widgetMetadata = {};
7647
7657
  try {
7648
7658
  const metadataTempDir = import_node_path12.default.join(
@@ -7958,7 +7968,9 @@ export default {
7958
7968
  try {
7959
7969
  const htmlPath = import_node_path12.default.join(outDir, "index.html");
7960
7970
  let html = await fs11.readFile(htmlPath, "utf8");
7961
- const injectionScript = `<script>window.__getFile = (filename) => { return "${mcpUrl}/${widgetName}/"+filename }; window.__mcpPublicUrl = "${mcpServerUrl}/mcp-use/public"; window.__mcpPublicAssetsUrl = "${mcpUrl}/public";</script>`;
7971
+ const widgetAssetBase = getWidgetAssetBase(mcpUrl, widgetName);
7972
+ const mcpOrigin = mcpUrl ? mcpUrl.replace(/\/+$/, "") : mcpServerUrl;
7973
+ const injectionScript = `<script>window.__getFile = (filename) => { return "${widgetAssetBase}"+filename }; window.__mcpPublicUrl = "${mcpServerUrl}/mcp-use/public"; window.__mcpPublicAssetsUrl = "${mcpOrigin}/mcp-use/public";</script>`;
7962
7974
  if (!html.includes("window.__mcpPublicUrl")) {
7963
7975
  html = html.replace(
7964
7976
  /<head[^>]*>/i,