@mcp-use/cli 2.12.0 → 2.12.1

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
@@ -3242,6 +3242,17 @@ async function prompt(question, defaultValue = "n") {
3242
3242
  });
3243
3243
  });
3244
3244
  }
3245
+ function getMcpServerUrl(deployment) {
3246
+ if (deployment.customDomain) {
3247
+ return `https://${deployment.customDomain}/mcp`;
3248
+ } else if (deployment.serverSlug) {
3249
+ return `https://${deployment.serverSlug}.mcp-use.run/mcp`;
3250
+ } else if (deployment.serverId) {
3251
+ return `https://${deployment.serverId}.mcp-use.run/mcp`;
3252
+ } else {
3253
+ return `https://${deployment.domain}/mcp`;
3254
+ }
3255
+ }
3245
3256
  async function displayDeploymentProgress(api, deployment) {
3246
3257
  const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
3247
3258
  let frameIndex = 0;
@@ -3325,21 +3336,12 @@ async function displayDeploymentProgress(api, deployment) {
3325
3336
  lastDisplayedLogLength = finalDeployment.buildLogs.length;
3326
3337
  }
3327
3338
  if (finalDeployment.status === "running") {
3328
- let mcpServerUrl;
3339
+ const mcpServerUrl = getMcpServerUrl(finalDeployment);
3329
3340
  let dashboardUrl = null;
3330
- if (finalDeployment.customDomain) {
3331
- mcpServerUrl = `https://${finalDeployment.customDomain}/mcp`;
3332
- if (finalDeployment.serverSlug) {
3333
- dashboardUrl = `https://mcp-use.com/cloud/servers/${finalDeployment.serverSlug}`;
3334
- }
3335
- } else if (finalDeployment.serverSlug) {
3336
- mcpServerUrl = `https://${finalDeployment.serverSlug}.mcp-use.run/mcp`;
3341
+ if (finalDeployment.serverSlug) {
3337
3342
  dashboardUrl = `https://mcp-use.com/cloud/servers/${finalDeployment.serverSlug}`;
3338
3343
  } else if (finalDeployment.serverId) {
3339
- mcpServerUrl = `https://${finalDeployment.serverId}.mcp-use.run/mcp`;
3340
3344
  dashboardUrl = `https://mcp-use.com/cloud/servers/${finalDeployment.serverId}`;
3341
- } else {
3342
- mcpServerUrl = `https://${finalDeployment.domain}/mcp`;
3343
3345
  }
3344
3346
  const inspectorUrl = `https://inspector.mcp-use.com/inspector?autoConnect=${encodeURIComponent(
3345
3347
  mcpServerUrl
@@ -3828,6 +3830,7 @@ async function deployCommand(options) {
3828
3830
  process.exit(1);
3829
3831
  }
3830
3832
  const existingLink = !options.new ? await getProjectLink(cwd) : null;
3833
+ const serverId = existingLink?.serverId;
3831
3834
  if (existingLink) {
3832
3835
  try {
3833
3836
  const existingDeployment = await api.getDeployment(
@@ -3837,7 +3840,7 @@ async function deployCommand(options) {
3837
3840
  console.log(source_default.green(`\u2713 Found linked deployment`));
3838
3841
  console.log(source_default.gray(` Redeploying to maintain the same URL...`));
3839
3842
  console.log(
3840
- source_default.cyan(` URL: https://${existingDeployment.domain}/mcp
3843
+ source_default.cyan(` URL: ${getMcpServerUrl(existingDeployment)}
3841
3844
  `)
3842
3845
  );
3843
3846
  const redeploymentConfig = {
@@ -3861,11 +3864,25 @@ async function deployCommand(options) {
3861
3864
  await open_default(`https://${deployment2.domain}`);
3862
3865
  }
3863
3866
  return;
3867
+ } else {
3868
+ console.log(
3869
+ source_default.yellow(
3870
+ `\u26A0\uFE0F Linked deployment not found or failed, creating new one...`
3871
+ )
3872
+ );
3873
+ if (serverId) {
3874
+ console.log(
3875
+ source_default.gray(` Will reuse existing server: ${serverId}`)
3876
+ );
3877
+ }
3864
3878
  }
3865
3879
  } catch (error) {
3866
3880
  console.log(
3867
3881
  source_default.yellow(`\u26A0\uFE0F Linked deployment not found, creating new one...`)
3868
3882
  );
3883
+ if (serverId) {
3884
+ console.log(source_default.gray(` Will reuse existing server: ${serverId}`));
3885
+ }
3869
3886
  }
3870
3887
  }
3871
3888
  const deploymentRequest = {
@@ -3880,7 +3897,8 @@ async function deployCommand(options) {
3880
3897
  startCommand,
3881
3898
  env: Object.keys(envVars).length > 0 ? envVars : void 0
3882
3899
  },
3883
- healthCheckPath: "/healthz"
3900
+ healthCheckPath: "/healthz",
3901
+ serverId
3884
3902
  };
3885
3903
  console.log(source_default.gray("Creating deployment..."));
3886
3904
  const deployment = await api.createDeployment(deploymentRequest);
@@ -3891,7 +3909,8 @@ async function deployCommand(options) {
3891
3909
  deploymentId: deployment.id,
3892
3910
  deploymentName: projectName,
3893
3911
  deploymentUrl: deployment.domain,
3894
- linkedAt: (/* @__PURE__ */ new Date()).toISOString()
3912
+ linkedAt: (/* @__PURE__ */ new Date()).toISOString(),
3913
+ serverId: deployment.serverId
3895
3914
  });
3896
3915
  console.log(
3897
3916
  source_default.gray(` Linked to this project (stored in .mcp-use/project.json)`)