@mcp-use/cli 2.11.0-canary.0 → 2.11.0-canary.10

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
@@ -4452,6 +4452,35 @@ var packageContent = (0, import_node_fs8.readFileSync)(
4452
4452
  var packageJson = JSON.parse(packageContent);
4453
4453
  var packageVersion = packageJson.version || "unknown";
4454
4454
  program.name("mcp-use").description("Create and run MCP servers with ui resources widgets").version(packageVersion);
4455
+ function displayPackageVersions() {
4456
+ const packages = [
4457
+ { name: "@mcp-use/cli", path: "../package.json" },
4458
+ { name: "@mcp-use/inspector", path: "../../inspector/package.json" },
4459
+ {
4460
+ name: "create-mcp-use-app",
4461
+ path: "../../create-mcp-use-app/package.json"
4462
+ },
4463
+ { name: "mcp-use", path: "../../mcp-use/package.json", highlight: true }
4464
+ ];
4465
+ console.log(source_default.gray("mcp-use packages:"));
4466
+ for (const pkg of packages) {
4467
+ try {
4468
+ const pkgPath = import_node_path6.default.join(__dirname, pkg.path);
4469
+ const pkgContent = (0, import_node_fs8.readFileSync)(pkgPath, "utf-8");
4470
+ const pkgJson = JSON.parse(pkgContent);
4471
+ const version = pkgJson.version || "unknown";
4472
+ const paddedName = pkg.name.padEnd(22);
4473
+ if (pkg.highlight) {
4474
+ console.log(
4475
+ ` ${source_default.cyan.bold(paddedName)} ${source_default.cyan.bold(`v${version}`)}`
4476
+ );
4477
+ } else {
4478
+ console.log(source_default.gray(` ${paddedName} v${version}`));
4479
+ }
4480
+ } catch (error) {
4481
+ }
4482
+ }
4483
+ }
4455
4484
  async function isPortAvailable(port, host = "localhost") {
4456
4485
  try {
4457
4486
  await fetch(`http://${host}:${port}`);
@@ -4649,8 +4678,7 @@ async function buildWidgets(projectPath) {
4649
4678
  favicon = pkg.mcpUse?.favicon || "";
4650
4679
  } catch {
4651
4680
  }
4652
- const builtWidgets = [];
4653
- for (const entry of entries) {
4681
+ const buildSingleWidget = async (entry) => {
4654
4682
  const widgetName = entry.name;
4655
4683
  const entryPath = entry.path.replace(/\\/g, "/");
4656
4684
  console.log(source_default.gray(` - Building ${widgetName}...`));
@@ -4990,22 +5018,26 @@ export default {
4990
5018
  );
4991
5019
  }
4992
5020
  }
4993
- builtWidgets.push({
4994
- name: widgetName,
4995
- metadata: widgetMetadata
4996
- });
4997
5021
  console.log(source_default.green(` \u2713 Built ${widgetName}`));
5022
+ return { name: widgetName, metadata: widgetMetadata };
4998
5023
  } catch (error) {
4999
5024
  console.error(source_default.red(` \u2717 Failed to build ${widgetName}:`), error);
5025
+ return null;
5000
5026
  }
5001
- }
5027
+ };
5028
+ const buildResults = await Promise.all(
5029
+ entries.map((entry) => buildSingleWidget(entry))
5030
+ );
5031
+ const builtWidgets = buildResults.filter(
5032
+ (result) => result !== null
5033
+ );
5002
5034
  return builtWidgets;
5003
5035
  }
5004
5036
  program.command("build").description("Build TypeScript and MCP UI widgets").option("-p, --path <path>", "Path to project directory", process.cwd()).option("--with-inspector", "Include inspector in production build").action(async (options) => {
5005
5037
  try {
5006
5038
  const projectPath = import_node_path6.default.resolve(options.path);
5007
5039
  const { promises: fs10 } = await import("fs");
5008
- console.log(source_default.cyan.bold(`mcp-use v${packageJson.version}`));
5040
+ displayPackageVersions();
5009
5041
  const builtWidgets = await buildWidgets(projectPath);
5010
5042
  console.log(source_default.gray("Building TypeScript..."));
5011
5043
  await runCommand("npx", ["tsc"], projectPath);
@@ -5069,7 +5101,7 @@ program.command("dev").description("Run development server with auto-reload and
5069
5101
  let port = parseInt(options.port, 10);
5070
5102
  const host = options.host;
5071
5103
  const useHmr = options.hmr !== false;
5072
- console.log(source_default.cyan.bold(`mcp-use v${packageJson.version}`));
5104
+ displayPackageVersions();
5073
5105
  if (!await isPortAvailable(port, host)) {
5074
5106
  console.log(source_default.yellow.bold(`\u26A0\uFE0F Port ${port} is already in use`));
5075
5107
  const availablePort = await findAvailablePort2(port, host);
@@ -5077,16 +5109,20 @@ program.command("dev").description("Run development server with auto-reload and
5077
5109
  port = availablePort;
5078
5110
  }
5079
5111
  const serverFile = await findServerFile(projectPath);
5112
+ const mcpUrl = `http://${host}:${port}`;
5080
5113
  process.env.PORT = String(port);
5081
5114
  process.env.HOST = host;
5082
5115
  process.env.NODE_ENV = "development";
5116
+ process.env.MCP_URL = mcpUrl;
5083
5117
  if (!useHmr) {
5084
5118
  console.log(source_default.gray("HMR disabled, using tsx watch (full restart)"));
5085
5119
  const processes = [];
5120
+ const mcpUrl2 = `http://${host}:${port}`;
5086
5121
  const env2 = {
5087
5122
  PORT: String(port),
5088
5123
  HOST: host,
5089
- NODE_ENV: "development"
5124
+ NODE_ENV: "development",
5125
+ MCP_URL: mcpUrl2
5090
5126
  };
5091
5127
  const { createRequire: createRequire2 } = await import("module");
5092
5128
  let cmd;