@mcp-use/cli 3.3.2-canary.2 → 3.3.2-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 +1 @@
1
- {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/commands/deployments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4gBpC,wBAAgB,wBAAwB,IAAI,OAAO,CAyDlD"}
1
+ {"version":3,"file":"deployments.d.ts","sourceRoot":"","sources":["../../src/commands/deployments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8kBpC,wBAAgB,wBAAwB,IAAI,OAAO,CA4DlD"}
@@ -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;AA8TpC,wBAAgB,oBAAoB,IAAI,OAAO,CAoC9C"}
1
+ {"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../src/commands/servers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyWpC,wBAAgB,oBAAoB,IAAI,OAAO,CAoC9C"}
package/dist/index.cjs CHANGED
@@ -1229,6 +1229,39 @@ var ApiUnauthorizedError = class extends Error {
1229
1229
  this.name = "ApiUnauthorizedError";
1230
1230
  }
1231
1231
  };
1232
+ function normalizePaginatedResponse(response, params) {
1233
+ if (Array.isArray(response)) {
1234
+ return {
1235
+ items: response,
1236
+ total: response.length,
1237
+ limit: params?.limit ?? response.length,
1238
+ skip: params?.skip ?? 0
1239
+ };
1240
+ }
1241
+ return {
1242
+ items: response.items,
1243
+ total: response.total,
1244
+ limit: response.limit,
1245
+ skip: response.skip
1246
+ };
1247
+ }
1248
+ function buildPaginationQuery(params) {
1249
+ const search = new URLSearchParams();
1250
+ if (params?.organizationId) {
1251
+ search.set("organizationId", params.organizationId);
1252
+ }
1253
+ if (params?.limit != null) {
1254
+ search.set("limit", String(params.limit));
1255
+ }
1256
+ if (params?.skip != null) {
1257
+ search.set("skip", String(params.skip));
1258
+ }
1259
+ if (params?.sort) {
1260
+ search.set("sort", params.sort);
1261
+ }
1262
+ const q = search.toString();
1263
+ return q ? `?${q}` : "";
1264
+ }
1232
1265
  var McpUseAPI = class _McpUseAPI {
1233
1266
  baseUrl;
1234
1267
  apiKey;
@@ -1357,21 +1390,8 @@ var McpUseAPI = class _McpUseAPI {
1357
1390
  });
1358
1391
  }
1359
1392
  async listServers(params) {
1360
- const search = new URLSearchParams();
1361
- if (params?.organizationId) {
1362
- search.set("organizationId", params.organizationId);
1363
- }
1364
- if (params?.limit != null) {
1365
- search.set("limit", String(params.limit));
1366
- }
1367
- if (params?.skip != null) {
1368
- search.set("skip", String(params.skip));
1369
- }
1370
- if (params?.sort) {
1371
- search.set("sort", params.sort);
1372
- }
1373
- const q = search.toString();
1374
- return this.request(`/servers${q ? `?${q}` : ""}`);
1393
+ const response = await this.request(`/servers${buildPaginationQuery(params)}`);
1394
+ return normalizePaginatedResponse(response, params);
1375
1395
  }
