@mcp-use/cli 2.20.1-canary.3 → 2.21.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.
@@ -1,3 +1,9 @@
1
+ import type { ProfileInfo } from "../utils/api.js";
2
+ /**
3
+ * Prompt user to pick an organization from a numbered list.
4
+ * Returns the selected profile or null if selection fails.
5
+ */
6
+ export declare function promptOrgSelection(profiles: ProfileInfo[], defaultProfileId?: string | null): Promise<ProfileInfo | null>;
1
7
  /**
2
8
  * Login command - opens browser for OAuth flow
3
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AA+SA;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqHhB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BnD;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkCnD"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAgSnD;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,WAAW,EAAE,EACvB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,GAC/B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA6C7B;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuJhB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BnD;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA+DnD"}
@@ -7,6 +7,7 @@ interface DeployOptions {
7
7
  env?: string[];
8
8
  envFile?: string;
9
9
  rootDir?: string;
10
+ org?: string;
10
11
  }
11
12
  /**
12
13
  * Deploy command - deploys MCP server to Manufact cloud
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA6KA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAulBD;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyczE"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA6KA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA2lBD;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA2fzE"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * List all organizations the user belongs to
3
+ */
4
+ export declare function orgListCommand(): Promise<void>;
5
+ /**
6
+ * Switch the active organization
7
+ */
8
+ export declare function orgSwitchCommand(): Promise<void>;
9
+ /**
10
+ * Show the currently active organization
11
+ */
12
+ export declare function orgCurrentCommand(): Promise<void>;
13
+ //# sourceMappingURL=org.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAyCpD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CA6DtD;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgCvD"}
package/dist/index.cjs CHANGED
@@ -524,7 +524,7 @@ var source_default = chalk;
524
524
 
525
525
  // src/index.ts
526
526
  var import_commander4 = require("commander");
527
- var import_config5 = require("dotenv/config");
527
+ var import_config6 = require("dotenv/config");
528
528
  var import_node_child_process9 = require("child_process");
529
529
  var import_node_fs10 = require("fs");
530
530
  var import_promises7 = require("fs/promises");
@@ -1198,6 +1198,10 @@ async function isLoggedIn() {
1198
1198
  const apiKey = await getApiKey();
1199
1199
  return !!apiKey;
1200
1200
  }
1201
+ async function getProfileId() {
1202
+ const config = await readConfig();
1203
+ return config.profileId || null;
1204
+ }
1201
1205
  async function getWebUrl() {
1202
1206
  return DEFAULT_WEB_URL;
1203
1207
  }
