@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.js CHANGED
@@ -518,7 +518,7 @@ import { fileURLToPath as fileURLToPath2 } from "url";
518
518
  import childProcess3 from "child_process";
519
519
  import fs6, { constants as fsConstants3 } from "fs/promises";
520
520
 
521
- // ../../node_modules/.pnpm/wsl-utils@0.3.0/node_modules/wsl-utils/index.js
521
+ // ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
522
522
  import { promisify as promisify2 } from "util";
523
523
  import childProcess2 from "child_process";
524
524
  import fs5, { constants as fsConstants2 } from "fs/promises";
@@ -628,7 +628,21 @@ executePowerShell.argumentsPrefix = [
628
628
  executePowerShell.encodeCommand = (command) => Buffer.from(command, "utf16le").toString("base64");
629
629
  executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
630
630
 
631
- // ../../node_modules/.pnpm/wsl-utils@0.3.0/node_modules/wsl-utils/index.js
631
+ // ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/utilities.js
632
+ function parseMountPointFromConfig(content) {
633
+ for (const line of content.split("\n")) {
634
+ if (/^\s*#/.test(line)) {
635
+ continue;
636
+ }
637
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
638
+ if (!match) {
639
+ continue;
640
+ }
641
+ return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
642
+ }
643
+ }
644
+
645
+ // ../../node_modules/.pnpm/wsl-utils@0.3.1/node_modules/wsl-utils/index.js
632
646
  var execFile2 = promisify2(childProcess2.execFile);
633
647
  var wslDrivesMountPoint = /* @__PURE__ */ (() => {
634
648
  const defaultMountPoint = "/mnt/";
@@ -648,11 +662,11 @@ var wslDrivesMountPoint = /* @__PURE__ */ (() => {
648
662
  return defaultMountPoint;
649
663
  }
650
664
  const configContent = await fs5.readFile(configFilePath, { encoding: "utf8" });
651
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
652
- if (!configMountPoint) {
665
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
666
+ if (parsedMountPoint === void 0) {
653
667
  return defaultMountPoint;
654
668
  }
655
- mountPoint = configMountPoint.groups.mountPoint.trim();
669
+ mountPoint = parsedMountPoint;
656
670
  mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
657
671
  return mountPoint;
658
672
  };
@@ -711,7 +725,7 @@ function defineLazyProperty(object, propertyName, valueGetter) {
711
725
  return object;
712
726
  }
713
727
 
714
- // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
728
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
715
729
  import { promisify as promisify6 } from "util";
716
730
  import process7 from "process";
717
731
  import { execFile as execFile6 } from "child_process";
@@ -758,7 +772,7 @@ async function bundleName(bundleId) {
758
772
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`);
759
773
  }
760
774
 
761
- // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/windows.js
775
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/windows.js
762
776
  import { promisify as promisify5 } from "util";
763
777
  import { execFile as execFile5 } from "child_process";
764
778
  var execFileAsync3 = promisify5(execFile5);
@@ -796,14 +810,14 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
796
810
  throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
797
811
  }
798
812
  const { id } = match.groups;
799
- const browser = windowsBrowserProgIds[id];
800
- if (!browser) {
801
- throw new UnknownBrowserError(`Unknown browser ID: ${id}`);
802
- }
803
- return browser;
813
+ const dotIndex = id.lastIndexOf(".");
814
+ const hyphenIndex = id.lastIndexOf("-");
815
+ const baseIdByDot = dotIndex === -1 ? void 0 : id.slice(0, dotIndex);
816
+ const baseIdByHyphen = hyphenIndex === -1 ? void 0 : id.slice(0, hyphenIndex);
817
+ return windowsBrowserProgIds[id] ?? windowsBrowserProgIds[baseIdByDot] ?? windowsBrowserProgIds[baseIdByHyphen] ?? { name: id, id };
804
818
  }
805
819
 
806
- // ../../node_modules/.pnpm/default-browser@5.4.0/node_modules/default-browser/index.js
820
+ // ../../node_modules/.pnpm/default-browser@5.5.0/node_modules/default-browser/index.js
807
821
  var execFileAsync4 = promisify6(execFile6);
808
822
  var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
809
823
  async function defaultBrowser2() {
@@ -5152,9 +5166,35 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5152
5166
  const builtWidgets = await buildWidgets(projectPath, {
5153
5167
  inline: options.inline ?? false
5154
5168
  });
5169
+ let sourceServerFile;
5170
+ try {
5171
+ sourceServerFile = await findServerFile(projectPath);
5172
+ } catch {
5173
+ }
5155
5174
  console.log(source_default.gray("Building TypeScript..."));
5156
5175
  await runCommand("npx", ["tsc"], projectPath);
5157
5176
  console.log(source_default.green("\u2713 TypeScript build complete!"));
5177
+ let entryPoint;
5178
+ if (sourceServerFile) {
5179
+ const baseName = path6.basename(sourceServerFile, ".ts") + ".js";
5180
+ const possibleOutputs = [
5181
+ `dist/${baseName}`,
5182
+ // rootDir set to project root or src
5183
+ `dist/src/${baseName}`,
5184
+ // no rootDir, source in src/
5185
+ `dist/${sourceServerFile.replace(/\.ts$/, ".js")}`
5186
+ // exact path preserved
5187
+ ];
5188
+ for (const candidate of possibleOutputs) {
5189
+ try {
5190
+ await access(path6.join(projectPath, candidate));
5191
+ entryPoint = candidate;
5192
+ break;
5193
+ } catch {
5194
+ continue;
5195
+ }
5196
+ }
5197
+ }
5158
5198
  const publicDir = path6.join(projectPath, "public");
5159
5199
  try {
5160
5200
  await fs10.access(publicDir);
@@ -5186,6 +5226,8 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5186
5226
  includeInspector,
5187
5227
  buildTime,
5188
5228
  buildId,
5229
+ entryPoint,
5230
+ // Server entry point for `mcp-use start`
5189
5231
  widgets: widgetsData
5190
5232
  };
5191
5233
  await fs10.mkdir(path6.dirname(manifestPath), { recursive: true });
@@ -5514,10 +5556,10 @@ program.command("start").description("Start production server").option("-p, --pa
5514
5556
  let tunnelSubdomain = void 0;
5515
5557
  if (options.tunnel) {
5516
5558
  try {
5517
- const manifestPath = path6.join(projectPath, "dist", "mcp-use.json");
5559
+ const manifestPath2 = path6.join(projectPath, "dist", "mcp-use.json");
5518
5560
  let existingSubdomain;
5519
5561
  try {
5520
- const manifestContent = await readFile2(manifestPath, "utf-8");
5562
+ const manifestContent = await readFile2(manifestPath2, "utf-8");
5521
5563
  const manifest = JSON.parse(manifestContent);
5522
5564
  existingSubdomain = manifest.tunnel?.subdomain;
5523
5565
  if (existingSubdomain) {
@@ -5540,7 +5582,7 @@ program.command("start").description("Start production server").option("-p, --pa
5540
5582
  try {
5541
5583
  let manifest = {};
5542
5584
  try {
5543
- const manifestContent = await readFile2(manifestPath, "utf-8");
5585
+ const manifestContent = await readFile2(manifestPath2, "utf-8");
5544
5586
  manifest = JSON.parse(manifestContent);
5545
5587
  } catch {
5546
5588
  }
@@ -5548,9 +5590,9 @@ program.command("start").description("Start production server").option("-p, --pa
5548
5590
  manifest.tunnel = {};
5549
5591
  }
5550
5592
  manifest.tunnel.subdomain = subdomain;
5551
- await mkdir2(path6.dirname(manifestPath), { recursive: true });
5593
+ await mkdir2(path6.dirname(manifestPath2), { recursive: true });
5552
5594
  await writeFile2(
5553
- manifestPath,
5595
+ manifestPath2,
5554
5596
  JSON.stringify(manifest, null, 2),
5555
5597
  "utf-8"
5556
5598
  );
@@ -5566,11 +5608,48 @@ program.command("start").description("Start production server").option("-p, --pa
5566
5608
  process.exit(1);
5567
5609
  }
5568
5610
  }
5569
- let serverFile = "dist/index.js";
5611
+ let serverFile;
5612
+ const manifestPath = path6.join(projectPath, "dist", "mcp-use.json");
5570
5613
  try {
5571
- await access(path6.join(projectPath, serverFile));
5614
+ const manifestContent = await readFile2(manifestPath, "utf-8");
5615
+ const manifest = JSON.parse(manifestContent);
5616
+ if (manifest.entryPoint) {
5617
+ await access(path6.join(projectPath, manifest.entryPoint));
5618
+ serverFile = manifest.entryPoint;
5619
+ }
5572
5620
  } catch {
5573
- serverFile = "dist/server.js";
5621
+ }
5622
+ if (!serverFile) {
5623
+ const serverCandidates = [
5624
+ "dist/index.js",
5625
+ "dist/server.js",
5626
+ "dist/src/index.js",
5627
+ "dist/src/server.js"
5628
+ ];
5629
+ for (const candidate of serverCandidates) {
5630
+ try {
5631
+ await access(path6.join(projectPath, candidate));
5632
+ serverFile = candidate;
5633
+ break;
5634
+ } catch {
5635
+ continue;
5636
+ }
5637
+ }
5638
+ }
5639
+ if (!serverFile) {
5640
+ console.error(
5641
+ source_default.red(
5642
+ `No built server file found. Run 'mcp-use build' first.
5643
+
5644
+ Looked for:
5645
+ - dist/mcp-use.json (manifest with entryPoint)
5646
+ - dist/index.js
5647
+ - dist/server.js
5648
+ - dist/src/index.js
5649
+ - dist/src/server.js`
5650
+ )
5651
+ );
5652
+ process.exit(1);
5574
5653
  }
5575
5654
  console.log("Starting production server...");
5576
5655
  const env2 = {