@mcp-use/cli 2.13.0 → 2.13.1-canary.0

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
@@ -538,7 +538,7 @@ var import_node_url = require("url");
538
538
  var import_node_child_process7 = __toESM(require("child_process"), 1);
539
539
  var import_promises3 = __toESM(require("fs/promises"), 1);
540
540
 
541
- // ../../node_modules/.pnpm/wsl-utils@0.3.0/node_modules/wsl-utils/index.js
541
+ // ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
542
542
  var import_node_util2 = require("util");
543
543
  var import_node_child_process2 = __toESM(require("child_process"), 1);
544
544
  var import_promises2 = __toESM(require("fs/promises"), 1);
@@ -648,7 +648,21 @@ executePowerShell.argumentsPrefix = [
648
648
  executePowerShell.encodeCommand = (command) => import_node_buffer.Buffer.from(command, "utf16le").toString("base64");
649
649
  executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
650
650
 
651
- // ../../node_modules/.pnpm/wsl-utils@0.3.0/node_modules/wsl-utils/index.js
651
+ // ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
652
+ function parseMountPointFromConfig(content) {
653
+ for (const line of content.split("\n")) {
654
+ if (/^\s*#/.test(line)) {
655
+ continue;
656
+ }
657
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
658
+ if (!match) {
659
+ continue;
660
+ }
661
+ return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
662
+ }
663
+ }
664
+
665
+ // ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
652
666
  var execFile2 = (0, import_node_util2.promisify)(import_node_child_process2.default.execFile);
653
667
  var wslDrivesMountPoint = /* @__PURE__ */ (() => {
654
668
  const defaultMountPoint = "/mnt/";
@@ -668,11 +682,11 @@ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
668
682
  return defaultMountPoint;
669
683
  }
670
684
  const configContent = await import_promises2.default.readFile(configFilePath, { encoding: "utf8" });
671
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
672
- if (!configMountPoint) {
685
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
686
+ if (parsedMountPoint === void 0) {
673
687
  return defaultMountPoint;
674
688
  }
675
- mountPoint = configMountPoint.groups.mountPoint.trim();
689
+ mountPoint = parsedMountPoint;
676
690
  mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
677
691
  return mountPoint;
678
692
  };
@@ -731,7 +745,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
731
745
  return object;
732
746
  }
733
747
 
734
- // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
748
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
735
749
  var import_node_util6 = require("util");
736
750
  var import_node_process6 = __toESM(require("process"), 1);
737
751
  var import_node_child_process6 = require("child_process");
@@ -778,7 +792,7 @@ async function bundleName(bundleId) {
778
792
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
779
793
  }
780
794
 
781
- // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/windows.js
795
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js
782
796
  var import_node_util5 = require("util");
783
797
  var import_node_child_process5 = require("child_process");
784
798
  var execFileAsync3 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
@@ -816,14 +830,14 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
816
830
  throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
817
831
  }
818
832
  const { id } = match.groups;
819
- const browser = windowsBrowserProgIds[id];
820
- if (!browser) {
821
- throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
822
- }
823
- return browser;
833
+ const dotIndex = id.lastIndexOf(".");
834
+ const hyphenIndex = id.lastIndexOf("-");
835
+ const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
836
+ const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
837
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
824
838
  }
825
839
 
826
- // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
840
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
827
841
  var execFileAsync4 = (0, import_node_util6.promisify)(import_node_child_process6.execFile);
828
842
  var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