@@ -1206,9 +1210,11 @@ async function getWebUrl() {
1206
1210
  var McpUseAPI = class _McpUseAPI {
1207
1211
  baseUrl;
1208
1212
  apiKey;
1209
- constructor(baseUrl, apiKey) {
1213
+ profileId;
1214
+ constructor(baseUrl, apiKey, profileId) {
1210
1215
  this.baseUrl = baseUrl || "";
1211
1216
  this.apiKey = apiKey;
1217
+ this.profileId = profileId;
1212
1218
  }
1213
1219
  /**
1214
1220
  * Initialize API client with config
@@ -1216,7 +1222,14 @@ var McpUseAPI = class _McpUseAPI {
1216
1222
  static async create() {
1217
1223
  const baseUrl = await getApiUrl();
1218
1224
  const apiKey = await getApiKey();
1219
- return new _McpUseAPI(baseUrl, apiKey ?? void 0);
1225
+ const profileId = await getProfileId();
1226
+ return new _McpUseAPI(baseUrl, apiKey ?? void 0, profileId ?? void 0);
1227
+ }
1228
+ /**
1229
+ * Override the profile ID for this API client instance (e.g. from --org flag)
1230
+ */
1231
+ setProfileId(profileId) {
1232
+ this.profileId = profileId;
1220
1233
  }
1221
1234
  /**
1222
1235
  * Make authenticated request
@@ -1230,6 +1243,9 @@ var McpUseAPI = class _McpUseAPI {
1230
1243
  if (this.apiKey) {
1231
1244
  headers["x-api-key"] = this.apiKey;
1232
1245
  }
1246
+ if (this.profileId) {
1247
+ headers["x-profile-id"] = this.profileId;
1248
+ }
1233
1249
  const timeout = options.timeout || 3e4;
1234
1250
  const controller = new AbortController();
1235
1251
  const timeoutId = setTimeout(() => controller.abort(), timeout);
@@ -1280,6 +1296,14 @@ var McpUseAPI = class _McpUseAPI {
1280
1296
  async testAuth() {
1281
1297
  return this.request("/test-auth");
1282
1298
  }
1299
+ /**
1300
+ * Set the user's default profile (organization) on the server
1301
+ */
1302
+ async setDefaultProfile(profileId) {
1303
+ await this.request(`/profiles/${profileId}/set-default`, {
1304
+ method: "POST"
1305
+ });
1306
+ }
1283
1307
  /**
1284
1308
  * Create deployment
1285
1309
  */
@@ -1304,6 +1328,9 @@ var McpUseAPI = class _McpUseAPI {
1304
1328
  if (this.apiKey) {
1305
1329
  headers["x-api-key"] = this.apiKey;
1306
1330
  }
1331
+ if (this.profileId) {
1332
+ headers["x-profile-id"] = this.profileId;
1333
+ }
1307
1334
  const response = await fetch(url, { headers });
1308
1335
  if (!response.ok) {
1309
1336
  throw new Error(`Failed to stream logs: ${response.status}`);
@@ -1385,6 +1412,9 @@ var McpUseAPI = class _McpUseAPI {
1385
1412
  if (this.apiKey) {
1386
1413
  headers["x-api-key"] = this.apiKey;
1387
1414
  }
1415
+ if (this.profileId) {
1416
+ headers["x-profile-id"] = this.profileId;
1417
+ }
1388
1418
  const response = await fetch(url, {
1389
1419
  method: "POST",
1390
1420
  headers,
@@ -1446,6 +1476,7 @@ var McpUseAPI = class _McpUseAPI {
1446
1476
  formData.append("source_file", blob, basename(filePath));
1447
1477
  const headers = {};
1448
1478
  if (this.apiKey) headers["x-api-key"] = this.apiKey;
1479
+ if (this.profileId) headers["x-profile-id"] = this.profileId;
1449
1480
  const response = await fetch(
1450
1481
  `${this.baseUrl}/deployments/${deploymentId}/redeploy`,
1451
1482
  {
@@ -1780,6 +1811,45 @@ async function startCallbackServer(port, expectedState) {
1780
1811
  server.on("error", reject);
1781
1812
  });
1782
1813
  }
1814
+ async function promptOrgSelection(profiles, defaultProfileId) {
1815
+ if (profiles.length === 0) return null;
1816
+ if (profiles.length === 1) {
1817
+ return profiles[0];
1818
+ }
1819
+ console.log(source_default.cyan.bold("\n\u{1F3E2} Select an organization:\n"));
1820
+ for (let i = 0; i < profiles.length; i++) {
1821
+ const p = profiles[i];
1822
+ const marker = p.id === defaultProfileId ? source_default.green(" (current)") : "";
1823
+ const slug = p.slug ? source_default.gray(` (${p.slug})`) : "";
1824
+ console.log(
1825
+ ` ${source_default.white(`${i + 1}.`)} ${p.profile_name}${slug}${marker}`
1826
+ );
1827
+ }
1828
+ const readline = await import("readline");
1829
+ const rl = readline.createInterface({
1830
+ input: process.stdin,
1831
+ output: process.stdout
1832
+ });
1833
+ return new Promise((resolve2) => {
1834
+ const defaultIdx = defaultProfileId ? profiles.findIndex((p) => p.id === defaultProfileId) : 0;
1835
+ const defaultDisplay = defaultIdx >= 0 ? defaultIdx + 1 : 1;
1836
+ rl.question(
1837
+ source_default.gray(`
1838
+ Enter number [${defaultDisplay}]: `),
1839
+ (answer) => {
1840
+ rl.close();
1841
+ const trimmed = answer.trim();
1842
+ const idx = trimmed === "" ? defaultIdx : parseInt(trimmed, 10) - 1;
1843
+ if (idx >= 0 && idx < profiles.length) {
1844
+ resolve2(profiles[idx]);
1845
+ } else {
1846
+ console.log(source_default.yellow("Invalid selection, using default."));
1847
+ resolve2(profiles[defaultIdx >= 0 ? defaultIdx : 0]);
1848
+ }
1849
+ }
1850
+ );
1851
+ });
1852
+ }
1783
1853
  async function loginCommand(options) {
1784
1854
  try {
1785
1855
  if (await isLoggedIn()) {
@@ -1841,6 +1911,31 @@ async function loginCommand(options) {
1841
1911
  const masked = apiKey.substring(0, 6) + "...";
1842
1912
  console.log(source_default.white("API Key: ") + source_default.gray(masked));
1843
1913
  }
1914
+ const profiles = authInfo.profiles ?? [];
1915
+ if (profiles.length > 0) {
1916
+ let selectedProfile = null;
1917
+ if (profiles.length === 1) {
1918
+ selectedProfile = profiles[0];
1919
+ } else {
1920
+ selectedProfile = await promptOrgSelection(
1921
+ profiles,
1922
+ authInfo.default_profile_id
1923
+ );
1924
+ }
1925
+ if (selectedProfile) {
1926
+ const config = await readConfig();
1927
+ await writeConfig({
1928
+ ...config,
1929
+ profileId: selectedProfile.id,
1930
+ profileName: selectedProfile.profile_name,
1931
+ profileSlug: selectedProfile.slug ?? void 0
1932
+ });
1933
+ const slug = selectedProfile.slug ? source_default.gray(` (${selectedProfile.slug})`) : "";
1934
+ console.log(
1935
+ source_default.white("Org: ") + source_default.cyan(selectedProfile.profile_name) + slug
1936
+ );
1937
+ }
1938
+ }
1844
1939
  } catch (error) {
1845
1940
  console.log(
1846
1941
  source_default.gray(
@@ -1906,6 +2001,27 @@ async function whoamiCommand() {
1906
2001
  const masked = apiKey.substring(0, 6) + "...";
1907
2002
  console.log(source_default.white("API Key: ") + source_default.gray(masked));
1908
2003
  }
2004
+ const config = await readConfig();
2005
+ const profiles = authInfo.profiles ?? [];
2006
+ if (profiles.length > 0) {
2007
+ const activeProfile = profiles.find(
2008
+ (p) => p.id === (config.profileId || authInfo.default_profile_id)
2009
+ );
2010
+ if (activeProfile) {
2011
+ const slug = activeProfile.slug ? source_default.gray(` (${activeProfile.slug})`) : "";
2012
+ console.log(
2013
+ source_default.white("Org: ") + source_default.cyan(activeProfile.profile_name) + slug
2014
+ );
2015
+ }
2016
+ if (profiles.length > 1) {
2017
+ console.log(
2018
+ source_default.gray(
2019
+ `
2020
+ ${profiles.length} organizations available. Use ` + source_default.white("npx mcp-use org list") + " to see all."
2021
+ )
2022
+ );
2023
+ }
2024
+ }
1909
2025
  } catch (error) {
1910
2026
  console.error(
1911
2027
  source_default.red.bold("\n\u2717 Failed to get user info:"),
@@ -3382,10 +3498,15 @@ async function displayDeploymentProgress(api, deployment) {
3382
3498
  const mcpServerUrl = getMcpServerUrl(finalDeployment);
3383
3499
  let dashboardUrl = null;
3384
3500
  const webUrl = (await getWebUrl()).replace(/\/$/, "");
3385
- if (finalDeployment.serverSlug) {
3386
- dashboardUrl = `${webUrl}/cloud/servers/${finalDeployment.serverSlug}`;
3387
- } else if (finalDeployment.serverId) {
3388
- dashboardUrl = `${webUrl}/cloud/servers/${finalDeployment.serverId}`;
3501
+ const config = await readConfig();
3502
+ const orgSlug = config.profileSlug;
3503
+ const serverRef = finalDeployment.serverSlug || finalDeployment.serverId;
3504
+ if (serverRef) {
3505
+ if (orgSlug) {
3506
+ dashboardUrl = `${webUrl}/cloud/${orgSlug}/servers/${serverRef}`;
3507
+ } else {
3508
+ dashboardUrl = `${webUrl}/cloud/servers/${serverRef}`;
3509
+ }
3389
3510
  }
3390
3511
  const inspectorUrl = `https://inspector.manufact.com/inspector?autoConnect=${encodeURIComponent(
3391
3512
  mcpServerUrl
@@ -3785,6 +3906,34 @@ async function deployCommand(options) {
3785
3906
  }
3786
3907
  console.log();
3787
3908
  const api = await McpUseAPI.create();
3909
+ if (options.org) {
3910
+ try {
3911
+ const authInfo = await api.testAuth();
3912
+ const match = (authInfo.profiles ?? []).find(
3913
+ (p) => p.slug === options.org || p.id === options.org || p.profile_name.toLowerCase() === options.org.toLowerCase()
3914
+ );
3915
+ if (match) {
3916
+ api.setProfileId(match.id);
3917
+ const slug = match.slug ? source_default.gray(` (${match.slug})`) : "";
3918
+ console.log(
3919
+ source_default.gray("Organization: ") + source_default.cyan(match.profile_name) + slug
3920
+ );
3921
+ } else {
3922
+ console.error(
3923
+ source_default.red(
3924
+ `\u2717 Organization "${options.org}" not found. Run ${source_default.white("npx mcp-use org list")} to see available organizations.`
3925
+ )
3926
+ );
3927
+ process.exit(1);
3928
+ }
3929
+ } catch (error) {
3930
+ console.error(
3931
+ source_default.red("\u2717 Failed to resolve organization:"),
3932
+ source_default.red(error instanceof Error ? error.message : "Unknown error")
3933
+ );
3934
+ process.exit(1);
3935
+ }
3936
+ }
3788
3937
  let githubVerified = false;
3789
3938
  try {
3790
3939
  console.log(source_default.gray(`[DEBUG] API URL: ${api.baseUrl}`));
@@ -3961,6 +4110,18 @@ async function deployCommand(options) {
3961
4110
  healthCheckPath: "/healthz",
3962
4111
  serverId
3963
4112
  };
4113
+ if (!options.org) {
4114
+ try {
4115
+ const config = await readConfig();
4116
+ if (config.profileName) {
4117
+ const slug = config.profileSlug ? source_default.gray(` (${config.profileSlug})`) : "";
4118
+ console.log(
4119
+ source_default.gray("Organization: ") + source_default.cyan(config.profileName) + slug
4120
+ );
4121
+ }
4122
+ } catch {
4123
+ }
4124
+ }
3964
4125
  console.log(source_default.gray("Creating deployment..."));
3965
4126
  const deployment = await api.createDeployment(deploymentRequest);
3966
4127
  console.log(
@@ -4520,6 +4681,125 @@ function createDeploymentsCommand() {
4520
4681
  return deploymentsCommand;
4521
4682
  }
4522
4683
 
4684
+ // src/commands/org.ts
4685
+ async function ensureLoggedIn() {
4686
+ if (!await isLoggedIn()) {
4687
+ console.log(source_default.yellow("\u26A0\uFE0F You are not logged in."));
4688
+ console.log(
4689
+ source_default.gray("Run " + source_default.white("npx mcp-use login") + " to get started.")
4690
+ );
4691
+ return false;
4692
+ }
4693
+ return true;
4694
+ }
4695
+ async function orgListCommand() {
4696
+ try {
4697
+ if (!await ensureLoggedIn()) return;
4698
+ const api = await McpUseAPI.create();
4699
+ const authInfo = await api.testAuth();
4700
+ const config = await readConfig();
4701
+ const profiles = authInfo.profiles ?? [];
4702
+ const activeId = config.profileId || authInfo.default_profile_id;
4703
+ if (profiles.length === 0) {
4704
+ console.log(source_default.yellow("No organizations found."));
4705
+ return;
4706
+ }
4707
+ console.log(source_default.cyan.bold("\u{1F3E2} Your organizations:\n"));
4708
+ for (const p of profiles) {
4709
+ const isActive = p.id === activeId;
4710
+ const marker = isActive ? source_default.green(" \u2190 active") : "";
4711
+ const slug = p.slug ? source_default.gray(` (${p.slug})`) : "";
4712
+ const role = source_default.gray(` [${p.role}]`);
4713
+ const name = isActive ? source_default.cyan.bold(p.profile_name) : source_default.white(p.profile_name);
4714
+ console.log(` ${name}${slug}${role}${marker}`);
4715
+ }
4716
+ if (profiles.length > 1) {
4717
+ console.log(
4718
+ source_default.gray("\nSwitch with " + source_default.white("npx mcp-use org switch"))
4719
+ );
4720
+ }
4721
+ } catch (error) {
4722
+ console.error(
4723
+ source_default.red.bold("\n\u2717 Failed to list organizations:"),
4724
+ source_default.red(error instanceof Error ? error.message : "Unknown error")
4725
+ );
4726
+ process.exit(1);
4727
+ }
4728
+ }
4729
+ async function orgSwitchCommand() {
4730
+ try {
4731
+ if (!await ensureLoggedIn()) return;
4732
+ const api = await McpUseAPI.create();
4733
+ const authInfo = await api.testAuth();
4734
+ const config = await readConfig();
4735
+ const profiles = authInfo.profiles ?? [];
4736
+ if (profiles.length === 0) {
4737
+ console.log(source_default.yellow("No organizations found."));
4738
+ return;
4739
+ }
4740
+ if (profiles.length === 1) {
4741
+ const p = profiles[0];
4742
+ const slug2 = p.slug ? source_default.gray(` (${p.slug})`) : "";
4743
+ console.log(
4744
+ source_default.yellow(
4745
+ `You only have one organization: ${source_default.cyan(p.profile_name)}${slug2}`
4746
+ )
4747
+ );
4748
+ return;
4749
+ }
4750
+ const activeId = config.profileId || authInfo.default_profile_id;
4751
+ const selected = await promptOrgSelection(profiles, activeId);
4752
+ if (!selected) {
4753
+ console.log(source_default.yellow("No organization selected."));
4754
+ return;
4755
+ }
4756
+ await writeConfig({
4757
+ ...config,
4758
+ profileId: selected.id,
4759
+ profileName: selected.profile_name,
4760
+ profileSlug: selected.slug ?? void 0
4761
+ });
4762
+ try {
4763
+ await api.setDefaultProfile(selected.id);
4764
+ } catch {
4765
+ }
4766
+ const slug = selected.slug ? source_default.gray(` (${selected.slug})`) : "";
4767
+ console.log(
4768
+ source_default.green.bold("\n\u2713 Switched to ") + source_default.cyan.bold(selected.profile_name) + slug
4769
+ );
4770
+ } catch (error) {
4771
+ console.error(
4772
+ source_default.red.bold("\n\u2717 Failed to switch organization:"),
4773
+ source_default.red(error instanceof Error ? error.message : "Unknown error")
4774
+ );
4775
+ process.exit(1);
4776
+ }
4777
+ }
4778
+ async function orgCurrentCommand() {
4779
+ try {
4780
+ if (!await ensureLoggedIn()) return;
4781
+ const config = await readConfig();
4782
+ if (!config.profileId) {
4783
+ console.log(
4784
+ source_default.yellow(
4785
+ "No organization selected. Run " + source_default.white("npx mcp-use org switch") + " to pick one."
4786
+ )
4787
+ );
4788
+ return;
4789
+ }
4790
+ const slug = config.profileSlug ? source_default.gray(` (${config.profileSlug})`) : "";
4791
+ console.log(
4792
+ source_default.cyan.bold("\u{1F3E2} Active organization: ") + source_default.white(config.profileName || config.profileId) + slug
4793
+ );
4794
+ } catch (error) {
4795
+ console.error(
4796
+ source_default.red.bold("\n\u2717 Failed to get organization:"),
4797
+ source_default.red(error instanceof Error ? error.message : "Unknown error")
4798
+ );
4799
+ process.exit(1);
4800
+ }
4801
+ }
4802
+
4523
4803
  // src/commands/skills.ts
4524
4804
  var import_commander3 = require("commander");
4525
4805
  var import_node_fs8 = require("fs");
@@ -6570,6 +6850,16 @@ program.command("logout").description("Logout from Manufact cloud").action(async
6570
6850
  program.command("whoami").description("Show current user information").action(async () => {
6571
6851
  await whoamiCommand();
6572
6852
  });
6853
+ var orgCommand = program.command("org").description("Manage organizations");
6854
+ orgCommand.command("list").description("List your organizations").action(async () => {
6855
+ await orgListCommand();
6856
+ });
6857
+ orgCommand.command("switch").description("Switch the active organization").action(async () => {
6858
+ await orgSwitchCommand();
6859
+ });
6860
+ orgCommand.command("current").description("Show the currently active organization").action(async () => {
6861
+ await orgCurrentCommand();
6862
+ });
6573
6863
  program.command("deploy").description("Deploy MCP server from GitHub to Manufact cloud").option("--open", "Open deployment in browser after successful deploy").option("--name <name>", "Custom deployment name").option("--port <port>", "Server port", "3000").option("--runtime <runtime>", "Runtime (node or python)").option(
6574
6864
  "--new",
6575
6865
  "Force creation of new deployment instead of reusing linked deployment"
@@ -6579,6 +6869,9 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
6579
6869
  ).option("--env-file <path>", "Path to .env file with environment variables").option(
6580
6870
  "--root-dir <path>",
6581
6871
  "Root directory within repo to deploy from (for monorepos)"
6872
+ ).option(
6873
+ "--org <slug-or-id>",
6874
+ "Deploy to a specific organization (by slug or ID)"
6582
6875
  ).action(async (options) => {
6583
6876
  await deployCommand({
6584
6877
  open: options.open,
@@ -6588,7 +6881,8 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
6588
6881
  new: options.new,
6589
6882
  env: options.env,
6590
6883
  envFile: options.envFile,
6591
- rootDir: options.rootDir
6884
+ rootDir: options.rootDir,
6885
+ org: options.org
6592
6886
  });
6593
6887
  });
6594
6888
  program.addCommand(createClientCommand());