@mcp-use/cli 3.1.0-canary.1 → 3.1.0-canary.2

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/README.md CHANGED
@@ -125,6 +125,9 @@ Deploy your MCP server to production via [manufact.com](https://manufact.com):
125
125
  # Login to Manufact cloud
126
126
  mcp-use login
127
127
 
128
+ # Non-interactive login (for agents / CI) — picks an org without prompting
129
+ mcp-use login --org <slug|id|name>
130
+
128
131
  # Check authentication status
129
132
  mcp-use whoami
130
133
 
@@ -1,4 +1,9 @@
1
1
  import type { OrgInfo } from "../utils/api.js";
2
+ /**
3
+ * Resolve an org identifier (slug, id, or case-insensitive name) against a list.
4
+ * Returns null if no match.
5
+ */
6
+ export declare function resolveOrgFromOption(orgs: OrgInfo[], identifier: string): OrgInfo | null;
2
7
  /**
3
8
  * Prompt user to pick an organization from a numbered list.
4
9
  */
@@ -9,6 +14,7 @@ export declare function promptOrgSelection(orgs: OrgInfo[], defaultOrgId?: strin
9
14
  export declare function loginCommand(options?: {
10
15
  silent?: boolean;
11
16
  apiKey?: string;
17
+ org?: string;
12
18
  }): Promise<void>;
13
19
  /**
14
20
  * Logout command - revokes API key and deletes config
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AA8F/C;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,OAAO,EAAE,EACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CA2CzB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4IhB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAwBnD;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkEnD"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAoB,OAAO,EAAE,MAAM,iBAAiB,CAAC;AA8FjE;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,OAAO,EAAE,EACf,UAAU,EAAE,MAAM,GACjB,OAAO,GAAG,IAAI,CAUhB;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,OAAO,EAAE,EACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAC3B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CA2CzB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,GAAG,OAAO,CAAC,IAAI,CAAC,CA0JhB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAwBnD;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAkEnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AA4IA,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;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAueD,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAwsBzE"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAgJA,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;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAueD,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAmsBzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../src/commands/servers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6UpC,wBAAgB,oBAAoB,IAAI,OAAO,CAkC9C"}
1
+ {"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../src/commands/servers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyUpC,wBAAgB,oBAAoB,IAAI,OAAO,CAkC9C"}
package/dist/index.cjs CHANGED
@@ -1589,6 +1589,14 @@ async function pollForDeviceToken(authBaseUrl, deviceCode, intervalSeconds) {
1589
1589
  }
1590
1590
  throw new Error("Login timed out. Please try again.");
1591
1591
  }
1592
+ function resolveOrgFromOption(orgs, identifier) {
1593
+ const needle = identifier.trim();
1594
+ if (!needle) return null;
1595
+ const lower = needle.toLowerCase();
1596
+ return orgs.find(
1597
+ (o) => o.slug === needle || o.id === needle || o.name.toLowerCase() === lower
1598
+ ) ?? null;
1599
+ }
1592
1600
  async function promptOrgSelection(orgs, defaultOrgId) {
1593
1601
  if (orgs.length === 0) return null;
1594
1602
  if (orgs.length === 1) {
@@ -1635,8 +1643,8 @@ async function loginCommand(options) {
1635
1643
  console.log(source_default.green.bold("\u2713 API key saved."));
1636
1644
  try {
1637
1645
  const api2 = await McpUseAPI.create();
1638
- const authInfo = await api2.testAuth();
1639
- console.log(source_default.gray(` Authenticated as ${authInfo.email}`));
1646
+ const authInfo2 = await api2.testAuth();
1647
+ console.log(source_default.gray(` Authenticated as ${authInfo2.email}`));
1640
1648
  } catch {
1641
1649
  console.log(
1642
1650
  source_default.gray(
@@ -1688,9 +1696,19 @@ async function loginCommand(options) {
1688
1696
  const keyResp = await api.createApiKeyWithAccessToken(accessToken, "CLI");
1689
1697
  await writeConfig({ apiKey: keyResp.key });
1690
1698
  console.log(source_default.green.bold("\n\u2713 Successfully logged in!"));
1699
+ let authInfo = null;
1691
1700
  try {
1692
1701
  const freshApi = await McpUseAPI.create();
1693
- const authInfo = await freshApi.testAuth();
1702
+ authInfo = await freshApi.testAuth();
1703
+ } catch {
1704
+ console.log(
1705
+ source_default.gray(
1706
+ `
1707
+ Your API key has been saved to ${source_default.white("~/.mcp-use/config.json")}`
1708
+ )
1709
+ );
1710
+ }
1711
+ if (authInfo) {
1694
1712
  console.log(source_default.cyan.bold("\nCurrent user:\n"));
1695
1713
  console.log(source_default.white(" Email: ") + source_default.cyan(authInfo.email));
1696
1714
  console.log(source_default.white(" User ID: ") + source_default.gray(authInfo.user_id));
@@ -1702,8 +1720,19 @@ async function loginCommand(options) {
1702
1720
  const orgs = authInfo.orgs ?? [];
1703
1721
  if (orgs.length > 0) {
1704
1722
  let selectedOrg = null;
1705
- if (orgs.length === 1) {
1723
+ if (options?.org) {
1724
+ selectedOrg = resolveOrgFromOption(orgs, options.org);
1725
+ if (!selectedOrg) {
1726
+ throw new Error(
1727
+ `Organization "${options.org}" not found. Run 'npx mcp-use org list' after logging in to see available organizations.`
1728
+ );
1729
+ }
1730
+ } else if (orgs.length === 1) {
1706
1731
  selectedOrg = orgs[0];
1732
+ } else if (!process.stdin.isTTY) {
1733
+ throw new Error(
1734
+ "Multiple organizations available and no TTY for interactive selection. Re-run with --org <slug|id|name> to pick one non-interactively."
1735
+ );
1707
1736
  } else {
1708
1737
  selectedOrg = await promptOrgSelection(orgs, authInfo.default_org_id);
1709
1738
  }
@@ -1721,13 +1750,6 @@ async function loginCommand(options) {
1721
1750
  );
1722
1751
  }
1723
1752
  }
1724
- } catch {
1725
- console.log(
1726
- source_default.gray(
1727
- `
1728
- Your API key has been saved to ${source_default.white("~/.mcp-use/config.json")}`
1729
- )
1730
- );
1731
1753
  }
1732
1754
  console.log(
1733
1755
  source_default.gray(
@@ -3575,9 +3597,7 @@ async function deployCommand(options) {
3575
3597
  let resolvedOrgId;
3576
3598
  if (options.org) {
3577
3599
  const authInfo = await api.testAuth();
3578
- const match = (authInfo.orgs ?? []).find(
3579
- (o) => o.slug === options.org || o.id === options.org || o.name.toLowerCase() === options.org.toLowerCase()
3580
- );
3600
+ const match = resolveOrgFromOption(authInfo.orgs ?? [], options.org);
3581
3601
  if (match) {
3582
3602
  api.setOrgId(match.id);
3583
3603
  resolvedOrgId = match.id;
@@ -4801,9 +4821,7 @@ function pickStr(obj, key) {
4801
4821
  async function applyOrgOption(api, org) {
4802
4822
  if (!org) return;
4803
4823
  const authInfo = await api.testAuth();
4804
- const match = (authInfo.orgs ?? []).find(
4805
- (o) => o.slug === org || o.id === org || o.name.toLowerCase() === org.toLowerCase()
4806
- );
4824
+ const match = resolveOrgFromOption(authInfo.orgs ?? [], org);
4807
4825
  if (!match) {
4808
4826
  console.error(
4809
4827
  source_default.red(
@@ -7222,9 +7240,9 @@ Looked for:
7222
7240
  program.command("login").description("Login to mcp-use cloud").option(
7223
7241
  "--api-key <key>",
7224
7242
  "Login with an API key directly (non-interactive, for CI/CD)"
7225
- ).action(async (opts) => {
7243
+ ).option("--org <slug|id|name>", "Select an organization non-interactively").action(async (opts) => {
7226
7244
  try {
7227
- await loginCommand({ apiKey: opts.apiKey });
7245
+ await loginCommand({ apiKey: opts.apiKey, org: opts.org });
7228
7246
  process.exit(0);
7229
7247
  } catch (error) {
7230
7248
  console.error(