@mcp-use/cli 2.13.10 → 2.14.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.cjs CHANGED
@@ -523,13 +523,13 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
523
523
  var source_default = chalk;
524
524
 
525
525
  // src/index.ts
526
- var import_commander3 = require("commander");
526
+ var import_commander4 = require("commander");
527
527
  var import_config5 = require("dotenv/config");
528
528
  var import_node_child_process9 = require("child_process");
529
- var import_node_fs8 = require("fs");
530
- var import_promises5 = require("fs/promises");
529
+ var import_node_fs9 = require("fs");
530
+ var import_promises6 = require("fs/promises");
531
531
  var import_node_module = require("module");
532
- var import_node_path6 = __toESM(require("path"), 1);
532
+ var import_node_path7 = __toESM(require("path"), 1);
533
533
 
534
534
  // ../../node_modules/.pnpm/open@11.0.0/node_modules/open/index.js
535
535
  var import_node_process8 = __toESM(require("process"), 1);
@@ -1037,19 +1037,19 @@ var baseOpen = async (options) => {
1037
1037
  }
1038
1038
  const subprocess = import_node_child_process7.default.spawn(command, cliArguments, childProcessOptions);
1039
1039
  if (options.wait) {
1040
- return new Promise((resolve, reject) => {
1040
+ return new Promise((resolve2, reject) => {
1041
1041
  subprocess.once("error", reject);
1042
1042
  subprocess.once("close", (exitCode) => {
1043
1043
  if (!options.allowNonzeroExitCode && exitCode !== 0) {
1044
1044
  reject(new Error(`Exited with code ${exitCode}`));
1045
1045
  return;
1046
1046
  }
1047
- resolve(subprocess);
1047
+ resolve2(subprocess);
1048
1048
  });
1049
1049
  });
1050
1050
  }
1051
1051
  if (isFallbackAttempt) {
1052
- return new Promise((resolve, reject) => {
1052
+ return new Promise((resolve2, reject) => {
1053
1053
  subprocess.once("error", reject);
1054
1054
  subprocess.once("spawn", () => {
1055
1055
  subprocess.once("close", (exitCode) => {
@@ -1059,17 +1059,17 @@ var baseOpen = async (options) => {
1059
1059
  return;
1060
1060
  }
1061
1061
  subprocess.unref();
1062
- resolve(subprocess);
1062
+ resolve2(subprocess);
1063
1063
  });
1064
1064
  });
1065
1065
  });
1066
1066
  }
1067
1067
  subprocess.unref();
1068
- return new Promise((resolve, reject) => {
1068
+ return new Promise((resolve2, reject) => {
1069
1069
  subprocess.once("error", reject);
1070
1070
  subprocess.once("spawn", () => {
1071
1071
  subprocess.off("error", reject);
1072
- resolve(subprocess);
1072
+ resolve2(subprocess);
1073
1073
  });
1074
1074
  });
1075
1075
  };
@@ -1515,12 +1515,12 @@ var LOGIN_TIMEOUT = 3e5;
1515
1515
  async function findAvailablePort(startPort = 8765) {
1516
1516
  for (let port = startPort; port < startPort + 100; port++) {
1517
1517
  try {
1518
- await new Promise((resolve, reject) => {
1518
+ await new Promise((resolve2, reject) => {
1519
1519
  const server = (0, import_node_http.createServer)();
1520
1520
  server.once("error", reject);
1521
1521
  server.once("listening", () => {
1522
1522
  server.close();
1523
- resolve();
1523
+ resolve2();
1524
1524
  });
1525
1525
  server.listen(port);
1526
1526
  });
@@ -1532,7 +1532,7 @@ async function findAvailablePort(startPort = 8765) {
1532
1532
  throw new Error("No available ports found");
1533
1533
  }
1534
1534
  async function startCallbackServer(port, expectedState) {
1535
- return new Promise((resolve, reject) => {
1535
+ return new Promise((resolve2, reject) => {
1536
1536
  let tokenResolver = null;
1537
1537
  const tokenPromise = new Promise((res) => {
1538
1538
  tokenResolver = res;
@@ -1774,7 +1774,7 @@ async function startCallbackServer(port, expectedState) {
1774
1774
  }
1775
1775
  );
1776
1776
  server.listen(port, () => {
1777
- resolve({ server, token: tokenPromise });
1777
+ resolve2({ server, token: tokenPromise });
1778
1778
  });
1779
1779
  server.on("error", reject);
1780
1780
  });
@@ -3272,14 +3272,14 @@ async function prompt(question, defaultValue = "n") {
3272
3272
  /(\(y\/n\):)/,
3273
3273
  `(${defaultIndicator}):`
3274
3274
  );
3275
- return new Promise((resolve) => {
3275
+ return new Promise((resolve2) => {
3276
3276
  rl.question(questionWithDefault, (answer) => {
3277
3277
  rl.close();
3278
3278
  const trimmedAnswer = answer.trim().toLowerCase();
3279
3279
  if (trimmedAnswer === "") {
3280
- resolve(defaultValue === "y");
3280
+ resolve2(defaultValue === "y");
3281
3281
  } else {
3282
- resolve(trimmedAnswer === "y" || trimmedAnswer === "yes");
3282
+ resolve2(trimmedAnswer === "y" || trimmedAnswer === "yes");
3283
3283
  }
3284
3284
  });
3285
3285
  });
@@ -3356,7 +3356,7 @@ async function displayDeploymentProgress(api, deployment) {
3356
3356
  let lastDisplayedLogLength = 0;
3357
3357
  while (checkCount < maxChecks) {
3358
3358
  const currentDelay = delay;
3359
- await new Promise((resolve) => setTimeout(resolve, currentDelay));
3359
+ await new Promise((resolve2) => setTimeout(resolve2, currentDelay));
3360
3360
  const finalDeployment = await api.getDeployment(deployment.id);
3361
3361
  if (finalDeployment.buildLogs && finalDeployment.buildLogs.length > lastDisplayedLogLength) {
3362
3362
  const newLogs = finalDeployment.buildLogs.substring(
@@ -3980,11 +3980,11 @@ async function prompt2(question) {
3980
3980
  input: process.stdin,
3981
3981
  output: process.stdout
3982
3982
  });
3983
- return new Promise((resolve) => {
3983
+ return new Promise((resolve2) => {
3984
3984
  rl.question(question, (answer) => {
3985
3985
  rl.close();
3986
3986
  const trimmedAnswer = answer.trim().toLowerCase();
3987
- resolve(trimmedAnswer === "y" || trimmedAnswer === "yes");
3987
+ resolve2(trimmedAnswer === "y" || trimmedAnswer === "yes");
3988
3988
  });
3989
3989
  });
3990
3990
  }
@@ -4499,10 +4499,126 @@ function createDeploymentsCommand() {
4499
4499
  return deploymentsCommand;
4500
4500
  }
4501
4501
 
4502
+ // src/commands/skills.ts
4503
+ var import_commander3 = require("commander");
4504
+ var import_node_fs8 = require("fs");
4505
+ var import_node_os5 = require("os");
4506
+ var import_node_path6 = require("path");
4507
+ var import_node_stream = require("stream");
4508
+ var import_promises5 = require("stream/promises");
4509
+ var import_tar = require("tar");
4510
+ var REPO_OWNER = "mcp-use";
4511
+ var REPO_NAME = "mcp-use";
4512
+ var REPO_BRANCH = "main";
4513
+ var TELEMETRY_URL = "https://add-skill.vercel.sh/t";
4514
+ var SOURCE_REPO = `${REPO_OWNER}/${REPO_NAME}`;
4515
+ var AGENT_PRESET_FOLDERS = {
4516
+ cursor: ".cursor",
4517
+ "claude-code": ".claude",
4518
+ codex: ".agent"
4519
+ };
4520
+ var ALL_PRESETS = ["cursor", "claude-code", "codex"];
4521
+ function sendInstallTelemetryEvent(agents, skills) {
4522
+ const telemetryData = {
4523
+ event: "install",
4524
+ source: SOURCE_REPO,
4525
+ skills,
4526
+ agents,
4527
+ sourceType: "github"
4528
+ };
4529
+ try {
4530
+ const params = new URLSearchParams();
4531
+ for (const [key, value] of Object.entries(telemetryData)) {
4532
+ if (value !== void 0 && value !== null) {
4533
+ params.set(key, String(value));
4534
+ }
4535
+ }
4536
+ fetch(`${TELEMETRY_URL}?${params.toString()}`).catch(() => {
4537
+ });
4538
+ } catch {
4539
+ }
4540
+ }
4541
+ async function addSkillsToProject(projectPath) {
4542
+ const tarballUrl = `https://codeload.github.com/${REPO_OWNER}/${REPO_NAME}/tar.gz/${REPO_BRANCH}`;
4543
+ const tempDir = (0, import_node_fs8.mkdtempSync)((0, import_node_path6.join)((0, import_node_os5.tmpdir)(), "mcp-use-skills-"));
4544
+ try {
4545
+ const response = await fetch(tarballUrl);
4546
+ if (!response.ok) {
4547
+ throw new Error(`Failed to download tarball: ${response.statusText}`);
4548
+ }
4549
+ await (0, import_promises5.pipeline)(
4550
+ import_node_stream.Readable.fromWeb(response.body),
4551
+ (0, import_tar.extract)({
4552
+ cwd: tempDir,
4553
+ filter: (path6) => path6.includes("/skills/"),
4554
+ strip: 1
4555
+ })
4556
+ );
4557
+ const skillsPath = (0, import_node_path6.join)(tempDir, "skills");
4558
+ if (!(0, import_node_fs8.existsSync)(skillsPath)) {
4559
+ throw new Error("Skills folder not found in repository");
4560
+ }
4561
+ for (const preset of ALL_PRESETS) {
4562
+ const folderName = AGENT_PRESET_FOLDERS[preset];
4563
+ const outputPath = (0, import_node_path6.join)(projectPath, folderName, "skills");
4564
+ (0, import_node_fs8.cpSync)(skillsPath, outputPath, { recursive: true });
4565
+ }
4566
+ const skillNames = (0, import_node_fs8.readdirSync)(skillsPath, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
4567
+ sendInstallTelemetryEvent(ALL_PRESETS.join(","), skillNames.join(","));
4568
+ } finally {
4569
+ (0, import_node_fs8.rmSync)(tempDir, { recursive: true, force: true });
4570
+ }
4571
+ }
4572
+ function createSkillsCommand() {
4573
+ const skills = new import_commander3.Command("skills").description(
4574
+ "Manage mcp-use AI agent skills"
4575
+ );
4576
+ const installAction = async (options) => {
4577
+ const projectPath = (0, import_node_path6.resolve)(options.path);
4578
+ if (!(0, import_node_fs8.existsSync)(projectPath)) {
4579
+ console.error(source_default.red(`Directory not found: ${projectPath}`));
4580
+ process.exit(1);
4581
+ }
4582
+ console.log(source_default.cyan("\u{1F4DA} Installing mcp-use skills..."));
4583
+ console.log(
4584
+ source_default.gray(
4585
+ " Downloading from github.com/mcp-use/mcp-use \u2192 .cursor/skills, .claude/skills, .agent/skills"
4586
+ )
4587
+ );
4588
+ try {
4589
+ await addSkillsToProject(projectPath);
4590
+ console.log(source_default.green("\u2705 Skills installed successfully!"));
4591
+ } catch (error) {
4592
+ console.error(source_default.red("\u274C Failed to install skills."));
4593
+ console.error(
4594
+ source_default.yellow(
4595
+ ` Error: ${error instanceof Error ? error.message : String(error)}`
4596
+ )
4597
+ );
4598
+ console.error(
4599
+ source_default.yellow(
4600
+ " You can also install manually: npx skills add mcp-use/mcp-use"
4601
+ )
4602
+ );
4603
+ process.exit(1);
4604
+ }
4605
+ };
4606
+ const pathOption = [
4607
+ "-p, --path <path>",
4608
+ "Path to project directory",
4609
+ process.cwd()
4610
+ ];
4611
+ skills.command("add").description(
4612
+ "Install mcp-use skills for AI agents (Cursor, Claude Code, Codex)"
4613
+ ).option(...pathOption).action(installAction);
4614
+ skills.command("install").description("Install mcp-use skills for AI agents (alias for 'add')").option(...pathOption).action(installAction);
4615
+ return skills;
4616
+ }
4617
+
4502
4618
  // src/index.ts
4503
- var program = new import_commander3.Command();
4504
- var packageContent = (0, import_node_fs8.readFileSync)(
4505
- import_node_path6.default.join(__dirname, "../package.json"),
4619
+ var program = new import_commander4.Command();
4620
+ var packageContent = (0, import_node_fs9.readFileSync)(
4621
+ import_node_path7.default.join(__dirname, "../package.json"),
4506
4622
  "utf-8"
4507
4623
  );
4508
4624
  var packageJson = JSON.parse(packageContent);
@@ -4533,16 +4649,16 @@ function displayPackageVersions(projectPath) {
4533
4649
  if (projectPath) {
4534
4650
  try {
4535
4651
  const projectRequire = (0, import_node_module.createRequire)(
4536
- import_node_path6.default.join(projectPath, "package.json")
4652
+ import_node_path7.default.join(projectPath, "package.json")
4537
4653
  );
4538
4654
  pkgPath = projectRequire.resolve(`${pkg.name}/package.json`);
4539
4655
  } catch (resolveError) {
4540
- pkgPath = import_node_path6.default.join(__dirname, pkg.relativePath);
4656
+ pkgPath = import_node_path7.default.join(__dirname, pkg.relativePath);
4541
4657
  }
4542
4658
  } else {
4543
- pkgPath = import_node_path6.default.join(__dirname, pkg.relativePath);
4659
+ pkgPath = import_node_path7.default.join(__dirname, pkg.relativePath);
4544
4660
  }
4545
- const pkgContent = (0, import_node_fs8.readFileSync)(pkgPath, "utf-8");
4661
+ const pkgContent = (0, import_node_fs9.readFileSync)(pkgPath, "utf-8");
4546
4662
  const pkgJson = JSON.parse(pkgContent);
4547
4663
  const version = pkgJson.version || "unknown";
4548
4664
  if (pkg.highlight) {
@@ -4589,7 +4705,7 @@ async function waitForServer(port, host = "localhost", maxAttempts = 30) {
4589
4705
  } finally {
4590
4706
  controller.abort();
4591
4707
  }
4592
- await new Promise((resolve) => setTimeout(resolve, 1e3));
4708
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
4593
4709
  }
4594
4710
  return false;
4595
4711
  }
@@ -4611,11 +4727,11 @@ function runCommand(command, args, cwd, env2, filterStderr = false) {
4611
4727
  }
4612
4728
  });
4613
4729
  }
4614
- const promise = new Promise((resolve, reject) => {
4730
+ const promise = new Promise((resolve2, reject) => {
4615
4731
  proc.on("error", reject);
4616
4732
  proc.on("exit", (code) => {
4617
4733
  if (code === 0 || code === 130 || code === 143) {
4618
- resolve();
4734
+ resolve2();
4619
4735
  } else {
4620
4736
  reject(new Error(`Command failed with exit code ${code}`));
4621
4737
  }
@@ -4624,7 +4740,7 @@ function runCommand(command, args, cwd, env2, filterStderr = false) {
4624
4740
  return { promise, process: proc };
4625
4741
  }
4626
4742
  async function startTunnel(port, subdomain) {
4627
- return new Promise((resolve, reject) => {
4743
+ return new Promise((resolve2, reject) => {
4628
4744
  console.log(source_default.gray(`Starting tunnel for port ${port}...`));
4629
4745
  const tunnelArgs = ["--yes", "@mcp-use/tunnel", String(port)];
4630
4746
  if (subdomain) {
@@ -4659,7 +4775,7 @@ async function startTunnel(port, subdomain) {
4659
4775
  resolved = true;
4660
4776
  clearTimeout(setupTimeout);
4661
4777
  console.log(source_default.green.bold(`\u2713 Tunnel established: ${url}/mcp`));
4662
- resolve({ url, subdomain: extractedSubdomain, process: proc });
4778
+ resolve2({ url, subdomain: extractedSubdomain, process: proc });
4663
4779
  }
4664
4780
  });
4665
4781
  proc.stderr?.on("data", (data) => {
@@ -4695,7 +4811,7 @@ async function findServerFile(projectPath) {
4695
4811
  const candidates = ["index.ts", "src/index.ts", "server.ts", "src/server.ts"];
4696
4812
  for (const candidate of candidates) {
4697
4813
  try {
4698
- await (0, import_promises5.access)(import_node_path6.default.join(projectPath, candidate));
4814
+ await (0, import_promises6.access)(import_node_path7.default.join(projectPath, candidate));
4699
4815
  return candidate;
4700
4816
  } catch {
4701
4817
  continue;
@@ -4707,10 +4823,10 @@ async function buildWidgets(projectPath, options = {}) {
4707
4823
  const { inline = true } = options;
4708
4824
  const { promises: fs10 } = await import("fs");
4709
4825
  const { build } = await import("vite");
4710
- const resourcesDir = import_node_path6.default.join(projectPath, "resources");
4826
+ const resourcesDir = import_node_path7.default.join(projectPath, "resources");
4711
4827
  const mcpUrl = process.env.MCP_URL;
4712
4828
  try {
4713
- await (0, import_promises5.access)(resourcesDir);
4829
+ await (0, import_promises6.access)(resourcesDir);
4714
4830
  } catch {
4715
4831
  console.log(
4716
4832
  source_default.gray("No resources/ directory found - skipping widget build")
@@ -4727,10 +4843,10 @@ async function buildWidgets(projectPath, options = {}) {
4727
4843
  if (dirent.isFile() && (dirent.name.endsWith(".tsx") || dirent.name.endsWith(".ts"))) {
4728
4844
  entries.push({
4729
4845
  name: dirent.name.replace(/\.tsx?$/, ""),
4730
- path: import_node_path6.default.join(resourcesDir, dirent.name)
4846
+ path: import_node_path7.default.join(resourcesDir, dirent.name)
4731
4847
  });
4732
4848
  } else if (dirent.isDirectory()) {
4733
- const widgetPath = import_node_path6.default.join(resourcesDir, dirent.name, "widget.tsx");
4849
+ const widgetPath = import_node_path7.default.join(resourcesDir, dirent.name, "widget.tsx");
4734
4850
  try {
4735
4851
  await fs10.access(widgetPath);
4736
4852
  entries.push({
@@ -4756,7 +4872,7 @@ async function buildWidgets(projectPath, options = {}) {
4756
4872
  );
4757
4873
  const react = (await import("@vitejs/plugin-react")).default;
4758
4874
  const tailwindcss = (await import("@tailwindcss/vite")).default;
4759
- const packageJsonPath = import_node_path6.default.join(projectPath, "package.json");
4875
+ const packageJsonPath = import_node_path7.default.join(projectPath, "package.json");
4760
4876
  let favicon = "";
4761
4877
  try {
4762
4878
  const pkgContent = await fs10.readFile(packageJsonPath, "utf-8");
@@ -4768,18 +4884,18 @@ async function buildWidgets(projectPath, options = {}) {
4768
4884
  const widgetName = entry.name;
4769
4885
  const entryPath = entry.path.replace(/\\/g, "/");
4770
4886
  console.log(source_default.gray(` - Building ${widgetName}...`));
4771
- const tempDir = import_node_path6.default.join(projectPath, ".mcp-use", widgetName);
4887
+ const tempDir = import_node_path7.default.join(projectPath, ".mcp-use", widgetName);
4772
4888
  await fs10.mkdir(tempDir, { recursive: true });
4773
- const relativeResourcesPath = import_node_path6.default.relative(tempDir, resourcesDir).replace(/\\/g, "/");
4774
- const mcpUsePath = import_node_path6.default.join(projectPath, "node_modules", "mcp-use");
4775
- const relativeMcpUsePath = import_node_path6.default.relative(tempDir, mcpUsePath).replace(/\\/g, "/");
4889
+ const relativeResourcesPath = import_node_path7.default.relative(tempDir, resourcesDir).replace(/\\/g, "/");
4890
+ const mcpUsePath = import_node_path7.default.join(projectPath, "node_modules", "mcp-use");
4891
+ const relativeMcpUsePath = import_node_path7.default.relative(tempDir, mcpUsePath).replace(/\\/g, "/");
4776
4892
  const cssContent = `@import "tailwindcss";
4777
4893
 
4778
4894
  /* Configure Tailwind to scan the resources directory and mcp-use package */
4779
4895
  @source "${relativeResourcesPath}";
4780
4896
  @source "${relativeMcpUsePath}/**/*.{ts,tsx,js,jsx}";
4781
4897
  `;
4782
- await fs10.writeFile(import_node_path6.default.join(tempDir, "styles.css"), cssContent, "utf8");
4898
+ await fs10.writeFile(import_node_path7.default.join(tempDir, "styles.css"), cssContent, "utf8");
4783
4899
  const entryContent = `import React from 'react'
4784
4900
  import { createRoot } from 'react-dom/client'
4785
4901
  import './styles.css'
@@ -4804,9 +4920,9 @@ if (container && Component) {
4804
4920
  <script type="module" src="/entry.tsx"></script>
4805
4921
  </body>
4806
4922
  </html>`;
4807
- await fs10.writeFile(import_node_path6.default.join(tempDir, "entry.tsx"), entryContent, "utf8");
4808
- await fs10.writeFile(import_node_path6.default.join(tempDir, "index.html"), htmlContent, "utf8");
4809
- const outDir = import_node_path6.default.join(
4923
+ await fs10.writeFile(import_node_path7.default.join(tempDir, "entry.tsx"), entryContent, "utf8");
4924
+ await fs10.writeFile(import_node_path7.default.join(tempDir, "index.html"), htmlContent, "utf8");
4925
+ const outDir = import_node_path7.default.join(
4810
4926
  projectPath,
4811
4927
  "dist",
4812
4928
  "resources",
@@ -4816,7 +4932,7 @@ if (container && Component) {
4816
4932
  const baseUrl = mcpUrl ? `${mcpUrl}/${widgetName}/` : `/mcp-use/widgets/${widgetName}/`;
4817
4933
  let widgetMetadata = {};
4818
4934
  try {
4819
- const metadataTempDir = import_node_path6.default.join(
4935
+ const metadataTempDir = import_node_path7.default.join(
4820
4936
  projectPath,
4821
4937
  ".mcp-use",
4822
4938
  `${widgetName}-metadata`
@@ -4851,7 +4967,7 @@ export default PostHog;
4851
4967
  };
4852
4968
  const metadataServer = await createServer2({
4853
4969
  root: metadataTempDir,
4854
- cacheDir: import_node_path6.default.join(metadataTempDir, ".vite-cache"),
4970
+ cacheDir: import_node_path7.default.join(metadataTempDir, ".vite-cache"),
4855
4971
  plugins: [nodeStubsPlugin, tailwindcss(), react()],
4856
4972
  resolve: {
4857
4973
  alias: {
@@ -4928,7 +5044,7 @@ export default PostHog;
4928
5044
  inputs: inputsValue
4929
5045
  };
4930
5046
  }
4931
- await new Promise((resolve) => setTimeout(resolve, 50));
5047
+ await new Promise((resolve2) => setTimeout(resolve2, 50));
4932
5048
  } catch (error) {
4933
5049
  console.warn(
4934
5050
  source_default.yellow(` \u26A0 Could not extract metadata for ${widgetName}`)
@@ -5081,7 +5197,7 @@ export default {
5081
5197
  // Inline all assets under 100MB (effectively all)
5082
5198
  } : {},
5083
5199
  rollupOptions: {
5084
- input: import_node_path6.default.join(tempDir, "index.html"),
5200
+ input: import_node_path7.default.join(tempDir, "index.html"),
5085
5201
  external: (id) => {
5086
5202
  return false;
5087
5203
  }
@@ -5089,11 +5205,11 @@ export default {
5089
5205
  }
5090
5206
  });
5091
5207
  try {
5092
- const assetsDir = import_node_path6.default.join(outDir, "assets");
5208
+ const assetsDir = import_node_path7.default.join(outDir, "assets");
5093
5209
  const assetFiles = await fs10.readdir(assetsDir);
5094
5210
  const jsFiles = assetFiles.filter((f) => f.endsWith(".js"));
5095
5211
  for (const jsFile of jsFiles) {
5096
- const jsPath = import_node_path6.default.join(assetsDir, jsFile);
5212
+ const jsPath = import_node_path7.default.join(assetsDir, jsFile);
5097
5213
  let content = await fs10.readFile(jsPath, "utf8");
5098
5214
  const zodConfigPatterns = [
5099
5215
  // Non-minified: export const globalConfig = {}
@@ -5125,7 +5241,7 @@ export default {
5125
5241
  const mcpServerUrl = process.env.MCP_SERVER_URL;
5126
5242
  if (mcpServerUrl) {
5127
5243
  try {
5128
- const htmlPath = import_node_path6.default.join(outDir, "index.html");
5244
+ const htmlPath = import_node_path7.default.join(outDir, "index.html");
5129
5245
  let html = await fs10.readFile(htmlPath, "utf8");
5130
5246
  const injectionScript = `<script>window.__getFile = (filename) => { return "${mcpUrl}/${widgetName}/"+filename }; window.__mcpPublicUrl = "${mcpServerUrl}/mcp-use/public"; window.__mcpPublicAssetsUrl = "${mcpUrl}/public";</script>`;
5131
5247
  if (!html.includes("window.__mcpPublicUrl")) {
@@ -5180,7 +5296,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5180
5296
  "Inline all JS/CSS into HTML (required for VS Code MCP Apps)"
5181
5297
  ).option("--no-inline", "Keep JS/CSS as separate files (default)").action(async (options) => {
5182
5298
  try {
5183
- const projectPath = import_node_path6.default.resolve(options.path);
5299
+ const projectPath = import_node_path7.default.resolve(options.path);
5184
5300
  const { promises: fs10 } = await import("fs");
5185
5301
  displayPackageVersions(projectPath);
5186
5302
  const builtWidgets = await buildWidgets(projectPath, {
@@ -5196,7 +5312,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5196
5312
  console.log(source_default.green("\u2713 TypeScript build complete!"));
5197
5313
  let entryPoint;
5198
5314
  if (sourceServerFile) {
5199
- const baseName = import_node_path6.default.basename(sourceServerFile, ".ts") + ".js";
5315
+ const baseName = import_node_path7.default.basename(sourceServerFile, ".ts") + ".js";
5200
5316
  const possibleOutputs = [
5201
5317
  `dist/${baseName}`,
5202
5318
  // rootDir set to project root or src
@@ -5207,7 +5323,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5207
5323
  ];
5208
5324
  for (const candidate of possibleOutputs) {
5209
5325
  try {
5210
- await (0, import_promises5.access)(import_node_path6.default.join(projectPath, candidate));
5326
+ await (0, import_promises6.access)(import_node_path7.default.join(projectPath, candidate));
5211
5327
  entryPoint = candidate;
5212
5328
  break;
5213
5329
  } catch {
@@ -5215,17 +5331,17 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5215
5331
  }
5216
5332
  }
5217
5333
  }
5218
- const publicDir = import_node_path6.default.join(projectPath, "public");
5334
+ const publicDir = import_node_path7.default.join(projectPath, "public");
5219
5335
  try {
5220
5336
  await fs10.access(publicDir);
5221
5337
  console.log(source_default.gray("Copying public assets..."));
5222
- await fs10.cp(publicDir, import_node_path6.default.join(projectPath, "dist", "public"), {
5338
+ await fs10.cp(publicDir, import_node_path7.default.join(projectPath, "dist", "public"), {
5223
5339
  recursive: true
5224
5340
  });
5225
5341
  console.log(source_default.green("\u2713 Public assets copied"));
5226
5342
  } catch {
5227
5343
  }
5228
- const manifestPath = import_node_path6.default.join(projectPath, "dist", "mcp-use.json");
5344
+ const manifestPath = import_node_path7.default.join(projectPath, "dist", "mcp-use.json");
5229
5345
  let existingManifest = {};
5230
5346
  try {
5231
5347
  const existingContent = await fs10.readFile(manifestPath, "utf-8");
@@ -5250,7 +5366,7 @@ program.command("build").description("Build TypeScript and MCP UI widgets").opti
5250
5366
  // Server entry point for `mcp-use start`
5251
5367
  widgets: widgetsData
5252
5368
  };
5253
- await fs10.mkdir(import_node_path6.default.dirname(manifestPath), { recursive: true });
5369
+ await fs10.mkdir(import_node_path7.default.dirname(manifestPath), { recursive: true });
5254
5370
  await fs10.writeFile(
5255
5371
  manifestPath,
5256
5372
  JSON.stringify(manifest, null, 2),
@@ -5276,7 +5392,7 @@ program.command("dev").description("Run development server with auto-reload and
5276
5392
  "0.0.0.0"
5277
5393
  ).option("--no-open", "Do not auto-open inspector").option("--no-hmr", "Disable hot module reloading (use tsx watch instead)").action(async (options) => {
5278
5394
  try {
5279
- const projectPath = import_node_path6.default.resolve(options.path);
5395
+ const projectPath = import_node_path7.default.resolve(options.path);
5280
5396
  let port = parseInt(options.port, 10);
5281
5397
  const host = options.host;
5282
5398
  const useHmr = options.hmr !== false;
@@ -5310,10 +5426,10 @@ program.command("dev").description("Run development server with auto-reload and
5310
5426
  let args;
5311
5427
  try {
5312
5428
  const projectRequire = createRequire3(
5313
- import_node_path6.default.join(projectPath, "package.json")
5429
+ import_node_path7.default.join(projectPath, "package.json")
5314
5430
  );
5315
5431
  const tsxPkgPath = projectRequire.resolve("tsx/package.json");
5316
- const tsxPkg = JSON.parse(await (0, import_promises5.readFile)(tsxPkgPath, "utf-8"));
5432
+ const tsxPkg = JSON.parse(await (0, import_promises6.readFile)(tsxPkgPath, "utf-8"));
5317
5433
  let binPath;
5318
5434
  if (typeof tsxPkg.bin === "string") {
5319
5435
  binPath = tsxPkg.bin;
@@ -5322,7 +5438,7 @@ program.command("dev").description("Run development server with auto-reload and
5322
5438
  } else {
5323
5439
  throw new Error("No bin field found in tsx package.json");
5324
5440
  }
5325
- const tsxBin = import_node_path6.default.resolve(import_node_path6.default.dirname(tsxPkgPath), binPath);
5441
+ const tsxBin = import_node_path7.default.resolve(import_node_path7.default.dirname(tsxPkgPath), binPath);
5326
5442
  cmd = "node";
5327
5443
  args = [tsxBin, "watch", serverFile];
5328
5444
  } catch (error) {
@@ -5382,7 +5498,7 @@ program.command("dev").description("Run development server with auto-reload and
5382
5498
  let tsImport = null;
5383
5499
  try {
5384
5500
  const projectRequire = createRequire2(
5385
- import_node_path6.default.join(projectPath, "package.json")
5501
+ import_node_path7.default.join(projectPath, "package.json")
5386
5502
  );
5387
5503
  const tsxApiPath = projectRequire.resolve("tsx/esm/api");
5388
5504
  const tsxApi = await import(pathToFileURL(tsxApiPath).href);
@@ -5394,7 +5510,7 @@ program.command("dev").description("Run development server with auto-reload and
5394
5510
  )
5395
5511
  );
5396
5512
  }
5397
- const serverFilePath = import_node_path6.default.join(projectPath, serverFile);
5513
+ const serverFilePath = import_node_path7.default.join(projectPath, serverFile);
5398
5514
  const serverFileUrl = pathToFileURL(serverFilePath).href;
5399
5515
  globalThis.__mcpUseHmrMode = true;
5400
5516
  const importServerModule = async () => {
@@ -5628,7 +5744,7 @@ program.command("dev").description("Run development server with auto-reload and
5628
5744
  });
5629
5745
  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) => {
5630
5746
  try {
5631
- const projectPath = import_node_path6.default.resolve(options.path);
5747
+ const projectPath = import_node_path7.default.resolve(options.path);
5632
5748
  const portFlagProvided = process.argv.includes("--port") || process.argv.includes("-p") || process.argv.some((arg) => arg.startsWith("--port=")) || process.argv.some((arg) => arg.startsWith("-p="));
5633
5749
  const port = portFlagProvided ? parseInt(options.port, 10) : parseInt(process.env.PORT || options.port || "3000", 10);
5634
5750
  console.log(
@@ -5640,10 +5756,10 @@ program.command("start").description("Start production server").option("-p, --pa
5640
5756
  let tunnelSubdomain = void 0;
5641
5757
  if (options.tunnel) {
5642
5758
  try {
5643
- const manifestPath2 = import_node_path6.default.join(projectPath, "dist", "mcp-use.json");
5759
+ const manifestPath2 = import_node_path7.default.join(projectPath, "dist", "mcp-use.json");
5644
5760
  let existingSubdomain;
5645
5761
  try {
5646
- const manifestContent = await (0, import_promises5.readFile)(manifestPath2, "utf-8");
5762
+ const manifestContent = await (0, import_promises6.readFile)(manifestPath2, "utf-8");
5647
5763
  const manifest = JSON.parse(manifestContent);
5648
5764
  existingSubdomain = manifest.tunnel?.subdomain;
5649
5765
  if (existingSubdomain) {
@@ -5666,7 +5782,7 @@ program.command("start").description("Start production server").option("-p, --pa
5666
5782
  try {
5667
5783
  let manifest = {};
5668
5784
  try {
5669
- const manifestContent = await (0, import_promises5.readFile)(manifestPath2, "utf-8");
5785
+ const manifestContent = await (0, import_promises6.readFile)(manifestPath2, "utf-8");
5670
5786
  manifest = JSON.parse(manifestContent);
5671
5787
  } catch {
5672
5788
  }
@@ -5674,8 +5790,8 @@ program.command("start").description("Start production server").option("-p, --pa
5674
5790
  manifest.tunnel = {};
5675
5791
  }
5676
5792
  manifest.tunnel.subdomain = subdomain;
5677
- await (0, import_promises5.mkdir)(import_node_path6.default.dirname(manifestPath2), { recursive: true });
5678
- await (0, import_promises5.writeFile)(
5793
+ await (0, import_promises6.mkdir)(import_node_path7.default.dirname(manifestPath2), { recursive: true });
5794
+ await (0, import_promises6.writeFile)(
5679
5795
  manifestPath2,
5680
5796
  JSON.stringify(manifest, null, 2),
5681
5797
  "utf-8"
@@ -5693,12 +5809,12 @@ program.command("start").description("Start production server").option("-p, --pa
5693
5809
  }
5694
5810
  }
5695
5811
  let serverFile;
5696
- const manifestPath = import_node_path6.default.join(projectPath, "dist", "mcp-use.json");
5812
+ const manifestPath = import_node_path7.default.join(projectPath, "dist", "mcp-use.json");
5697
5813
  try {
5698
- const manifestContent = await (0, import_promises5.readFile)(manifestPath, "utf-8");
5814
+ const manifestContent = await (0, import_promises6.readFile)(manifestPath, "utf-8");
5699
5815
  const manifest = JSON.parse(manifestContent);
5700
5816
  if (manifest.entryPoint) {
5701
- await (0, import_promises5.access)(import_node_path6.default.join(projectPath, manifest.entryPoint));
5817
+ await (0, import_promises6.access)(import_node_path7.default.join(projectPath, manifest.entryPoint));
5702
5818
  serverFile = manifest.entryPoint;
5703
5819
  }
5704
5820
  } catch {
@@ -5712,7 +5828,7 @@ program.command("start").description("Start production server").option("-p, --pa
5712
5828
  ];
5713
5829
  for (const candidate of serverCandidates) {
5714
5830
  try {
5715
- await (0, import_promises5.access)(import_node_path6.default.join(projectPath, candidate));
5831
+ await (0, import_promises6.access)(import_node_path7.default.join(projectPath, candidate));
5716
5832
  serverFile = candidate;
5717
5833
  break;
5718
5834
  } catch {
@@ -5845,13 +5961,14 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
5845
5961
  });
5846
5962
  program.addCommand(createClientCommand());
5847
5963
  program.addCommand(createDeploymentsCommand());
5964
+ program.addCommand(createSkillsCommand());
5848
5965
  program.command("generate-types").description(
5849
5966
  "Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
5850
5967
  ).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {
5851
- const projectPath = import_node_path6.default.resolve(options.path);
5852
- const serverFile = import_node_path6.default.join(projectPath, options.server);
5968
+ const projectPath = import_node_path7.default.resolve(options.path);
5969
+ const serverFile = import_node_path7.default.join(projectPath, options.server);
5853
5970
  try {
5854
- if (!await (0, import_promises5.access)(serverFile).then(() => true).catch(() => false)) {
5971
+ if (!await (0, import_promises6.access)(serverFile).then(() => true).catch(() => false)) {
5855
5972
  console.error(source_default.red(`Server file not found: ${serverFile}`));
5856
5973
  process.exit(1);
5857
5974
  }
@@ -5860,7 +5977,7 @@ program.command("generate-types").description(
5860
5977
  const { tsImport } = await import("tsx/esm/api");
5861
5978
  await tsImport(serverFile, {
5862
5979
  parentURL: importMetaUrl,
5863
- tsconfig: import_node_path6.default.join(projectPath, "tsconfig.json")
5980
+ tsconfig: import_node_path7.default.join(projectPath, "tsconfig.json")
5864
5981
  });
5865
5982
  const server = globalThis.__mcpUseLastServer;
5866
5983
  if (!server) {
@@ -5871,8 +5988,8 @@ program.command("generate-types").description(
5871
5988
  );
5872
5989
  process.exit(1);
5873
5990
  }
5874
- const mcpUsePath = import_node_path6.default.join(projectPath, "node_modules", "mcp-use");
5875
- const { generateToolRegistryTypes } = await import(import_node_path6.default.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
5991
+ const mcpUsePath = import_node_path7.default.join(projectPath, "node_modules", "mcp-use");
5992
+ const { generateToolRegistryTypes } = await import(import_node_path7.default.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
5876
5993
  if (!generateToolRegistryTypes) {
5877
5994
  throw new Error(
5878
5995
  "generateToolRegistryTypes not found in mcp-use package"