@mcp-use/cli 2.19.0-canary.1 → 2.19.0-canary.3

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
@@ -510,6 +510,7 @@ import { readFileSync as readFileSync2 } from "fs";
510
510
  import { access, mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
511
511
  import { createRequire as createRequire2 } from "module";
512
512
  import path7 from "path";
513
+ import { pathToFileURL } from "url";
513
514
 
514
515
  // ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
515
516
  import process9 from "process";
@@ -4962,7 +4963,7 @@ async function generateToolRegistryTypesForServer(projectPath, serverFileRelativ
4962
4963
  globalThis.__mcpUseHmrMode = true;
4963
4964
  globalThis.__mcpUseLastServer = void 0;
4964
4965
  const { tsImport } = await import("tsx/esm/api");
4965
- await tsImport(serverFile, {
4966
+ await tsImport(pathToFileURL(serverFile).href, {
4966
4967
  parentURL: import.meta.url,
4967
4968
  tsconfig: path7.join(projectPath, "tsconfig.json")
4968
4969
  });
@@ -4977,7 +4978,11 @@ async function generateToolRegistryTypesForServer(projectPath, serverFileRelativ
4977
4978
  if (!generateToolRegistryTypes) {
4978
4979
  throw new Error("generateToolRegistryTypes not found in mcp-use package");
4979
4980
  }
4980
- await generateToolRegistryTypes(server.registrations.tools, projectPath);
4981
+ const success = await generateToolRegistryTypes(
4982
+ server.registrations.tools,
4983
+ projectPath
4984
+ );
4985
+ return success;
4981
4986
  } finally {
4982
4987
  globalThis.__mcpUseHmrMode = previousHmrMode ?? false;
4983
4988
  }
@@ -5559,8 +5564,19 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5559
5564
  }
5560
5565
  if (sourceServerFile) {
5561
5566
  console.log(source_default.gray("Generating tool registry types..."));
5562
- await generateToolRegistryTypesForServer(projectPath, sourceServerFile);
5563
- console.log(source_default.green("\u2713 Tool registry types generated"));
5567
+ const typeGenOk = await generateToolRegistryTypesForServer(
5568
+ projectPath,
5569
+ sourceServerFile
5570
+ );
5571
+ if (typeGenOk) {
5572
+ console.log(source_default.green("\u2713 Tool registry types generated"));
5573
+ } else {
5574
+ console.log(
5575
+ source_default.yellow(
5576
+ "\u26A0 Tool registry type generation had errors (non-blocking)"
5577
+ )
5578
+ );
5579
+ }
5564
5580
  }
5565
5581
  console.log(source_default.gray("Building TypeScript..."));
5566
5582
  await transpileWithEsbuild(projectPath);
@@ -5850,7 +5866,7 @@ program.command("dev").description("Run development server with auto-reload and
5850
5866
  );
5851
5867
  const chokidarModule = await import("chokidar");
5852
5868
  const chokidar = chokidarModule.default || chokidarModule;
5853
- const { pathToFileURL, fileURLToPath: fileURLToPath3 } = await import("url");
5869
+ const { fileURLToPath: fileURLToPath3 } = await import("url");
5854
5870
  const { createRequire: createRequire3 } = await import("module");
5855
5871
  let tsImport = null;
5856
5872
  try {
@@ -5874,7 +5890,7 @@ program.command("dev").description("Run development server with auto-reload and
5874
5890
  const previousServer = globalThis.__mcpUseLastServer;
5875
5891
  globalThis.__mcpUseLastServer = null;
5876
5892
  if (tsImport) {
5877
- await tsImport(`${serverFilePath}?t=${Date.now()}`, {
5893
+ await tsImport(`${serverFileUrl}?t=${Date.now()}`, {
5878
5894
  parentURL: import.meta.url,
5879
5895
  onImport: (file) => {
5880
5896
  const filePath = file.startsWith("file://") ? fileURLToPath3(file) : file;
@@ -6358,8 +6374,17 @@ program.command("generate-types").description(
6358
6374
  const projectPath = path7.resolve(options.path);
6359
6375
  try {
6360
6376
  console.log(source_default.blue("Generating tool registry types..."));
6361
- await generateToolRegistryTypesForServer(projectPath, options.server);
6362
- console.log(source_default.green("\u2713 Tool registry types generated successfully"));
6377
+ const success = await generateToolRegistryTypesForServer(
6378
+ projectPath,
6379
+ options.server
6380
+ );
6381
+ if (success) {
6382
+ console.log(
6383
+ source_default.green("\u2713 Tool registry types generated successfully")
6384
+ );
6385
+ } else {
6386
+ console.log(source_default.yellow("\u26A0 Tool registry type generation had errors"));
6387
+ }
6363
6388
  process.exit(0);
6364
6389
  } catch (error) {
6365
6390
  console.error(