@mcp-use/cli 3.1.0-canary.3 → 3.1.0-canary.4

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
@@ -3575,12 +3575,16 @@ async function deployCommand(options) {
3575
3575
  }
3576
3576
  let api = await McpUseAPI.create();
3577
3577
  let resolvedOrgId;
3578
+ let resolvedOrgName;
3579
+ let resolvedOrgSlug;
3578
3580
  if (options.org) {
3579
3581
  const authInfo = await api.testAuth();
3580
3582
  const match = resolveOrgFromOption(authInfo.orgs ?? [], options.org);
3581
3583
  if (match) {
3582
3584
  api.setOrgId(match.id);
3583
3585
  resolvedOrgId = match.id;
3586
+ resolvedOrgName = match.name;
3587
+ resolvedOrgSlug = match.slug ?? void 0;
3584
3588
  const slug = match.slug ? source_default.gray(` (${match.slug})`) : "";
3585
3589
  console.log(
3586
3590
  source_default.gray("Organization: ") + source_default.cyan(match.name) + slug
@@ -3620,6 +3624,8 @@ async function deployCommand(options) {
3620
3624
  }
3621
3625
  api.setOrgId(selectedOrg.id);
3622
3626
  resolvedOrgId = selectedOrg.id;
3627
+ resolvedOrgName = selectedOrg.name;
3628
+ resolvedOrgSlug = selectedOrg.slug ?? void 0;
3623
3629
  await writeConfig({
3624
3630
  ...config,
3625
3631
  orgId: selectedOrg.id,
@@ -3631,6 +3637,8 @@ async function deployCommand(options) {
3631
3637
  );
3632
3638
  } else {
3633
3639
  resolvedOrgId = config.orgId;
3640
+ resolvedOrgName = config.orgName;
3641
+ resolvedOrgSlug = config.orgSlug;
3634
3642
  api.setOrgId(config.orgId);
3635
3643
  if (config.orgName) {
3636
3644
  const slug = config.orgSlug ? source_default.gray(` (${config.orgSlug})`) : "";
@@ -4027,6 +4035,22 @@ async function deployCommand(options) {
4027
4035
  }
4028
4036
  const existingLink = !options.new ? await getProjectLink(cwd) : null;
4029
4037
  let serverId = existingLink?.serverId;
4038
+ if (serverId && resolvedOrgId) {
4039
+ try {
4040
+ const linkedServer = await api.getServer(serverId);
4041
+ if (linkedServer.organizationId !== resolvedOrgId) {
4042
+ const target = resolvedOrgName ? `${resolvedOrgName}${resolvedOrgSlug ? ` (${resolvedOrgSlug})` : ""}` : resolvedOrgId;
4043
+ console.log(
4044
+ source_default.yellow(
4045
+ `\u26A0\uFE0F Linked server belongs to a different organization. Creating a new server in ${target}...
4046
+ `
4047
+ )
4048
+ );
4049
+ serverId = void 0;
4050
+ }
4051
+ } catch {
4052
+ }
4053
+ }
4030
4054
  if (existingLink && serverId) {
4031
4055
  try {
4032
4056
  const existingDep = await api.getDeployment(existingLink.deploymentId);