@mcp-use/cli 2.14.1-canary.0 → 2.15.0-canary.2

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
@@ -506,10 +506,10 @@ var source_default = chalk;
506
506
  import { Command as Command4 } from "commander";
507
507
  import "dotenv/config";
508
508
  import { spawn } from "child_process";
509
- import { readFileSync } from "fs";
510
- import { access, mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
511
- import { createRequire } from "module";
512
- import path6 from "path";
509
+ import { readFileSync as readFileSync2 } from "fs";
510
+ import { access, mkdir as mkdir3, readFile as readFile3, writeFile as writeFile3 } from "fs/promises";
511
+ import { createRequire as createRequire2 } from "module";
512
+ import path7 from "path";
513
513
 
514
514
  // ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
515
515
  import process9 from "process";
@@ -695,15 +695,15 @@ var wslDefaultBrowser = async () => {
695
695
  const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
696
696
  return stdout.trim();
697
697
  };
698
- var convertWslPathToWindows = async (path7) => {
699
- if (/^[a-z]+:\/\//i.test(path7)) {
700
- return path7;
698
+ var convertWslPathToWindows = async (path8) => {
699
+ if (/^[a-z]+:\/\//i.test(path8)) {
700
+ return path8;
701
701
  }
702
702
  try {
703
- const { stdout } = await execFile2("wslpath", ["-aw", path7], { encoding: "utf8" });
703
+ const { stdout } = await execFile2("wslpath", ["-aw", path8], { encoding: "utf8" });
704
704
  return stdout.trim();
705
705
  } catch {
706
- return path7;
706
+ return path8;
707
707
  }
708
708
  };
709
709
 
@@ -1325,7 +1325,7 @@ var McpUseAPI = class _McpUseAPI {
1325
1325
  * Create deployment with source code upload
1326
1326
  */
1327
1327
  async createDeploymentWithUpload(request, filePath) {
1328
- const { readFile: readFile3 } = await import("fs/promises");
1328
+ const { readFile: readFile4 } = await import("fs/promises");
1329
1329
  const { basename } = await import("path");
1330
1330
  const { stat } = await import("fs/promises");
1331
1331
  const stats = await stat(filePath);
@@ -1335,7 +1335,7 @@ var McpUseAPI = class _McpUseAPI {
1335
1335
  `File size (${(stats.size / 1024 / 1024).toFixed(2)}MB) exceeds maximum of 2MB`
1336
1336
  );
1337
1337
  }
1338
- const fileBuffer = await readFile3(filePath);
1338
+ const fileBuffer = await readFile4(filePath);
1339
1339
  const filename = basename(filePath);
1340
1340
  const formData = new FormData();
1341
1341
  const blob = new Blob([fileBuffer], { type: "application/gzip" });
@@ -1411,7 +1411,7 @@ var McpUseAPI = class _McpUseAPI {
1411
1411
  async redeployDeployment(deploymentId, configOrFilePath) {
1412
1412
  if (typeof configOrFilePath === "string") {
1413
1413
  const filePath = configOrFilePath;
1414
- const { readFile: readFile3 } = await import("fs/promises");
1414
+ const { readFile: readFile4 } = await import("fs/promises");
1415
1415
  const { basename } = await import("path");
1416
1416
  const { stat } = await import("fs/promises");
1417
1417
  const stats = await stat(filePath);
@@ -1421,7 +1421,7 @@ var McpUseAPI = class _McpUseAPI {
1421
1421
  `File size (${(stats.size / 1024 / 1024).toFixed(2)}MB) exceeds maximum of 2MB`
1422
1422
  );
1423
1423
  }
1424
- const fileBuffer = await readFile3(filePath);
1424
+ const fileBuffer = await readFile4(filePath);
1425
1425
  const formData = new FormData();
1426
1426
  const blob = new Blob([fileBuffer], { type: "application/gzip" });
1427
1427
  formData.append("source_file", blob, basename(filePath));
@@ -4532,7 +4532,7 @@ async function addSkillsToProject(projectPath) {
4532
4532
  Readable.fromWeb(response.body),
4533
4533
  extract({
4534
4534
  cwd: tempDir,
4535
- filter: (path7) => path7.includes("/skills/"),
4535
+ filter: (path8) => path8.includes("/skills/"),
4536
4536
  strip: 1
4537
4537
  })
4538
4538
  );
@@ -4597,10 +4597,140 @@ function createSkillsCommand() {
4597
4597
  return skills;
4598
4598
  }
4599
4599
 
4600
+ // src/utils/update-check.ts
4601
+ import { readFileSync } from "fs";
4602
+ import { mkdir as mkdir2, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
4603
+ import { createRequire } from "module";
4604
+ import os4 from "os";
4605
+ import path6 from "path";
4606
+ var CACHE_DIR = path6.join(os4.homedir(), ".mcp-use");
4607
+ var CACHE_FILE = path6.join(CACHE_DIR, "update-check.json");
4608
+ var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
4609
+ var FETCH_TIMEOUT_MS = 3e3;
4610
+ var PACKAGE_NAME = "mcp-use";
4611
+ function parseSemver(version) {
4612
+ const match = version.match(/^(\d+)\.(\d+)\.(\d+)/);
4613
+ if (!match) return null;
4614
+ return [
4615
+ parseInt(match[1], 10),
4616
+ parseInt(match[2], 10),
4617
+ parseInt(match[3], 10)
4618
+ ];
4619
+ }
4620
+ function isNewer(current, candidate) {
4621
+ const a = parseSemver(current);
4622
+ const b = parseSemver(candidate);
4623
+ if (!a || !b) return false;
4624
+ for (let i = 0; i < 3; i++) {
4625
+ if (b[i] > a[i]) return true;
4626
+ if (b[i] < a[i]) return false;
4627
+ }
4628
+ return false;
4629
+ }
4630
+ async function readCache() {
4631
+ try {
4632
+ const content = await readFile2(CACHE_FILE, "utf-8");
4633
+ return JSON.parse(content);
4634
+ } catch {
4635
+ return null;
4636
+ }
4637
+ }
4638
+ async function writeCache(latestVersion) {
4639
+ try {
4640
+ await mkdir2(CACHE_DIR, { recursive: true });
4641
+ const cache = {
4642
+ lastChecked: (/* @__PURE__ */ new Date()).toISOString(),
4643
+ latestVersion
4644
+ };
4645
+ await writeFile2(CACHE_FILE, JSON.stringify(cache, null, 2), "utf-8");
4646
+ } catch {
4647
+ }
4648
+ }
4649
+ async function fetchLatestVersion() {
4650
+ try {
4651
+ const controller = new AbortController();
4652
+ const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
4653
+ try {
4654
+ const res = await fetch(
4655
+ `https://registry.npmjs.org/${PACKAGE_NAME}/latest`,
4656
+ {
4657
+ signal: controller.signal,
4658
+ headers: { Accept: "application/json" }
4659
+ }
4660
+ );
4661
+ if (!res.ok) return null;
4662
+ const data = await res.json();
4663
+ return data.version ?? null;
4664
+ } finally {
4665
+ clearTimeout(timer);
4666
+ }
4667
+ } catch {
4668
+ return null;
4669
+ }
4670
+ }
4671
+ async function getLatestVersion() {
4672
+ const cache = await readCache();
4673
+ if (cache) {
4674
+ const age = Date.now() - new Date(cache.lastChecked).getTime();
4675
+ if (age < CACHE_TTL_MS) {
4676
+ return cache.latestVersion;
4677
+ }
4678
+ }
4679
+ const latest = await fetchLatestVersion();
4680
+ if (latest) {
4681
+ await writeCache(latest);
4682
+ }
4683
+ return latest;
4684
+ }
4685
+ function resolveInstalledVersion(projectPath) {
4686
+ const attempts = [];
4687
+ if (projectPath) {
4688
+ attempts.push(() => {
4689
+ const projectRequire = createRequire(
4690
+ path6.join(projectPath, "package.json")
4691
+ );
4692
+ return projectRequire.resolve(`${PACKAGE_NAME}/package.json`);
4693
+ });
4694
+ }
4695
+ attempts.push(() => path6.join(__dirname, "../../mcp-use/package.json"));
4696
+ for (const attempt of attempts) {
4697
+ try {
4698
+ const pkgPath = attempt();
4699
+ const json = JSON.parse(readFileSync(pkgPath, "utf-8"));
4700
+ if (typeof json.version === "string") return json.version;
4701
+ } catch {
4702
+ }
4703
+ }
4704
+ return null;
4705
+ }
4706
+ async function notifyIfUpdateAvailable(projectPath) {
4707
+ try {
4708
+ const installed = resolveInstalledVersion(projectPath);
4709
+ if (!installed) return;
4710
+ const latest = await getLatestVersion();
4711
+ if (!latest) return;
4712
+ if (isNewer(installed, latest)) {
4713
+ console.log(
4714
+ source_default.yellow(
4715
+ `
4716
+ A new release of ${source_default.bold(PACKAGE_NAME)} is available: ${source_default.dim(installed)} \u2192 ${source_default.cyan.bold(latest)}`
4717
+ )
4718
+ );
4719
+ console.log(
4720
+ source_default.gray(
4721
+ `Run ${source_default.white(`npm install ${PACKAGE_NAME}@latest`)} to update
4722
+ `
4723
+ )
4724
+ );
4725
+ }
4726
+ } catch {
4727
+ }
4728
+ }
4729
+
4600
4730
  // src/index.ts
4601
4731
  var program = new Command4();
4602
- var packageContent = readFileSync(
4603
- path6.join(__dirname, "../package.json"),
4732
+ var packageContent = readFileSync2(
4733
+ path7.join(__dirname, "../package.json"),
4604
4734
  "utf-8"
4605
4735
  );
4606
4736
  var packageJson = JSON.parse(packageContent);
@@ -4630,17 +4760,17 @@ function displayPackageVersions(projectPath) {
4630
4760
  let pkgPath;
4631
4761
  if (projectPath) {
4632
4762
  try {
4633
- const projectRequire = createRequire(
4634
- path6.join(projectPath, "package.json")
4763
+ const projectRequire = createRequire2(
4764
+ path7.join(projectPath, "package.json")
4635
4765
  );
4636
4766
  pkgPath = projectRequire.resolve(`${pkg.name}/package.json`);
4637
4767
  } catch (resolveError) {
4638
- pkgPath = path6.join(__dirname, pkg.relativePath);
4768
+ pkgPath = path7.join(__dirname, pkg.relativePath);
4639
4769
  }
4640
4770
  } else {
4641
- pkgPath = path6.join(__dirname, pkg.relativePath);
4771
+ pkgPath = path7.join(__dirname, pkg.relativePath);
4642
4772
  }
4643
- const pkgContent = readFileSync(pkgPath, "utf-8");
4773
+ const pkgContent = readFileSync2(pkgPath, "utf-8");
4644
4774
  const pkgJson = JSON.parse(pkgContent);
4645
4775
  const version = pkgJson.version || "unknown";
4646
4776
  if (pkg.highlight) {
@@ -4793,7 +4923,7 @@ async function findServerFile(projectPath) {
4793
4923
  const candidates = ["index.ts", "src/index.ts", "server.ts", "src/server.ts"];
4794
4924
  for (const candidate of candidates) {
4795
4925
  try {
4796
- await access(path6.join(projectPath, candidate));
4926
+ await access(path7.join(projectPath, candidate));
4797
4927
  return candidate;
4798
4928
  } catch {
4799
4929
  continue;
@@ -4805,7 +4935,7 @@ async function buildWidgets(projectPath, options = {}) {
4805
4935
  const { inline = true } = options;
4806
4936
  const { promises: fs10 } = await import("fs");
4807
4937
  const { build } = await import("vite");
4808
- const resourcesDir = path6.join(projectPath, "resources");
4938
+ const resourcesDir = path7.join(projectPath, "resources");
4809
4939
  const mcpUrl = process.env.MCP_URL;
4810
4940
  try {
4811
4941
  await access(resourcesDir);
@@ -4825,10 +4955,10 @@ async function buildWidgets(projectPath, options = {}) {
4825
4955
  if (dirent.isFile() && (dirent.name.endsWith(".tsx") || dirent.name.endsWith(".ts"))) {
4826
4956
  entries.push({
4827
4957
  name: dirent.name.replace(/\.tsx?$/, ""),
4828
- path: path6.join(resourcesDir, dirent.name)
4958
+ path: path7.join(resourcesDir, dirent.name)
4829
4959
  });
4830
4960
  } else if (dirent.isDirectory()) {
4831
- const widgetPath = path6.join(resourcesDir, dirent.name, "widget.tsx");
4961
+ const widgetPath = path7.join(resourcesDir, dirent.name, "widget.tsx");
4832
4962
  try {
4833
4963
  await fs10.access(widgetPath);
4834
4964
  entries.push({
@@ -4854,7 +4984,7 @@ async function buildWidgets(projectPath, options = {}) {
4854
4984
  );
4855
4985
  const react = (await import("@vitejs/plugin-react")).default;
4856
4986
  const tailwindcss = (await import("@tailwindcss/vite")).default;
4857
- const packageJsonPath = path6.join(projectPath, "package.json");
4987
+ const packageJsonPath = path7.join(projectPath, "package.json");
4858
4988
  let favicon = "";
4859
4989
  try {
4860
4990
  const pkgContent = await fs10.readFile(packageJsonPath, "utf-8");
@@ -4866,18 +4996,18 @@ async function buildWidgets(projectPath, options = {}) {
4866
4996
  const widgetName = entry.name;
4867
4997
  const entryPath = entry.path.replace(/\\/g, "/");
4868
4998
  console.log(source_default.gray(` - Building ${widgetName}...`));
4869
- const tempDir = path6.join(projectPath, ".mcp-use", widgetName);
4999
+ const tempDir = path7.join(projectPath, ".mcp-use", widgetName);
4870
5000
  await fs10.mkdir(tempDir, { recursive: true });
4871
- const relativeResourcesPath = path6.relative(tempDir, resourcesDir).replace(/\\/g, "/");
4872
- const mcpUsePath = path6.join(projectPath, "node_modules", "mcp-use");
4873
- const relativeMcpUsePath = path6.relative(tempDir, mcpUsePath).replace(/\\/g, "/");
5001
+ const relativeResourcesPath = path7.relative(tempDir, resourcesDir).replace(/\\/g, "/");
5002
+ const mcpUsePath = path7.join(projectPath, "node_modules", "mcp-use");
5003
+ const relativeMcpUsePath = path7.relative(tempDir, mcpUsePath).replace(/\\/g, "/");
4874
5004
  const cssContent = `@import "tailwindcss";
4875
5005
 
4876
5006
  /* Configure Tailwind to scan the resources directory and mcp-use package */
4877
5007
  @source "${relativeResourcesPath}";
4878
5008
  @source "${relativeMcpUsePath}/**/*.{ts,tsx,js,jsx}";
4879
5009
  `;
4880
- await fs10.writeFile(path6.join(tempDir, "styles.css"), cssContent, "utf8");
5010
+ await fs10.writeFile(path7.join(tempDir, "styles.css"), cssContent, "utf8");
4881
5011
  const entryContent = `import React from 'react'
4882
5012
  import { createRoot } from 'react-dom/client'
4883
5013
  import './styles.css'
@@ -4902,9 +5032,9 @@ if (container && Component) {
4902
5032
  <script type="module" src="/entry.tsx"></script>
4903
5033
  </body>
4904
5034
  </html>`;
4905
- await fs10.writeFile(path6.join(tempDir, "entry.tsx"), entryContent, "utf8");
4906
- await fs10.writeFile(path6.join(tempDir, "index.html"), htmlContent, "utf8");
4907
- const outDir = path6.join(
5035
+ await fs10.writeFile(path7.join(tempDir, "entry.tsx"), entryContent, "utf8");
5036
+ await fs10.writeFile(path7.join(tempDir, "index.html"), htmlContent, "utf8");
5037
+ const outDir = path7.join(
4908
5038
  projectPath,
4909
5039
  "dist",
4910
5040
  "resources",
@@ -4914,7 +5044,7 @@ if (container && Component) {
4914
5044
  const baseUrl = mcpUrl ? `${mcpUrl}/${widgetName}/` : `/mcp-use/widgets/${widgetName}/`;
4915
5045
  let widgetMetadata = {};
4916
5046
  try {
4917
- const metadataTempDir = path6.join(
5047
+ const metadataTempDir = path7.join(
4918
5048
  projectPath,
4919
5049
  ".mcp-use",
4920
5050
  `${widgetName}-metadata`
@@ -4949,7 +5079,7 @@ export default PostHog;
4949
5079
  };
4950
5080
  const metadataServer = await createServer2({
4951
5081
  root: metadataTempDir,
4952
- cacheDir: path6.join(metadataTempDir, ".vite-cache"),
5082
+ cacheDir: path7.join(metadataTempDir, ".vite-cache"),
4953
5083
  plugins: [nodeStubsPlugin, tailwindcss(), react()],
4954
5084
  resolve: {
4955
5085
  alias: {
@@ -5179,7 +5309,7 @@ export default {
5179
5309
  // Inline all assets under 100MB (effectively all)
5180
5310
  } : {},
5181
5311
  rollupOptions: {
5182
- input: path6.join(tempDir, "index.html"),
5312
+ input: path7.join(tempDir, "index.html"),
5183
5313
  external: (id) => {
5184
5314
  return false;
5185
5315
  }
@@ -5187,11 +5317,11 @@ export default {
5187
5317
  }
5188
5318
  });
5189
5319
  try {
5190
- const assetsDir = path6.join(outDir, "assets");
5320
+ const assetsDir = path7.join(outDir, "assets");
5191
5321
  const assetFiles = await fs10.readdir(assetsDir);
5192
5322
  const jsFiles = assetFiles.filter((f) => f.endsWith(".js"));
5193
5323
  for (const jsFile of jsFiles) {
5194
- const jsPath = path6.join(assetsDir, jsFile);
5324
+ const jsPath = path7.join(assetsDir, jsFile);
5195
5325
  let content = await fs10.readFile(jsPath, "utf8");
5196
5326
  const zodConfigPatterns = [
5197
5327
  // Non-minified: export const globalConfig = {}
@@ -5223,7 +5353,7 @@ export default {
5223
5353
  const mcpServerUrl = process.env.MCP_SERVER_URL;
5224
5354
  if (mcpServerUrl) {
5225
5355
  try {
5226
- const htmlPath = path6.join(outDir, "index.html");
5356
+ const htmlPath = path7.join(outDir, "index.html");
5227
5357
  let html = await fs10.readFile(htmlPath, "utf8");
5228
5358
  const injectionScript = `<script>window.__getFile = (filename) => { return "${mcpUrl}/${widgetName}/"+filename }; window.__mcpPublicUrl = "${mcpServerUrl}/mcp-use/public"; window.__mcpPublicAssetsUrl = "${mcpUrl}/public";</script>`;
5229
5359
  if (!html.includes("window.__mcpPublicUrl")) {
@@ -5278,7 +5408,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5278
5408
  "Inline all JS/CSS into HTML (required for VS Code MCP Apps)"
5279
5409
  ).option("--no-inline", "Keep JS/CSS as separate files (default)").action(async (options) => {
5280
5410
  try {
5281
- const projectPath = path6.resolve(options.path);
5411
+ const projectPath = path7.resolve(options.path);
5282
5412
  const { promises: fs10 } = await import("fs");
5283
5413
  displayPackageVersions(projectPath);
5284
5414
  const builtWidgets = await buildWidgets(projectPath, {
@@ -5290,11 +5420,18 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5290
5420
  } catch {
5291
5421
  }
5292
5422
  console.log(source_default.gray("Building TypeScript..."));
5293
- await runCommand("npx", ["tsc"], projectPath);
5423
+ await runCommand(
5424
+ "node",
5425
+ [
5426
+ "--max-old-space-size=4096",
5427
+ path7.join(projectPath, "node_modules", "typescript", "bin", "tsc")
5428
+ ],
5429
+ projectPath
5430
+ ).promise;
5294
5431
  console.log(source_default.green("\u2713 TypeScript build complete!"));
5295
5432
  let entryPoint;
5296
5433
  if (sourceServerFile) {
5297
- const baseName = path6.basename(sourceServerFile, ".ts") + ".js";
5434
+ const baseName = path7.basename(sourceServerFile, ".ts") + ".js";
5298
5435
  const possibleOutputs = [
5299
5436
  `dist/${baseName}`,
5300
5437
  // rootDir set to project root or src
@@ -5305,7 +5442,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5305
5442
  ];
5306
5443
  for (const candidate of possibleOutputs) {
5307
5444
  try {
5308
- await access(path6.join(projectPath, candidate));
5445
+ await access(path7.join(projectPath, candidate));
5309
5446
  entryPoint = candidate;
5310
5447
  break;
5311
5448
  } catch {
@@ -5313,17 +5450,17 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5313
5450
  }
5314
5451
  }
5315
5452
  }
5316
- const publicDir = path6.join(projectPath, "public");
5453
+ const publicDir = path7.join(projectPath, "public");
5317
5454
  try {
5318
5455
  await fs10.access(publicDir);
5319
5456
  console.log(source_default.gray("Copying public assets..."));
5320
- await fs10.cp(publicDir, path6.join(projectPath, "dist", "public"), {
5457
+ await fs10.cp(publicDir, path7.join(projectPath, "dist", "public"), {
5321
5458
  recursive: true
5322
5459
  });
5323
5460
  console.log(source_default.green("\u2713 Public assets copied"));
5324
5461
  } catch {
5325
5462
  }
5326
- const manifestPath = path6.join(projectPath, "dist", "mcp-use.json");
5463
+ const manifestPath = path7.join(projectPath, "dist", "mcp-use.json");
5327
5464
  let existingManifest = {};
5328
5465
  try {
5329
5466
  const existingContent = await fs10.readFile(manifestPath, "utf-8");
@@ -5348,7 +5485,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5348
5485
  // Server entry point for `mcp-use start`
5349
5486
  widgets: widgetsData
5350
5487
  };
5351
- await fs10.mkdir(path6.dirname(manifestPath), { recursive: true });
5488
+ await fs10.mkdir(path7.dirname(manifestPath), { recursive: true });
5352
5489
  await fs10.writeFile(
5353
5490
  manifestPath,
5354
5491
  JSON.stringify(manifest, null, 2),
@@ -5374,7 +5511,7 @@ program.command("dev").description("Run development server with auto-reload and
5374
5511
  "0.0.0.0"
5375
5512
  ).option("--no-open", "Do not auto-open inspector").option("--no-hmr", "Disable hot module reloading (use tsx watch instead)").action(async (options) => {
5376
5513
  try {
5377
- const projectPath = path6.resolve(options.path);
5514
+ const projectPath = path7.resolve(options.path);
5378
5515
  let port = parseInt(options.port, 10);
5379
5516
  const host = options.host;
5380
5517
  const useHmr = options.hmr !== false;
@@ -5403,15 +5540,15 @@ program.command("dev").description("Run development server with auto-reload and
5403
5540
  // Preserve user-provided MCP_URL (e.g., for reverse proxy setups)
5404
5541
  MCP_URL: process.env.MCP_URL || mcpUrl
5405
5542
  };
5406
- const { createRequire: createRequire3 } = await import("module");
5543
+ const { createRequire: createRequire4 } = await import("module");
5407
5544
  let cmd;
5408
5545
  let args;
5409
5546
  try {
5410
- const projectRequire = createRequire3(
5411
- path6.join(projectPath, "package.json")
5547
+ const projectRequire = createRequire4(
5548
+ path7.join(projectPath, "package.json")
5412
5549
  );
5413
5550
  const tsxPkgPath = projectRequire.resolve("tsx/package.json");
5414
- const tsxPkg = JSON.parse(await readFile2(tsxPkgPath, "utf-8"));
5551
+ const tsxPkg = JSON.parse(await readFile3(tsxPkgPath, "utf-8"));
5415
5552
  let binPath;
5416
5553
  if (typeof tsxPkg.bin === "string") {
5417
5554
  binPath = tsxPkg.bin;
@@ -5420,7 +5557,7 @@ program.command("dev").description("Run development server with auto-reload and
5420
5557
  } else {
5421
5558
  throw new Error("No bin field found in tsx package.json");
5422
5559
  }
5423
- const tsxBin = path6.resolve(path6.dirname(tsxPkgPath), binPath);
5560
+ const tsxBin = path7.resolve(path7.dirname(tsxPkgPath), binPath);
5424
5561
  cmd = "node";
5425
5562
  args = [tsxBin, "watch", serverFile];
5426
5563
  } catch (error) {
@@ -5476,11 +5613,11 @@ program.command("dev").description("Run development server with auto-reload and
5476
5613
  const chokidarModule = await import("chokidar");
5477
5614
  const chokidar = chokidarModule.default || chokidarModule;
5478
5615
  const { pathToFileURL, fileURLToPath: fileURLToPath3 } = await import("url");
5479
- const { createRequire: createRequire2 } = await import("module");
5616
+ const { createRequire: createRequire3 } = await import("module");
5480
5617
  let tsImport = null;
5481
5618
  try {
5482
- const projectRequire = createRequire2(
5483
- path6.join(projectPath, "package.json")
5619
+ const projectRequire = createRequire3(
5620
+ path7.join(projectPath, "package.json")
5484
5621
  );
5485
5622
  const tsxApiPath = projectRequire.resolve("tsx/esm/api");
5486
5623
  const tsxApi = await import(pathToFileURL(tsxApiPath).href);
@@ -5492,7 +5629,7 @@ program.command("dev").description("Run development server with auto-reload and
5492
5629
  )
5493
5630
  );
5494
5631
  }
5495
- const serverFilePath = path6.join(projectPath, serverFile);
5632
+ const serverFilePath = path7.join(projectPath, serverFile);
5496
5633
  const serverFileUrl = pathToFileURL(serverFilePath).href;
5497
5634
  globalThis.__mcpUseHmrMode = true;
5498
5635
  const importServerModule = async () => {
@@ -5592,8 +5729,8 @@ program.command("dev").description("Run development server with auto-reload and
5592
5729
  }
5593
5730
  const watcher = chokidar.watch(".", {
5594
5731
  cwd: projectPath,
5595
- ignored: (path7, stats) => {
5596
- const normalizedPath = path7.replace(/\\/g, "/");
5732
+ ignored: (path8, stats) => {
5733
+ const normalizedPath = path8.replace(/\\/g, "/");
5597
5734
  if (/(^|\/)\.[^/]/.test(normalizedPath)) {
5598
5735
  return true;
5599
5736
  }
@@ -5726,7 +5863,7 @@ program.command("dev").description("Run development server with auto-reload and
5726
5863
  });
5727
5864
  program.command("start").description("Start production server").option("-p, --path <path>", "Path to project directory", process.cwd()).option("--port <port>", "Server port", "3000").option("--tunnel", "Expose server through a tunnel").action(async (options) => {
5728
5865
  try {
5729
- const projectPath = path6.resolve(options.path);
5866
+ const projectPath = path7.resolve(options.path);
5730
5867
  const portFlagProvided = process.argv.includes("--port") || process.argv.includes("-p") || process.argv.some((arg) => arg.startsWith("--port=")) || process.argv.some((arg) => arg.startsWith("-p="));
5731
5868
  const port = portFlagProvided ? parseInt(options.port, 10) : parseInt(process.env.PORT || options.port || "3000", 10);
5732
5869
  console.log(
@@ -5738,10 +5875,10 @@ program.command("start").description("Start production server").option("-p, --pa
5738
5875
  let tunnelSubdomain = void 0;
5739
5876
  if (options.tunnel) {
5740
5877
  try {
5741
- const manifestPath2 = path6.join(projectPath, "dist", "mcp-use.json");
5878
+ const manifestPath2 = path7.join(projectPath, "dist", "mcp-use.json");
5742
5879
  let existingSubdomain;
5743
5880
  try {
5744
- const manifestContent = await readFile2(manifestPath2, "utf-8");
5881
+ const manifestContent = await readFile3(manifestPath2, "utf-8");
5745
5882
  const manifest = JSON.parse(manifestContent);
5746
5883
  existingSubdomain = manifest.tunnel?.subdomain;
5747
5884
  if (existingSubdomain) {
@@ -5764,7 +5901,7 @@ program.command("start").description("Start production server").option("-p, --pa
5764
5901
  try {
5765
5902
  let manifest = {};
5766
5903
  try {
5767
- const manifestContent = await readFile2(manifestPath2, "utf-8");
5904
+ const manifestContent = await readFile3(manifestPath2, "utf-8");
5768
5905
  manifest = JSON.parse(manifestContent);
5769
5906
  } catch {
5770
5907
  }
@@ -5772,8 +5909,8 @@ program.command("start").description("Start production server").option("-p, --pa
5772
5909
  manifest.tunnel = {};
5773
5910
  }
5774
5911
  manifest.tunnel.subdomain = subdomain;
5775
- await mkdir2(path6.dirname(manifestPath2), { recursive: true });
5776
- await writeFile2(
5912
+ await mkdir3(path7.dirname(manifestPath2), { recursive: true });
5913
+ await writeFile3(
5777
5914
  manifestPath2,
5778
5915
  JSON.stringify(manifest, null, 2),
5779
5916
  "utf-8"
@@ -5791,12 +5928,12 @@ program.command("start").description("Start production server").option("-p, --pa
5791
5928
  }
5792
5929
  }
5793
5930
  let serverFile;
5794
- const manifestPath = path6.join(projectPath, "dist", "mcp-use.json");
5931
+ const manifestPath = path7.join(projectPath, "dist", "mcp-use.json");
5795
5932
  try {
5796
- const manifestContent = await readFile2(manifestPath, "utf-8");
5933
+ const manifestContent = await readFile3(manifestPath, "utf-8");
5797
5934
  const manifest = JSON.parse(manifestContent);
5798
5935
  if (manifest.entryPoint) {
5799
- await access(path6.join(projectPath, manifest.entryPoint));
5936
+ await access(path7.join(projectPath, manifest.entryPoint));
5800
5937
  serverFile = manifest.entryPoint;
5801
5938
  }
5802
5939
  } catch {
@@ -5810,7 +5947,7 @@ program.command("start").description("Start production server").option("-p, --pa
5810
5947
  ];
5811
5948
  for (const candidate of serverCandidates) {
5812
5949
  try {
5813
- await access(path6.join(projectPath, candidate));
5950
+ await access(path7.join(projectPath, candidate));
5814
5951
  serverFile = candidate;
5815
5952
  break;
5816
5953
  } catch {
@@ -5947,8 +6084,8 @@ program.addCommand(createSkillsCommand());
5947
6084
  program.command("generate-types").description(
5948
6085
  "Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
5949
6086
  ).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {
5950
- const projectPath = path6.resolve(options.path);
5951
- const serverFile = path6.join(projectPath, options.server);
6087
+ const projectPath = path7.resolve(options.path);
6088
+ const serverFile = path7.join(projectPath, options.server);
5952
6089
  try {
5953
6090
  if (!await access(serverFile).then(() => true).catch(() => false)) {
5954
6091
  console.error(source_default.red(`Server file not found: ${serverFile}`));
@@ -5959,7 +6096,7 @@ program.command("generate-types").description(
5959
6096
  const { tsImport } = await import("tsx/esm/api");
5960
6097
  await tsImport(serverFile, {
5961
6098
  parentURL: import.meta.url,
5962
- tsconfig: path6.join(projectPath, "tsconfig.json")
6099
+ tsconfig: path7.join(projectPath, "tsconfig.json")
5963
6100
  });
5964
6101
  const server = globalThis.__mcpUseLastServer;
5965
6102
  if (!server) {
@@ -5970,8 +6107,8 @@ program.command("generate-types").description(
5970
6107
  );
5971
6108
  process.exit(1);
5972
6109
  }
5973
- const mcpUsePath = path6.join(projectPath, "node_modules", "mcp-use");
5974
- const { generateToolRegistryTypes } = await import(path6.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
6110
+ const mcpUsePath = path7.join(projectPath, "node_modules", "mcp-use");
6111
+ const { generateToolRegistryTypes } = await import(path7.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
5975
6112
  if (!generateToolRegistryTypes) {
5976
6113
  throw new Error(
5977
6114
  "generateToolRegistryTypes not found in mcp-use package"
@@ -5993,5 +6130,9 @@ program.command("generate-types").description(
5993
6130
  globalThis.__mcpUseHmrMode = false;
5994
6131
  }
5995
6132
  });
6133
+ program.hook("preAction", async (_thisCommand, actionCommand) => {
6134
+ const projectPath = actionCommand.opts().path;
6135
+ await notifyIfUpdateAvailable(projectPath);
6136
+ });
5996
6137
  program.parse();
5997
6138
  //# sourceMappingURL=index.js.map