@mcp-use/cli 3.1.1-canary.0 → 3.1.1-canary.1

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
@@ -5836,12 +5836,28 @@ To fix:
5836
5836
  async function findServerFile(projectPath, cliEntry, cliMcpDir) {
5837
5837
  return resolveEntryFile(projectPath, cliEntry, cliMcpDir);
5838
5838
  }
5839
+ function isBunRuntime() {
5840
+ return typeof globalThis.Bun !== "undefined" || typeof process.versions.bun === "string";
5841
+ }
5839
5842
  async function generateToolRegistryTypesForServer(projectPath, serverFileRelative) {
5840
5843
  const serverFile = import_node_path9.default.join(projectPath, serverFileRelative);
5841
5844
  const serverFileExists = await (0, import_promises7.access)(serverFile).then(() => true).catch(() => false);
5842
5845
  if (!serverFileExists) {
5843
5846
  throw new Error(`Server file not found: ${serverFile}`);
5844
5847
  }
5848
+ if (isBunRuntime()) {
5849
+ console.log(
5850
+ source_default.yellow(
5851
+ "\u26A0 Skipping tool registry type generation under bun runtime (requires Node.js loader hooks)."
5852
+ )
5853
+ );
5854
+ console.log(
5855
+ source_default.gray(
5856
+ " Run `mcp-use generate-types` with node to refresh .mcp-use/tool-registry.d.ts."
5857
+ )
5858
+ );
5859
+ return "skipped";
5860
+ }
5845
5861
  const previousHmrMode = globalThis.__mcpUseHmrMode;
5846
5862
  try {
5847
5863
  globalThis.__mcpUseHmrMode = true;
@@ -5895,7 +5911,7 @@ async function generateToolRegistryTypesForServer(projectPath, serverFileRelativ
5895
5911
  server.registrations.tools,
5896
5912
  projectPath
5897
5913
  );
5898
- return success;
5914
+ return success ? "ok" : "failed";
5899
5915
  } finally {
5900
5916
  globalThis.__mcpUseHmrMode = previousHmrMode ?? false;
5901
5917
  }
@@ -6533,16 +6549,24 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
6533
6549
  }
6534
6550
  if (sourceServerFile) {
6535
6551
  console.log(source_default.gray("Generating tool registry types..."));
6536
- const typeGenOk = await generateToolRegistryTypesForServer(
6537
- projectPath,
6538
- sourceServerFile
6539
- );
6540
- if (typeGenOk) {
6541
- console.log(source_default.green("\u2713 Tool registry types generated"));
6542
- } else {
6552
+ try {
6553
+ const typeGenResult = await generateToolRegistryTypesForServer(
6554
+ projectPath,
6555
+ sourceServerFile
6556
+ );
6557
+ if (typeGenResult === "ok") {
6558
+ console.log(source_default.green("\u2713 Tool registry types generated"));
6559
+ } else if (typeGenResult === "failed") {
6560
+ console.log(
6561
+ source_default.yellow(
6562
+ "\u26A0 Tool registry type generation had errors (non-blocking)"
6563
+ )
6564
+ );
6565
+ }
6566
+ } catch (err) {
6543
6567
  console.log(
6544
6568
  source_default.yellow(
6545
- "\u26A0 Tool registry type generation had errors (non-blocking)"
6569
+ "\u26A0 Tool registry type generation failed (non-blocking): " + (err instanceof Error ? err.message : String(err))
6546
6570
  )
6547
6571
  );
6548
6572
  }
@@ -6560,22 +6584,16 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
6560
6584
  }
6561
6585
  if (options.typecheck !== false && !mcpDir) {
6562
6586
  console.log(source_default.gray("Type checking..."));
6587
+ const tscBin = import_node_path9.default.join(
6588
+ projectPath,
6589
+ "node_modules",
6590
+ "typescript",
6591
+ "bin",
6592
+ "tsc"
6593
+ );
6594
+ const tscArgs = isBunRuntime() ? [tscBin, "--noEmit"] : ["--max-old-space-size=4096", tscBin, "--noEmit"];
6563
6595
  try {
6564
- await runCommand(
6565
- "node",
6566
- [
6567
- "--max-old-space-size=4096",
6568
- import_node_path9.default.join(
6569
- projectPath,
6570
- "node_modules",
6571
- "typescript",
6572
- "bin",
6573
- "tsc"
6574
- ),
6575
- "--noEmit"
6576
- ],
6577
- projectPath
6578
- ).promise;
6596
+ await runCommand(process.execPath, tscArgs, projectPath).promise;
6579
6597
  console.log(source_default.green("\u2713 Type check passed!"));
6580
6598
  } catch {
6581
6599
  console.error(
@@ -7705,15 +7723,15 @@ program.command("generate-types").description(
7705
7723
  const projectPath = import_node_path9.default.resolve(options.path);
7706
7724
  try {
7707
7725
  console.log(source_default.blue("Generating tool registry types..."));
7708
- const success = await generateToolRegistryTypesForServer(
7726
+ const result = await generateToolRegistryTypesForServer(
7709
7727
  projectPath,
7710
7728
  options.server
7711
7729
  );
7712
- if (success) {
7730
+ if (result === "ok") {
7713
7731
  console.log(
7714
7732
  source_default.green("\u2713 Tool registry types generated successfully")
7715
7733
  );
7716
- } else {
7734
+ } else if (result === "failed") {
7717
7735
  console.log(source_default.yellow("\u26A0 Tool registry type generation had errors"));
7718
7736
  }
7719
7737
  process.exit(0);