@mcp-use/cli 3.2.1-canary.17 → 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.js CHANGED
@@ -7137,6 +7137,16 @@ A new release of ${source_default.bold(PACKAGE_NAME)} is available: ${source_def
7137
7137
  }
7138
7138
  }
7139
7139
 
7140
+ // src/utils/widget-paths.ts
7141
+ function getWidgetAssetBase(mcpUrl, widgetName) {
7142
+ const widgetPath = `/mcp-use/widgets/${widgetName}/`;
7143
+ if (!mcpUrl) {
7144
+ return widgetPath;
7145
+ }
7146
+ const origin = mcpUrl.replace(/\/+$/, "");
7147
+ return `${origin}${widgetPath}`;
7148
+ }
7149
+
7140
7150
  // src/index.ts
7141
7151
  var program = new Command7();
7142
7152
  var packageContent = readFileSync2(
@@ -7627,7 +7637,7 @@ if (container && Component) {
7627
7637
  "widgets",
7628
7638
  widgetName
7629
7639
  );
7630
- const baseUrl = mcpUrl ? `${mcpUrl}/${widgetName}/` : `/mcp-use/widgets/${widgetName}/`;
7640
+ const baseUrl = getWidgetAssetBase(mcpUrl, widgetName);
7631
7641
  let widgetMetadata = {};
7632
7642
  try {
7633
7643
  const metadataTempDir = path11.join(
@@ -7943,7 +7953,9 @@ export default {
7943
7953
  try {
7944
7954
  const htmlPath = path11.join(outDir, "index.html");
7945
7955
  let html = await fs11.readFile(htmlPath, "utf8");
7946
- const injectionScript = `<script>window.__getFile = (filename) => { return "${mcpUrl}/${widgetName}/"+filename }; window.__mcpPublicUrl = "${mcpServerUrl}/mcp-use/public"; window.__mcpPublicAssetsUrl = "${mcpUrl}/public";</script>`;
7956
+ const widgetAssetBase = getWidgetAssetBase(mcpUrl, widgetName);
7957
+ const mcpOrigin = mcpUrl ? mcpUrl.replace(/\/+$/, "") : mcpServerUrl;
7958
+ const injectionScript = `<script>window.__getFile = (filename) => { return "${widgetAssetBase}"+filename }; window.__mcpPublicUrl = "${mcpServerUrl}/mcp-use/public"; window.__mcpPublicAssetsUrl = "${mcpOrigin}/mcp-use/public";</script>`;
7947
7959
  if (!html.includes("window.__mcpPublicUrl")) {
7948
7960
  html = html.replace(
7949
7961
  /<head[^>]*>/i,