@mcp-use/cli 2.21.0-canary.4 → 2.21.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
@@ -3394,7 +3394,7 @@ function getMcpServerUrl(deployment) {
3394
3394
  return `https://${deployment.domain}/mcp`;
3395
3395
  }
3396
3396
  }
3397
- async function displayDeploymentProgress(api, deployment) {
3397
+ async function displayDeploymentProgress(api, deployment, progressOptions) {
3398
3398
  const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
3399
3399
  let frameIndex = 0;
3400
3400
  let spinnerInterval = null;
@@ -3516,11 +3516,20 @@ async function displayDeploymentProgress(api, deployment) {
3516
3516
  console.log(source_default.red("Error: ") + finalDeployment.error);
3517
3517
  if (finalDeployment.error.includes("No GitHub installations found")) {
3518
3518
  console.log();
3519
- const retry = await promptGitHubInstallation(api, "not_connected");
3519
+ const retry = await promptGitHubInstallation(
3520
+ api,
3521
+ "not_connected",
3522
+ void 0,
3523
+ { yes: progressOptions?.yes }
3524
+ );
3520
3525
  if (retry) {
3521
3526
  console.log(source_default.cyan("\n\u{1F504} Retrying deployment...\n"));
3522
3527
  const newDeployment = await api.redeployDeployment(deployment.id);
3523
- await displayDeploymentProgress(api, newDeployment);
3528
+ await displayDeploymentProgress(
3529
+ api,
3530
+ newDeployment,
3531
+ progressOptions
3532
+ );
3524
3533
  return;
3525
3534
  }
3526
3535
  } else if (finalDeployment.error.includes("Authenticated git clone failed")) {
@@ -3537,12 +3546,17 @@ async function displayDeploymentProgress(api, deployment) {
3537
3546
  const retry = await promptGitHubInstallation(
3538
3547
  api,
3539
3548
  "no_access",
3540
- repoName
3549
+ repoName,
3550
+ { yes: progressOptions?.yes }
3541
3551
  );
3542
3552
  if (retry) {
3543
3553
  console.log(source_default.cyan("\n\u{1F504} Retrying deployment...\n"));
3544
3554
  const newDeployment = await api.redeployDeployment(deployment.id);
3545
- await displayDeploymentProgress(api, newDeployment);
3555
+ await displayDeploymentProgress(
3556
+ api,
3557
+ newDeployment,
3558
+ progressOptions
3559
+ );
3546
3560
  return;
3547
3561
  }
3548
3562
  }
@@ -3593,7 +3607,52 @@ async function checkRepoAccess(api, owner, repo) {
3593
3607
  return false;
3594
3608
  }
3595
3609
  }
3596
- async function promptGitHubInstallation(api, reason, repoName) {
3610
+ var GITHUB_SETUP_POLL_INTERVAL_MS = 2e3;
3611
+ var GITHUB_SETUP_POLL_MAX_MS = 12e4;
3612
+ async function waitForGitHubSetupAfterBrowser(api, repoName, yes) {
3613
+ if (!yes) {
3614
+ console.log(source_default.gray("Waiting for GitHub configuration..."));
3615
+ await prompt(
3616
+ source_default.white("Press Enter when you've completed the GitHub setup..."),
3617
+ "y"
3618
+ );
3619
+ return;
3620
+ }
3621
+ console.log(
3622
+ source_default.gray(
3623
+ "Waiting for GitHub configuration (polling every 2s, up to 2 min)..."
3624
+ )
3625
+ );
3626
+ const deadline = Date.now() + GITHUB_SETUP_POLL_MAX_MS;
3627
+ while (Date.now() < deadline) {
3628
+ try {
3629
+ const status = await api.getGitHubConnectionStatus();
3630
+ if (!status.is_connected) {
3631
+ await new Promise((r) => setTimeout(r, GITHUB_SETUP_POLL_INTERVAL_MS));
3632
+ continue;
3633
+ }
3634
+ if (repoName) {
3635
+ const parts = repoName.split("/");
3636
+ const owner = parts[0];
3637
+ const repo = parts[1];
3638
+ if (owner && repo && await checkRepoAccess(api, owner, repo)) {
3639
+ return;
3640
+ }
3641
+ } else {
3642
+ return;
3643
+ }
3644
+ } catch {
3645
+ }
3646
+ await new Promise((r) => setTimeout(r, GITHUB_SETUP_POLL_INTERVAL_MS));
3647
+ }
3648
+ console.log(
3649
+ source_default.yellow(
3650
+ "\u26A0\uFE0F Timed out waiting for GitHub setup. Continuing with verification..."
3651
+ )
3652
+ );
3653
+ }
3654
+ async function promptGitHubInstallation(api, reason, repoName, opts) {
3655
+ const yes = !!opts?.yes;
3597
3656
  console.log();
3598
3657
  if (reason === "not_connected") {
3599
3658
  console.log(source_default.yellow("\u26A0\uFE0F GitHub account not connected"));
@@ -3611,7 +3670,7 @@ async function promptGitHubInstallation(api, reason, repoName) {
3611
3670
  )
3612
3671
  );
3613
3672
  }
3614
- const shouldInstall = await prompt(
3673
+ const shouldInstall = yes ? true : await prompt(
3615
3674
  source_default.white(
3616
3675
  `Would you like to ${reason === "not_connected" ? "connect" : "configure"} GitHub now? (Y/n): `
3617
3676
  ),
@@ -3658,11 +3717,7 @@ Opening browser to ${reason === "not_connected" ? "install" : "configure"} GitHu
3658
3717
  console.log();
3659
3718
  }
3660
3719
  await open_default(installUrl);
3661
- console.log(source_default.gray("Waiting for GitHub configuration..."));
3662
- await prompt(
3663
- source_default.white("Press Enter when you've completed the GitHub setup..."),
3664
- "y"
3665
- );
3720
+ await waitForGitHubSetupAfterBrowser(api, repoName, yes);
3666
3721
  console.log(source_default.gray("Verifying GitHub connection..."));
3667
3722
  let verified = false;
3668
3723
  try {
@@ -3719,6 +3774,14 @@ async function deployCommand(options) {
3719
3774
  const cwd = process.cwd();
3720
3775
  if (!await isLoggedIn()) {
3721
3776
  console.log(source_default.red("\u2717 You are not logged in."));
3777
+ if (options.yes) {
3778
+ console.log(
3779
+ source_default.gray(
3780
+ "Run " + source_default.white("npx mcp-use login") + " first. Non-interactive deploy requires an existing session."
3781
+ )
3782
+ );
3783
+ process.exit(1);
3784
+ }
3722
3785
  const shouldLogin = await prompt(
3723
3786
  source_default.white("Would you like to login now? (Y/n): "),
3724
3787
  "y"
@@ -3770,12 +3833,14 @@ async function deployCommand(options) {
3770
3833
  "\u26A0\uFE0F This doesn't appear to be an MCP server project (no mcp-use or @modelcontextprotocol/sdk dependency found)."
3771
3834
  )
3772
3835
  );
3773
- const shouldContinue = await prompt(
3774
- source_default.white("Continue anyway? (y/n): ")
3775
- );
3776
- if (!shouldContinue) {
3777
- console.log(source_default.gray("Deployment cancelled."));
3778
- process.exit(0);
3836
+ if (!options.yes) {
3837
+ const shouldContinue = await prompt(
3838
+ source_default.white("Continue anyway? (y/n): ")
3839
+ );
3840
+ if (!shouldContinue) {
3841
+ console.log(source_default.gray("Deployment cancelled."));
3842
+ process.exit(0);
3843
+ }
3779
3844
  }
3780
3845
  console.log();
3781
3846
  }
@@ -3819,12 +3884,14 @@ async function deployCommand(options) {
3819
3884
  "Local changes will not be included until you commit and push.\n"
3820
3885
  )
3821
3886
  );
3822
- const shouldContinue = await prompt(
3823
- source_default.white("Continue with deployment from GitHub? (y/n): ")
3824
- );
3825
- if (!shouldContinue) {
3826
- console.log(source_default.gray("Deployment cancelled."));
3827
- process.exit(0);
3887
+ if (!options.yes) {
3888
+ const shouldContinue = await prompt(
3889
+ source_default.white("Continue with deployment from GitHub? (y/n): ")
3890
+ );
3891
+ if (!shouldContinue) {
3892
+ console.log(source_default.gray("Deployment cancelled."));
3893
+ process.exit(0);
3894
+ }
3828
3895
  }
3829
3896
  console.log();
3830
3897
  }
@@ -3846,15 +3913,17 @@ async function deployCommand(options) {
3846
3913
  );
3847
3914
  }
3848
3915
  console.log();
3849
- const shouldDeploy = await prompt(
3850
- source_default.white(
3851
- `Deploy from GitHub repository ${gitInfo.owner}/${gitInfo.repo}? (Y/n): `
3852
- ),
3853
- "y"
3854
- );
3855
- if (!shouldDeploy) {
3856
- console.log(source_default.gray("Deployment cancelled."));
3857
- process.exit(0);
3916
+ if (!options.yes) {
3917
+ const shouldDeploy = await prompt(
3918
+ source_default.white(
3919
+ `Deploy from GitHub repository ${gitInfo.owner}/${gitInfo.repo}? (Y/n): `
3920
+ ),
3921
+ "y"
3922
+ );
3923
+ if (!shouldDeploy) {
3924
+ console.log(source_default.gray("Deployment cancelled."));
3925
+ process.exit(0);
3926
+ }
3858
3927
  }
3859
3928
  const projectName = options.name || await getProjectName(projectDir);
3860
3929
  const runtime = options.runtime || await detectRuntime(projectDir);
@@ -3925,7 +3994,8 @@ async function deployCommand(options) {
3925
3994
  const installed = await promptGitHubInstallation(
3926
3995
  api,
3927
3996
  "not_connected",
3928
- repoFullName
3997
+ repoFullName,
3998
+ { yes: options.yes }
3929
3999
  );
3930
4000
  if (!installed) {
3931
4001
  console.log(source_default.gray("Deployment cancelled."));
@@ -3960,7 +4030,8 @@ async function deployCommand(options) {
3960
4030
  const configured = await promptGitHubInstallation(
3961
4031
  api,
3962
4032
  "no_access",
3963
- repoFullName
4033
+ repoFullName,
4034
+ { yes: options.yes }
3964
4035
  );
3965
4036
  if (!configured) {
3966
4037
  console.log(source_default.gray("Deployment cancelled."));
@@ -4048,7 +4119,9 @@ async function deployCommand(options) {
4048
4119
  ...existingLink,
4049
4120
  linkedAt: (/* @__PURE__ */ new Date()).toISOString()
4050
4121
  });
4051
- await displayDeploymentProgress(api, deployment2);
4122
+ await displayDeploymentProgress(api, deployment2, {
4123
+ yes: options.yes
4124
+ });
4052
4125
  if (options.open && deployment2.domain) {
4053
4126
  console.log();
4054
4127
  console.log(source_default.gray("Opening deployment in browser..."));
@@ -4121,7 +4194,7 @@ async function deployCommand(options) {
4121
4194
  );
4122
4195
  console.log(source_default.gray(` Future deploys will reuse the same URL
4123
4196
  `));
4124
- await displayDeploymentProgress(api, deployment);
4197
+ await displayDeploymentProgress(api, deployment, { yes: options.yes });
4125
4198
  if (options.open && deployment.domain) {
4126
4199
  console.log();
4127
4200
  console.log(source_default.gray("Opening deployment in browser..."));
@@ -6854,7 +6927,7 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
6854
6927
  ).option(
6855
6928
  "--org <slug-or-id>",
6856
6929
  "Deploy to a specific organization (by slug or ID)"
6857
- ).action(async (options) => {
6930
+ ).option("-y, --yes", "Skip confirmation prompts").action(async (options) => {
6858
6931
  await deployCommand({
6859
6932
  open: options.open,
6860
6933
  name: options.name,
@@ -6864,7 +6937,8 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
6864
6937
  env: options.env,
6865
6938
  envFile: options.envFile,
6866
6939
  rootDir: options.rootDir,
6867
- org: options.org
6940
+ org: options.org,
6941
+ yes: options.yes
6868
6942
  });
6869
6943
  });
6870
6944
  program.addCommand(createClientCommand());