1376
1396
  async getServer(idOrSlug) {
1377
1397
  const path11 = encodeURIComponent(idOrSlug);
@@ -1425,8 +1445,9 @@ var McpUseAPI = class _McpUseAPI {
1425
1445
  async getDeployment(deploymentId) {
1426
1446
  return this.request(`/deployments/${deploymentId}`);
1427
1447
  }
1428
- async listDeployments() {
1429
- return this.request("/deployments");
1448
+ async listDeployments(params) {
1449
+ const response = await this.request(`/deployments${buildPaginationQuery(params)}`);
1450
+ return normalizePaginatedResponse(response, params);
1430
1451
  }
1431
1452
  async deleteDeployment(deploymentId) {
1432
1453
  await this.request(`/deployments/${deploymentId}`, {
@@ -5863,6 +5884,7 @@ async function deployCommand(options) {
5863
5884
 
5864
5885
  // src/commands/deployments.ts
5865
5886
  var import_commander3 = require("commander");
5887
+ var DEFAULT_LIST_LIMIT = 30;
5866
5888
  async function prompt2(question) {
5867
5889
  const readline = await import("readline");
5868
5890
  const rl = readline.createInterface({
@@ -5894,7 +5916,23 @@ function getStatusColor(status) {
5894
5916
  function formatId(id) {
5895
5917
  return id;
5896
5918
  }
5897
- async function listDeploymentsCommand() {
5919
+ function formatPageHeader(label, count, total) {
5920
+ return count === total ? `${label} (${total})` : `${label} (${count} of ${total})`;
5921
+ }
5922
+ function printNextPageHint(command, page, extraArgs = []) {
5923
+ const nextSkip = page.skip + page.items.length;
5924
+ if (nextSkip >= page.total) return;
5925
+ const args = [
5926
+ command,
5927
+ "--limit",
5928
+ String(page.limit),
5929
+ "--skip",
5930
+ String(nextSkip),
5931
+ ...extraArgs
5932
+ ];
5933
+ console.log(source_default.gray(`Next page: ${args.join(" ")}`));
5934
+ }
5935
+ async function listDeploymentsCommand(options) {
5898
5936
  try {
5899
5937
  if (!await isLoggedIn()) {
5900
5938
  console.log(source_default.red("\u2717 You are not logged in."));
@@ -5905,11 +5943,26 @@ async function listDeploymentsCommand() {
5905
5943
  );
5906
5944
  process.exit(1);
5907
5945
  }
5946
+ const limit = options.limit ? parseInt(options.limit, 10) : DEFAULT_LIST_LIMIT;
5947
+ const skip = options.skip ? parseInt(options.skip, 10) : void 0;
5948
+ if (limit !== void 0 && (Number.isNaN(limit) || limit < 1)) {
5949
+ console.log(source_default.red("\u2717 Invalid --limit"));
5950
+ process.exit(1);
5951
+ }
5952
+ if (skip !== void 0 && (Number.isNaN(skip) || skip < 0)) {
5953
+ console.log(source_default.red("\u2717 Invalid --skip"));
5954
+ process.exit(1);
5955
+ }
5908
5956
  const api = await McpUseAPI.create();
5909
- const [deployments, authResult] = await Promise.all([
5910
- api.listDeployments(),
5957
+ const [page, authResult] = await Promise.all([
5958
+ api.listDeployments({
5959
+ limit,
5960
+ skip,
5961
+ sort: options.sort ?? "createdAt:desc"
5962
+ }),
5911
5963
  api.testAuth()
5912
5964
  ]);
5965
+ const deployments = page.items;
5913
5966
  const orgMap = new Map(authResult.orgs.map((o) => [o.id, o.name]));
5914
5967
  const uniqueServerIds = [
5915
5968
  ...new Set(
@@ -5931,18 +5984,31 @@ async function listDeploymentsCommand() {
5931
5984
  (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
5932
5985
  );
5933
5986
  if (sortedDeployments.length === 0) {
5934
- console.log(source_default.yellow("No deployments found."));
5935
- console.log(
5936
- source_default.gray(
5937
- "\nDeploy your first MCP server with " + source_default.white("mcp-use deploy")
5938
- )
5939
- );
5987
+ if (page.total === 0) {
5988
+ console.log(source_default.yellow("No deployments found."));
5989
+ console.log(
5990
+ source_default.gray(
5991
+ "\nDeploy your first MCP server with " + source_default.white("mcp-use deploy")
5992
+ )
5993
+ );
5994
+ } else {
5995
+ console.log(
5996
+ source_default.yellow(`No deployments found at --skip ${page.skip}.`)
5997
+ );
5998
+ console.log(source_default.gray(`Total deployments: ${page.total}`));
5999
+ }
5940
6000
  return;
5941
6001
  }
5942
6002
  console.log(
5943
- source_default.cyan.bold(`
5944
- \u{1F4E6} Deployments (${sortedDeployments.length})
5945
- `)
6003
+ source_default.cyan.bold(
6004
+ `
6005
+ \u{1F4E6} ${formatPageHeader(
6006
+ "Deployments",
6007
+ sortedDeployments.length,
6008
+ page.total
6009
+ )}
6010
+ `
6011
+ )
5946
6012
  );
5947
6013
  console.log(
5948
6014
  source_default.white.bold(
@@ -5963,6 +6029,9 @@ async function listDeploymentsCommand() {
5963
6029
  `${source_default.gray(id)} ${name} ${source_default.magenta(org)} ${status} ${source_default.cyan(mcpUrl)} ${source_default.gray(created)}`
5964
6030
  );
5965
6031
  }
6032
+ const extraArgs = [];
6033
+ if (options.sort) extraArgs.push("--sort", options.sort);
6034
+ printNextPageHint("mcp-use deployments list", page, extraArgs);
5966
6035
  console.log();
5967
6036
  } catch (error) {
5968
6037
  handleCommandError(error, "Failed to list deployments");
@@ -6277,7 +6346,7 @@ function createDeploymentsCommand() {
6277
6346
  const deploymentsCommand = new import_commander3.Command("deployments").description("Manage cloud deployments").showHelpAfterError(
6278
6347
  "(Run `mcp-use deployments --help` to see available commands)"
6279
6348
  );
6280
- deploymentsCommand.command("list").alias("ls").description("List all deployments").action(listDeploymentsCommand);
6349
+ deploymentsCommand.command("list").alias("ls").description("List deployments").option("--limit <n>", "Page size (default 30)").option("--skip <n>", "Offset for pagination").option("--sort <field:asc|desc>", "Sort (e.g. createdAt:desc)").action(listDeploymentsCommand);
6281
6350
  deploymentsCommand.command("get").argument("<deployment-id>", "Deployment ID").description("Get deployment details").action(getDeploymentCommand);
6282
6351
  deploymentsCommand.command("restart").argument("<deployment-id>", "Deployment ID").option("-f, --follow", "Follow build logs").description(
6283
6352
  "Restart a deployment (triggers a new deployment on the same server)"
@@ -6456,6 +6525,7 @@ function createEnvCommand() {
6456
6525
  }
6457
6526
 
6458
6527
  // src/commands/servers.ts
6528
+ var DEFAULT_LIST_LIMIT2 = 30;
6459
6529
  async function prompt3(question) {
6460
6530
  const readline = await import("readline");
6461
6531
  const rl = readline.createInterface({
@@ -6503,6 +6573,22 @@ function getStatusColor2(status) {
6503
6573
  if (s.includes("build") || s.includes("pend")) return source_default.yellow;
6504
6574
  return source_default.gray;
6505
6575
  }
6576
+ function formatPageHeader2(label, count, total) {
6577
+ return count === total ? `${label} (${total})` : `${label} (${count} of ${total})`;
6578
+ }
6579
+ function printNextPageHint2(command, page, extraArgs = []) {
6580
+ const nextSkip = page.skip + page.items.length;
6581
+ if (nextSkip >= page.total) return;
6582
+ const args = [
6583
+ command,
6584
+ "--limit",
6585
+ String(page.limit),
6586
+ "--skip",
6587
+ String(nextSkip),
6588
+ ...extraArgs
6589
+ ];
6590
+ console.log(source_default.gray(`Next page: ${args.join(" ")}`));
6591
+ }
6506
6592
  async function listServersCommand(options) {
6507
6593
  try {
6508
6594
  if (!await isLoggedIn()) {
@@ -6517,7 +6603,7 @@ async function listServersCommand(options) {
6517
6603
  const api = await McpUseAPI.create();
6518
6604
  await applyOrgOption(api, options.org);
6519
6605
  if (options.org) console.log();
6520
- const limit = options.limit ? parseInt(options.limit, 10) : void 0;
6606
+ const limit = options.limit ? parseInt(options.limit, 10) : DEFAULT_LIST_LIMIT2;
6521
6607
  const skip = options.skip ? parseInt(options.skip, 10) : void 0;
6522
6608
  if (limit !== void 0 && (Number.isNaN(limit) || limit < 1)) {
6523
6609
  console.log(source_default.red("\u2717 Invalid --limit"));
@@ -6527,23 +6613,33 @@ async function listServersCommand(options) {
6527
6613
  console.log(source_default.red("\u2717 Invalid --skip"));
6528
6614
  process.exit(1);
6529
6615
  }
6530
- const servers = await api.listServers({
6616
+ const page = await api.listServers({
6531
6617
  limit,
6532
6618
  skip,
6533
6619
  sort: options.sort
6534
6620
  });
6621
+ const servers = page.items;
6535
6622
  if (servers.length === 0) {
6536
- console.log(source_default.yellow("No servers found."));
6537
- console.log(
6538
- source_default.gray(
6539
- "\nCreate one by deploying with " + source_default.white("mcp-use deploy")
6540
- )
6541
- );
6623
+ if (page.total === 0) {
6624
+ console.log(source_default.yellow("No servers found."));
6625
+ console.log(
6626
+ source_default.gray(
6627
+ "\nCreate one by deploying with " + source_default.white("mcp-use deploy")
6628
+ )
6629
+ );
6630
+ } else {
6631
+ console.log(source_default.yellow(`No servers found at --skip ${page.skip}.`));
6632
+ console.log(source_default.gray(`Total servers: ${page.total}`));
6633
+ }
6542
6634
  return;
6543
6635
  }
6544
- console.log(source_default.cyan.bold(`
6545
- \u{1F5A5} Servers (${servers.length})
6546
- `));
6636
+ console.log(
6637
+ source_default.cyan.bold(
6638
+ `
6639
+ \u{1F5A5} ${formatPageHeader2("Servers", servers.length, page.total)}
6640
+ `
6641
+ )
6642
+ );
6547
6643
  console.log(
6548
6644
  source_default.white.bold(
6549
6645
  `${"ID".padEnd(38)} ${"NAME".padEnd(22)} ${"STATUS".padEnd(14)} ${"REPO".padEnd(32)} ${"MCP URL".padEnd(52)}`
@@ -6561,6 +6657,10 @@ async function listServersCommand(options) {
6561
6657
  `${source_default.gray(id)} ${name} ${status} ${source_default.gray(repo)} ${source_default.cyan(mcp)}`
6562
6658
  );
6563
6659
  }
6660
+ const extraArgs = [];
6661
+ if (options.sort) extraArgs.push("--sort", options.sort);
6662
+ if (options.org) extraArgs.push("--org", options.org);
6663
+ printNextPageHint2("mcp-use servers list", page, extraArgs);
6564
6664
  console.log();
6565
6665
  } catch (error) {
6566
6666
  handleCommandError(error, "Failed to list servers");
@@ -6723,7 +6823,7 @@ function createServersCommand() {
6723
6823
  const serversCommand = new import_commander5.Command("servers").description("Manage cloud servers (Git-backed deploy targets)").showHelpAfterError(
6724
6824
  "(Run `mcp-use servers --help` to see available commands)"
6725
6825
  );
6726
- serversCommand.command("list").alias("ls").description("List servers for the current organization").option("--org <slug-or-id>", "Target organization (slug, id, or name)").option("--limit <n>", "Page size (1\u2013100, default 50)").option("--skip <n>", "Offset for pagination").option("--sort <field:asc|desc>", "Sort (e.g. updatedAt:desc)").action(listServersCommand);
6826
+ serversCommand.command("list").alias("ls").description("List servers for the current organization").option("--org <slug-or-id>", "Target organization (slug, id, or name)").option("--limit <n>", "Page size (default 30)").option("--skip <n>", "Offset for pagination").option("--sort <field:asc|desc>", "Sort (e.g. updatedAt:desc)").action(listServersCommand);
6727
6827
  serversCommand.command("get").argument("<id-or-slug>", "Server UUID or slug").option("--org <slug-or-id>", "Resolve org context before fetch").description("Show server details and recent deployments").action(getServerCommand);
6728
6828
  serversCommand.command("delete").alias("rm").argument("<server-id>", "Server UUID (or slug if API accepts it)").option("-y, --yes", "Skip confirmation prompt").option("--org <slug-or-id>", "Target organization").description("Delete a server and all its deployments").action(deleteServerCommand);
6729
6829
  serversCommand.addCommand(createEnvCommand());