@mcp-use/cli 3.0.2 → 3.1.0-canary.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
@@ -4190,7 +4190,27 @@ async function listDeploymentsCommand() {
4190
4190
  process.exit(1);
4191
4191
  }
4192
4192
  const api = await McpUseAPI.create();
4193
- const deployments = await api.listDeployments();
4193
+ const [deployments, authResult] = await Promise.all([
4194
+ api.listDeployments(),
4195
+ api.testAuth()
4196
+ ]);
4197
+ const orgMap = new Map(authResult.orgs.map((o) => [o.id, o.name]));
4198
+ const uniqueServerIds = [
4199
+ ...new Set(
4200
+ deployments.map((d) => d.serverId).filter((id) => id != null)
4201
+ )
4202
+ ];
4203
+ const serverResults = await Promise.allSettled(
4204
+ uniqueServerIds.map((id) => api.getServer(id))
4205
+ );
4206
+ const serverOrgMap = /* @__PURE__ */ new Map();
4207
+ for (let i = 0; i < uniqueServerIds.length; i++) {
4208
+ const result = serverResults[i];
4209
+ if (result.status === "fulfilled") {
4210
+ const orgName = orgMap.get(result.value.organizationId) ?? result.value.organizationId.substring(0, 19);
4211
+ serverOrgMap.set(uniqueServerIds[i], orgName);
4212
+ }
4213
+ }
4194
4214
  const sortedDeployments = [...deployments].sort(
4195
4215
  (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
4196
4216
  );
@@ -4210,19 +4230,21 @@ async function listDeploymentsCommand() {
4210
4230
  );
4211
4231
  console.log(
4212
4232
  source_default.white.bold(
4213
- `${"ID".padEnd(40)} ${"NAME".padEnd(25)} ${"STATUS".padEnd(12)} ${"MCP URL".padEnd(45)} ${"CREATED"}`
4233
+ `${"ID".padEnd(40)} ${"NAME".padEnd(25)} ${"ORG".padEnd(20)} ${"STATUS".padEnd(12)} ${"MCP URL".padEnd(45)} ${"CREATED"}`
4214
4234
  )
4215
4235
  );
4216
- console.log(source_default.gray("\u2500".repeat(140)));
4236
+ console.log(source_default.gray("\u2500".repeat(155)));
4217
4237
  for (const deployment of sortedDeployments) {
4218
4238
  const id = formatId(deployment.id).padEnd(40);
4219
4239
  const name = deployment.name.substring(0, 24).padEnd(25);
4240
+ const orgName = deployment.serverId ? serverOrgMap.get(deployment.serverId) ?? "-" : "-";
4241
+ const org = orgName.substring(0, 19).padEnd(20);
4220
4242
  const statusColor = getStatusColor(deployment.status);
4221
4243
  const status = statusColor(deployment.status.padEnd(12));
4222
4244
  const mcpUrl = (deployment.mcpUrl || "-").substring(0, 44).padEnd(45);
4223
4245
  const created = formatRelativeTime(deployment.createdAt);
4224
4246
  console.log(
4225
- `${source_default.gray(id)} ${name} ${status} ${source_default.cyan(mcpUrl)} ${source_default.gray(created)}`
4247
+ `${source_default.gray(id)} ${name} ${source_default.magenta(org)} ${status} ${source_default.cyan(mcpUrl)} ${source_default.gray(created)}`
4226
4248
  );
4227
4249
  }
4228
4250
  console.log();
@@ -6970,7 +6992,13 @@ program.command("start").description("Start production server").option("-p, --pa
6970
6992
  try {
6971
6993
  const projectPath = path7.resolve(options.path);
6972
6994
  const portFlagProvided = process.argv.includes("--port") || process.argv.includes("-p") || process.argv.some((arg) => arg.startsWith("--port=")) || process.argv.some((arg) => arg.startsWith("-p="));
6973
- const port = portFlagProvided ? parseInt(options.port, 10) : parseInt(process.env.PORT || options.port || "3000", 10);
6995
+ let port = portFlagProvided ? parseInt(options.port, 10) : parseInt(process.env.PORT || options.port || "3000", 10);
6996
+ if (!await isPortAvailable(port)) {
6997
+ console.log(source_default.yellow.bold(`\u26A0\uFE0F Port ${port} is already in use`));
6998
+ const availablePort = await findAvailablePort(port);
6999
+ console.log(source_default.green.bold(`\u2713 Using port ${availablePort} instead`));
7000
+ port = availablePort;
7001
+ }
6974
7002
  console.log(
6975
7003
  `\x1B[36m\x1B[1mmcp-use\x1B[0m \x1B[90mVersion: ${packageJson.version}\x1B[0m
6976
7004
  `