829
843
  async function defaultBrowser2() {
@@ -5170,9 +5184,35 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5170
5184
  const builtWidgets = await buildWidgets(projectPath, {
5171
5185
  inline: options.inline ?? false
5172
5186
  });
5187
+ let sourceServerFile;
5188
+ try {
5189
+ sourceServerFile = await findServerFile(projectPath);
5190
+ } catch {
5191
+ }
5173
5192
  console.log(source_default.gray("Building TypeScript..."));
5174
5193
  await runCommand("npx", ["tsc"], projectPath);
5175
5194
  console.log(source_default.green("\u2713 TypeScript build complete!"));
5195
+ let entryPoint;
5196
+ if (sourceServerFile) {
5197
+ const baseName = import_node_path6.default.basename(sourceServerFile, ".ts") + ".js";
5198
+ const possibleOutputs = [
5199
+ `dist/${baseName}`,
5200
+ // rootDir set to project root or src
5201
+ `dist/src/${baseName}`,
5202
+ // no rootDir, source in src/
5203
+ `dist/${sourceServerFile.replace(/\.ts$/, ".js")}`
5204
+ // exact path preserved
5205
+ ];
5206
+ for (const candidate of possibleOutputs) {
5207
+ try {
5208
+ await (0, import_promises5.access)(import_node_path6.default.join(projectPath, candidate));
5209
+ entryPoint = candidate;
5210
+ break;
5211
+ } catch {
5212
+ continue;
5213
+ }
5214
+ }
5215
+ }
5176
5216
  const publicDir = import_node_path6.default.join(projectPath, "public");
5177
5217
  try {
5178
5218
  await fs10.access(publicDir);
@@ -5204,6 +5244,8 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5204
5244
  includeInspector,
5205
5245
  buildTime,
5206
5246
  buildId,
5247
+ entryPoint,
5248
+ // Server entry point for `mcp-use start`
5207
5249
  widgets: widgetsData
5208
5250
  };
5209
5251
  await fs10.mkdir(import_node_path6.default.dirname(manifestPath), { recursive: true });
@@ -5532,10 +5574,10 @@ program.command("start").description("Start production server").option("-p, --pa
5532
5574
  let tunnelSubdomain = void 0;
5533
5575
  if (options.tunnel) {
5534
5576
  try {
5535
- const manifestPath = import_node_path6.default.join(projectPath, "dist", "mcp-use.json");
5577
+ const manifestPath2 = import_node_path6.default.join(projectPath, "dist", "mcp-use.json");
5536
5578
  let existingSubdomain;
5537
5579
  try {
5538
- const manifestContent = await (0, import_promises5.readFile)(manifestPath, "utf-8");
5580
+ const manifestContent = await (0, import_promises5.readFile)(manifestPath2, "utf-8");
5539
5581
  const manifest = JSON.parse(manifestContent);
5540
5582
  existingSubdomain = manifest.tunnel?.subdomain;
5541
5583
  if (existingSubdomain) {
@@ -5558,7 +5600,7 @@ program.command("start").description("Start production server").option("-p, --pa
5558
5600
  try {
5559
5601
  let manifest = {};
5560
5602
  try {
5561
- const manifestContent = await (0, import_promises5.readFile)(manifestPath, "utf-8");
5603
+ const manifestContent = await (0, import_promises5.readFile)(manifestPath2, "utf-8");
5562
5604
  manifest = JSON.parse(manifestContent);
5563
5605
  } catch {
5564
5606
  }
@@ -5566,9 +5608,9 @@ program.command("start").description("Start production server").option("-p, --pa
5566
5608
  manifest.tunnel = {};
5567
5609
  }
5568
5610
  manifest.tunnel.subdomain = subdomain;
5569
- await (0, import_promises5.mkdir)(import_node_path6.default.dirname(manifestPath), { recursive: true });
5611
+ await (0, import_promises5.mkdir)(import_node_path6.default.dirname(manifestPath2), { recursive: true });
5570
5612
  await (0, import_promises5.writeFile)(
5571
- manifestPath,
5613
+ manifestPath2,
5572
5614
  JSON.stringify(manifest, null, 2),
5573
5615
  "utf-8"
5574
5616
  );
@@ -5584,11 +5626,48 @@ program.command("start").description("Start production server").option("-p, --pa
5584
5626
  process.exit(1);
5585
5627
  }
5586
5628
  }
5587
- let serverFile = "dist/index.js";
5629
+ let serverFile;
5630
+ const manifestPath = import_node_path6.default.join(projectPath, "dist", "mcp-use.json");
5588
5631
  try {
5589
- await (0, import_promises5.access)(import_node_path6.default.join(projectPath, serverFile));
5632
+ const manifestContent = await (0, import_promises5.readFile)(manifestPath, "utf-8");
5633
+ const manifest = JSON.parse(manifestContent);
5634
+ if (manifest.entryPoint) {
5635
+ await (0, import_promises5.access)(import_node_path6.default.join(projectPath, manifest.entryPoint));
5636
+ serverFile = manifest.entryPoint;
5637
+ }
5590
5638
  } catch {
5591
- serverFile = "dist/server.js";
5639
+ }
5640
+ if (!serverFile) {
5641
+ const serverCandidates = [
5642
+ "dist/index.js",
5643
+ "dist/server.js",
5644
+ "dist/src/index.js",
5645
+ "dist/src/server.js"
5646
+ ];
5647
+ for (const candidate of serverCandidates) {
5648
+ try {
5649
+ await (0, import_promises5.access)(import_node_path6.default.join(projectPath, candidate));
5650
+ serverFile = candidate;
5651
+ break;
5652
+ } catch {
5653
+ continue;
5654
+ }
5655
+ }
5656
+ }
5657
+ if (!serverFile) {
5658
+ console.error(
5659
+ source_default.red(
5660
+ `No built server file found. Run 'mcp-use build' first.
5661
+
5662
+ Looked for:
5663
+ - dist/mcp-use.json (manifest with entryPoint)
5664
+ - dist/index.js
5665
+ - dist/server.js
5666
+ - dist/src/index.js
5667
+ - dist/src/server.js`
5668
+ )
5669
+ );
5670
+ process.exit(1);
5592
5671
  }
5593
5672
  console.log("Starting production server...");
5594
5673
  const env2 = {