@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.js CHANGED
@@ -503,7 +503,7 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
503
503
  var source_default = chalk;
504
504
 
505
505
  // src/index.ts
506
- import { Command as Command3 } from "commander";
506
+ import { Command as Command4 } from "commander";
507
507
  import "dotenv/config";
508
508
  import { spawn } from "child_process";
509
509
  import { readFileSync } from "fs";
@@ -1017,19 +1017,19 @@ var baseOpen = async (options) => {
1017
1017
  }
1018
1018
  const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
1019
1019
  if (options.wait) {
1020
- return new Promise((resolve, reject) => {
1020
+ return new Promise((resolve2, reject) => {
1021
1021
  subprocess.once("error", reject);
1022
1022
  subprocess.once("close", (exitCode) => {
1023
1023
  if (!options.allowNonzeroExitCode && exitCode !== 0) {
1024
1024
  reject(new Error(`Exited with code ${exitCode}`));
1025
1025
  return;
1026
1026
  }
1027
- resolve(subprocess);
1027
+ resolve2(subprocess);
1028
1028
  });
1029
1029
  });
1030
1030
  }
1031
1031
  if (isFallbackAttempt) {
1032
- return new Promise((resolve, reject) => {
1032
+ return new Promise((resolve2, reject) => {
1033
1033
  subprocess.once("error", reject);
1034
1034
  subprocess.once("spawn", () => {
1035
1035
  subprocess.once("close", (exitCode) => {
@@ -1039,17 +1039,17 @@ var baseOpen = async (options) => {
1039
1039
  return;
1040
1040
  }
1041
1041
  subprocess.unref();
1042
- resolve(subprocess);
1042
+ resolve2(subprocess);
1043
1043
  });
1044
1044
  });
1045
1045
  });
1046
1046
  }
1047
1047
  subprocess.unref();
1048
- return new Promise((resolve, reject) => {
1048
+ return new Promise((resolve2, reject) => {
1049
1049
  subprocess.once("error", reject);
1050
1050
  subprocess.once("spawn", () => {
1051
1051
  subprocess.off("error", reject);
1052
- resolve(subprocess);
1052
+ resolve2(subprocess);
1053
1053
  });
1054
1054
  });
1055
1055
  };
@@ -1497,12 +1497,12 @@ var LOGIN_TIMEOUT = 3e5;
1497
1497
  async function findAvailablePort(startPort = 8765) {
1498
1498
  for (let port = startPort; port < startPort + 100; port++) {
1499
1499
  try {
1500
- await new Promise((resolve, reject) => {
1500
+ await new Promise((resolve2, reject) => {
1501
1501
  const server = createServer();
1502
1502
  server.once("error", reject);
1503
1503
  server.once("listening", () => {
1504
1504
  server.close();
1505
- resolve();
1505
+ resolve2();
1506
1506
  });
1507
1507
  server.listen(port);
1508
1508
  });
@@ -1514,7 +1514,7 @@ async function findAvailablePort(startPort = 8765) {
1514
1514
  throw new Error("No available ports found");
1515
1515
  }
1516
1516
  async function startCallbackServer(port, expectedState) {
1517
- return new Promise((resolve, reject) => {
1517
+ return new Promise((resolve2, reject) => {
1518
1518
  let tokenResolver = null;
1519
1519
  const tokenPromise = new Promise((res) => {
1520
1520
  tokenResolver = res;
@@ -1756,7 +1756,7 @@ async function startCallbackServer(port, expectedState) {
1756
1756
  }
1757
1757
  );
1758
1758
  server.listen(port, () => {
1759
- resolve({ server, token: tokenPromise });
1759
+ resolve2({ server, token: tokenPromise });
1760
1760
  });
1761
1761
  server.on("error", reject);
1762
1762
  });
@@ -3254,14 +3254,14 @@ async function prompt(question, defaultValue = "n") {
3254
3254
  /(\(y\/n\):)/,
3255
3255
  `(${defaultIndicator}):`
3256
3256
  );
3257
- return new Promise((resolve) => {
3257
+ return new Promise((resolve2) => {
3258
3258
  rl.question(questionWithDefault, (answer) => {
3259
3259
  rl.close();
3260
3260
  const trimmedAnswer = answer.trim().toLowerCase();
3261
3261
  if (trimmedAnswer === "") {
3262
- resolve(defaultValue === "y");
3262
+ resolve2(defaultValue === "y");
3263
3263
  } else {
3264
- resolve(trimmedAnswer === "y" || trimmedAnswer === "yes");
3264
+ resolve2(trimmedAnswer === "y" || trimmedAnswer === "yes");
3265
3265
  }
3266
3266
  });
3267
3267
  });
@@ -3338,7 +3338,7 @@ async function displayDeploymentProgress(api, deployment) {
3338
3338
  let lastDisplayedLogLength = 0;
3339
3339
  while (checkCount < maxChecks) {
3340
3340
  const currentDelay = delay;
3341
- await new Promise((resolve) => setTimeout(resolve, currentDelay));
3341
+ await new Promise((resolve2) => setTimeout(resolve2, currentDelay));
3342
3342
  const finalDeployment = await api.getDeployment(deployment.id);
3343
3343
  if (finalDeployment.buildLogs && finalDeployment.buildLogs.length > lastDisplayedLogLength) {
3344
3344
  const newLogs = finalDeployment.buildLogs.substring(
@@ -3962,11 +3962,11 @@ async function prompt2(question) {
3962
3962
  input: process.stdin,
3963
3963
  output: process.stdout
3964
3964
  });
3965
- return new Promise((resolve) => {
3965
+ return new Promise((resolve2) => {
3966
3966
  rl.question(question, (answer) => {
3967
3967
  rl.close();
3968
3968
  const trimmedAnswer = answer.trim().toLowerCase();
3969
- resolve(trimmedAnswer === "y" || trimmedAnswer === "yes");
3969
+ resolve2(trimmedAnswer === "y" || trimmedAnswer === "yes");
3970
3970
  });
3971
3971
  });
3972
3972
  }
@@ -4481,8 +4481,124 @@ function createDeploymentsCommand() {
4481
4481
  return deploymentsCommand;
4482
4482
  }
4483
4483
 
4484
+ // src/commands/skills.ts
4485
+ import { Command as Command3 } from "commander";
4486
+ import { cpSync, existsSync as existsSync2, mkdtempSync, readdirSync, rmSync } from "fs";
4487
+ import { tmpdir } from "os";
4488
+ import { join as join2, resolve } from "path";
4489
+ import { Readable } from "stream";
4490
+ import { pipeline } from "stream/promises";
4491
+ import { extract } from "tar";
4492
+ var REPO_OWNER = "mcp-use";
4493
+ var REPO_NAME = "mcp-use";
4494
+ var REPO_BRANCH = "main";
4495
+ var TELEMETRY_URL = "https://add-skill.vercel.sh/t";
4496
+ var SOURCE_REPO = `${REPO_OWNER}/${REPO_NAME}`;
4497
+ var AGENT_PRESET_FOLDERS = {
4498
+ cursor: ".cursor",
4499
+ "claude-code": ".claude",
4500
+ codex: ".agent"
4501
+ };
4502
+ var ALL_PRESETS = ["cursor", "claude-code", "codex"];
4503
+ function sendInstallTelemetryEvent(agents, skills) {
4504
+ const telemetryData = {
4505
+ event: "install",
4506
+ source: SOURCE_REPO,
4507
+ skills,
4508
+ agents,
4509
+ sourceType: "github"
4510
+ };
4511
+ try {
4512
+ const params = new URLSearchParams();
4513
+ for (const [key, value] of Object.entries(telemetryData)) {
4514
+ if (value !== void 0 && value !== null) {
4515
+ params.set(key, String(value));
4516
+ }
4517
+ }
4518
+ fetch(`${TELEMETRY_URL}?${params.toString()}`).catch(() => {
4519
+ });
4520
+ } catch {
4521
+ }
4522
+ }
4523
+ async function addSkillsToProject(projectPath) {
4524
+ const tarballUrl = `https://codeload.github.com/${REPO_OWNER}/${REPO_NAME}/tar.gz/${REPO_BRANCH}`;
4525
+ const tempDir = mkdtempSync(join2(tmpdir(), "mcp-use-skills-"));
4526
+ try {
4527
+ const response = await fetch(tarballUrl);
4528
+ if (!response.ok) {
4529
+ throw new Error(`Failed to download tarball: ${response.statusText}`);
4530
+ }
4531
+ await pipeline(
4532
+ Readable.fromWeb(response.body),
4533
+ extract({
4534
+ cwd: tempDir,
4535
+ filter: (path7) => path7.includes("/skills/"),
4536
+ strip: 1
4537
+ })
4538
+ );
4539
+ const skillsPath = join2(tempDir, "skills");
4540
+ if (!existsSync2(skillsPath)) {
4541
+ throw new Error("Skills folder not found in repository");
4542
+ }
4543
+ for (const preset of ALL_PRESETS) {
4544
+ const folderName = AGENT_PRESET_FOLDERS[preset];
4545
+ const outputPath = join2(projectPath, folderName, "skills");
4546
+ cpSync(skillsPath, outputPath, { recursive: true });
4547
+ }
4548
+ const skillNames = readdirSync(skillsPath, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name);
4549
+ sendInstallTelemetryEvent(ALL_PRESETS.join(","), skillNames.join(","));
4550
+ } finally {
4551
+ rmSync(tempDir, { recursive: true, force: true });
4552
+ }
4553
+ }
4554
+ function createSkillsCommand() {
4555
+ const skills = new Command3("skills").description(
4556
+ "Manage mcp-use AI agent skills"
4557
+ );
4558
+ const installAction = async (options) => {
4559
+ const projectPath = resolve(options.path);
4560
+ if (!existsSync2(projectPath)) {
4561
+ console.error(source_default.red(`Directory not found: ${projectPath}`));
4562
+ process.exit(1);
4563
+ }
4564
+ console.log(source_default.cyan("\u{1F4DA} Installing mcp-use skills..."));
4565
+ console.log(
4566
+ source_default.gray(
4567
+ " Downloading from github.com/mcp-use/mcp-use \u2192 .cursor/skills, .claude/skills, .agent/skills"
4568
+ )
4569
+ );
4570
+ try {
4571
+ await addSkillsToProject(projectPath);
4572
+ console.log(source_default.green("\u2705 Skills installed successfully!"));
4573
+ } catch (error) {
4574
+ console.error(source_default.red("\u274C Failed to install skills."));
4575
+ console.error(
4576
+ source_default.yellow(
4577
+ ` Error: ${error instanceof Error ? error.message : String(error)}`
4578
+ )
4579
+ );
4580
+ console.error(
4581
+ source_default.yellow(
4582
+ " You can also install manually: npx skills add mcp-use/mcp-use"
4583
+ )
4584
+ );
4585
+ process.exit(1);
4586
+ }
4587
+ };
4588
+ const pathOption = [
4589
+ "-p, --path <path>",
4590
+ "Path to project directory",
4591
+ process.cwd()
4592
+ ];
4593
+ skills.command("add").description(
4594
+ "Install mcp-use skills for AI agents (Cursor, Claude Code, Codex)"
4595
+ ).option(...pathOption).action(installAction);
4596
+ skills.command("install").description("Install mcp-use skills for AI agents (alias for 'add')").option(...pathOption).action(installAction);
4597
+ return skills;
4598
+ }
4599
+
4484
4600
  // src/index.ts
4485
- var program = new Command3();
4601
+ var program = new Command4();
4486
4602
  var packageContent = readFileSync(
4487
4603
  path6.join(__dirname, "../package.json"),
4488
4604
  "utf-8"
@@ -4571,7 +4687,7 @@ async function waitForServer(port, host = "localhost", maxAttempts = 30) {
4571
4687
  } finally {
4572
4688
  controller.abort();
4573
4689
  }
4574
- await new Promise((resolve) => setTimeout(resolve, 1e3));
4690
+ await new Promise((resolve2) => setTimeout(resolve2, 1e3));
4575
4691
  }
4576
4692
  return false;
4577
4693
  }
@@ -4593,11 +4709,11 @@ function runCommand(command, args, cwd, env2, filterStderr = false) {
4593
4709
  }
4594
4710
  });
4595
4711
  }
4596
- const promise = new Promise((resolve, reject) => {
4712
+ const promise = new Promise((resolve2, reject) => {
4597
4713
  proc.on("error", reject);
4598
4714
  proc.on("exit", (code) => {
4599
4715
  if (code === 0 || code === 130 || code === 143) {
4600
- resolve();
4716
+ resolve2();
4601
4717
  } else {
4602
4718
  reject(new Error(`Command failed with exit code ${code}`));
4603
4719
  }
@@ -4606,7 +4722,7 @@ function runCommand(command, args, cwd, env2, filterStderr = false) {
4606
4722
  return { promise, process: proc };
4607
4723
  }
4608
4724
  async function startTunnel(port, subdomain) {
4609
- return new Promise((resolve, reject) => {
4725
+ return new Promise((resolve2, reject) => {
4610
4726
  console.log(source_default.gray(`Starting tunnel for port ${port}...`));
4611
4727
  const tunnelArgs = ["--yes", "@mcp-use/tunnel", String(port)];
4612
4728
  if (subdomain) {
@@ -4641,7 +4757,7 @@ async function startTunnel(port, subdomain) {
4641
4757
  resolved = true;
4642
4758
  clearTimeout(setupTimeout);
4643
4759
  console.log(source_default.green.bold(`\u2713 Tunnel established: ${url}/mcp`));
4644
- resolve({ url, subdomain: extractedSubdomain, process: proc });
4760
+ resolve2({ url, subdomain: extractedSubdomain, process: proc });
4645
4761
  }
4646
4762
  });
4647
4763
  proc.stderr?.on("data", (data) => {
@@ -4910,7 +5026,7 @@ export default PostHog;
4910
5026
  inputs: inputsValue
4911
5027
  };
4912
5028
  }
4913
- await new Promise((resolve) => setTimeout(resolve, 50));
5029
+ await new Promise((resolve2) => setTimeout(resolve2, 50));
4914
5030
  } catch (error) {
4915
5031
  console.warn(
4916
5032
  source_default.yellow(` \u26A0 Could not extract metadata for ${widgetName}`)
@@ -5827,6 +5943,7 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
5827
5943
  });
5828
5944
  program.addCommand(createClientCommand());
5829
5945
  program.addCommand(createDeploymentsCommand());
5946
+ program.addCommand(createSkillsCommand());
5830
5947
  program.command("generate-types").description(
5831
5948
  "Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
5832
5949
  ).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {