@mcp-use/cli 3.1.0-canary.3 → 3.1.0-canary.5
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/commands/auth.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deployments.d.ts.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/org.d.ts.map +1 -1
- package/dist/commands/servers.d.ts.map +1 -1
- package/dist/index.cjs +162 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +162 -148
- package/dist/index.js.map +1 -1
- package/dist/utils/errors.d.ts +6 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAYA,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,CAiLhB;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAwBnD;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAqDnD"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAguBzE"}
|
|
@@ -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;
|
|
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,CAuDlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/commands/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/commands/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAiMpC,wBAAgB,gBAAgB,IAAI,OAAO,CAmD1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"org.d.ts","sourceRoot":"","sources":["../../src/commands/org.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAmCpD;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAuDtD;AAED;;GAEG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CA0BvD"}
|
|
@@ -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;
|
|
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,CAkC9C"}
|
package/dist/index.cjs
CHANGED
|
@@ -1528,6 +1528,28 @@ var McpUseAPI = class _McpUseAPI {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
};
|
|
1530
1530
|
|
|
1531
|
+
// src/utils/errors.ts
|
|
1532
|
+
function handleCommandError(error, context) {
|
|
1533
|
+
if (error instanceof ApiUnauthorizedError) {
|
|
1534
|
+
console.error(
|
|
1535
|
+
source_default.red("\n\u2717 Your session has expired or your API key is invalid.")
|
|
1536
|
+
);
|
|
1537
|
+
console.error(
|
|
1538
|
+
source_default.gray(
|
|
1539
|
+
`Run ${source_default.white("npx mcp-use login")} to re-authenticate.
|
|
1540
|
+
`
|
|
1541
|
+
)
|
|
1542
|
+
);
|
|
1543
|
+
process.exit(1);
|
|
1544
|
+
}
|
|
1545
|
+
console.error(
|
|
1546
|
+
source_default.red.bold(`
|
|
1547
|
+
\u2717 ${context}:`),
|
|
1548
|
+
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
1549
|
+
);
|
|
1550
|
+
process.exit(1);
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1531
1553
|
// src/commands/auth.ts
|
|
1532
1554
|
var DEVICE_CLIENT_ID = "mcp-use-cli";
|
|
1533
1555
|
var DEVICE_POLL_TIMEOUT = 18e5;
|
|
@@ -1656,14 +1678,32 @@ async function loginCommand(options) {
|
|
|
1656
1678
|
return;
|
|
1657
1679
|
}
|
|
1658
1680
|
if (await isLoggedIn()) {
|
|
1681
|
+
let needsReauth = false;
|
|
1682
|
+
try {
|
|
1683
|
+
await (await McpUseAPI.create()).testAuth();
|
|
1684
|
+
} catch (e) {
|
|
1685
|
+
if (e instanceof ApiUnauthorizedError) {
|
|
1686
|
+
needsReauth = true;
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
if (!needsReauth) {
|
|
1690
|
+
if (!options?.silent) {
|
|
1691
|
+
console.log(
|
|
1692
|
+
source_default.yellow(
|
|
1693
|
+
"You are already logged in. Run 'npx mcp-use logout' first if you want to login with a different account."
|
|
1694
|
+
)
|
|
1695
|
+
);
|
|
1696
|
+
}
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1659
1699
|
if (!options?.silent) {
|
|
1660
1700
|
console.log(
|
|
1661
1701
|
source_default.yellow(
|
|
1662
|
-
"
|
|
1702
|
+
"\u26A0\uFE0F Stored credentials are invalid or expired. Re-authenticating..."
|
|
1663
1703
|
)
|
|
1664
1704
|
);
|
|
1665
1705
|
}
|
|
1666
|
-
|
|
1706
|
+
await deleteConfig();
|
|
1667
1707
|
}
|
|
1668
1708
|
console.log(source_default.cyan.bold("Logging in to mcp-use cloud...\n"));
|
|
1669
1709
|
const authBaseUrl = await getAuthBaseUrl();
|
|
@@ -1830,21 +1870,7 @@ async function whoamiCommand() {
|
|
|
1830
1870
|
}
|
|
1831
1871
|
}
|
|
1832
1872
|
} catch (error) {
|
|
1833
|
-
|
|
1834
|
-
console.error(
|
|
1835
|
-
source_default.red("\nYour session has expired or your API key is invalid.")
|
|
1836
|
-
);
|
|
1837
|
-
console.log(
|
|
1838
|
-
source_default.gray(`Run ${source_default.white("mcp-use login")} to re-authenticate.
|
|
1839
|
-
`)
|
|
1840
|
-
);
|
|
1841
|
-
} else {
|
|
1842
|
-
console.error(
|
|
1843
|
-
source_default.red.bold("\n\u2717 Failed to get user info:"),
|
|
1844
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
1845
|
-
);
|
|
1846
|
-
}
|
|
1847
|
-
process.exit(1);
|
|
1873
|
+
handleCommandError(error, "Failed to get user info");
|
|
1848
1874
|
}
|
|
1849
1875
|
}
|
|
1850
1876
|
|
|
@@ -3595,12 +3621,16 @@ async function deployCommand(options) {
|
|
|
3595
3621
|
}
|
|
3596
3622
|
let api = await McpUseAPI.create();
|
|
3597
3623
|
let resolvedOrgId;
|
|
3624
|
+
let resolvedOrgName;
|
|
3625
|
+
let resolvedOrgSlug;
|
|
3598
3626
|
if (options.org) {
|
|
3599
3627
|
const authInfo = await api.testAuth();
|
|
3600
3628
|
const match = resolveOrgFromOption(authInfo.orgs ?? [], options.org);
|
|
3601
3629
|
if (match) {
|
|
3602
3630
|
api.setOrgId(match.id);
|
|
3603
3631
|
resolvedOrgId = match.id;
|
|
3632
|
+
resolvedOrgName = match.name;
|
|
3633
|
+
resolvedOrgSlug = match.slug ?? void 0;
|
|
3604
3634
|
const slug = match.slug ? source_default.gray(` (${match.slug})`) : "";
|
|
3605
3635
|
console.log(
|
|
3606
3636
|
source_default.gray("Organization: ") + source_default.cyan(match.name) + slug
|
|
@@ -3640,6 +3670,8 @@ async function deployCommand(options) {
|
|
|
3640
3670
|
}
|
|
3641
3671
|
api.setOrgId(selectedOrg.id);
|
|
3642
3672
|
resolvedOrgId = selectedOrg.id;
|
|
3673
|
+
resolvedOrgName = selectedOrg.name;
|
|
3674
|
+
resolvedOrgSlug = selectedOrg.slug ?? void 0;
|
|
3643
3675
|
await writeConfig({
|
|
3644
3676
|
...config,
|
|
3645
3677
|
orgId: selectedOrg.id,
|
|
@@ -3651,6 +3683,8 @@ async function deployCommand(options) {
|
|
|
3651
3683
|
);
|
|
3652
3684
|
} else {
|
|
3653
3685
|
resolvedOrgId = config.orgId;
|
|
3686
|
+
resolvedOrgName = config.orgName;
|
|
3687
|
+
resolvedOrgSlug = config.orgSlug;
|
|
3654
3688
|
api.setOrgId(config.orgId);
|
|
3655
3689
|
if (config.orgName) {
|
|
3656
3690
|
const slug = config.orgSlug ? source_default.gray(` (${config.orgSlug})`) : "";
|
|
@@ -4047,6 +4081,22 @@ async function deployCommand(options) {
|
|
|
4047
4081
|
}
|
|
4048
4082
|
const existingLink = !options.new ? await getProjectLink(cwd) : null;
|
|
4049
4083
|
let serverId = existingLink?.serverId;
|
|
4084
|
+
if (serverId && resolvedOrgId) {
|
|
4085
|
+
try {
|
|
4086
|
+
const linkedServer = await api.getServer(serverId);
|
|
4087
|
+
if (linkedServer.organizationId !== resolvedOrgId) {
|
|
4088
|
+
const target = resolvedOrgName ? `${resolvedOrgName}${resolvedOrgSlug ? ` (${resolvedOrgSlug})` : ""}` : resolvedOrgId;
|
|
4089
|
+
console.log(
|
|
4090
|
+
source_default.yellow(
|
|
4091
|
+
`\u26A0\uFE0F Linked server belongs to a different organization. Creating a new server in ${target}...
|
|
4092
|
+
`
|
|
4093
|
+
)
|
|
4094
|
+
);
|
|
4095
|
+
serverId = void 0;
|
|
4096
|
+
}
|
|
4097
|
+
} catch {
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4050
4100
|
if (existingLink && serverId) {
|
|
4051
4101
|
try {
|
|
4052
4102
|
const existingDep = await api.getDeployment(existingLink.deploymentId);
|
|
@@ -4289,11 +4339,7 @@ async function listDeploymentsCommand() {
|
|
|
4289
4339
|
}
|
|
4290
4340
|
console.log();
|
|
4291
4341
|
} catch (error) {
|
|
4292
|
-
|
|
4293
|
-
source_default.red.bold("\n\u2717 Failed to list deployments:"),
|
|
4294
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4295
|
-
);
|
|
4296
|
-
process.exit(1);
|
|
4342
|
+
handleCommandError(error, "Failed to list deployments");
|
|
4297
4343
|
}
|
|
4298
4344
|
}
|
|
4299
4345
|
async function getDeploymentCommand(deploymentId) {
|
|
@@ -4355,11 +4401,7 @@ async function getDeploymentCommand(deploymentId) {
|
|
|
4355
4401
|
}
|
|
4356
4402
|
console.log();
|
|
4357
4403
|
} catch (error) {
|
|
4358
|
-
|
|
4359
|
-
source_default.red.bold("\n\u2717 Failed to get deployment:"),
|
|
4360
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4361
|
-
);
|
|
4362
|
-
process.exit(1);
|
|
4404
|
+
handleCommandError(error, "Failed to get deployment");
|
|
4363
4405
|
}
|
|
4364
4406
|
}
|
|
4365
4407
|
async function restartDeploymentCommand(deploymentId, options) {
|
|
@@ -4430,11 +4472,7 @@ async function restartDeploymentCommand(deploymentId, options) {
|
|
|
4430
4472
|
}
|
|
4431
4473
|
console.log();
|
|
4432
4474
|
} catch (error) {
|
|
4433
|
-
|
|
4434
|
-
source_default.red.bold("\n\u2717 Failed to restart deployment:"),
|
|
4435
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4436
|
-
);
|
|
4437
|
-
process.exit(1);
|
|
4475
|
+
handleCommandError(error, "Failed to restart deployment");
|
|
4438
4476
|
}
|
|
4439
4477
|
}
|
|
4440
4478
|
async function deleteDeploymentCommand(deploymentId, options) {
|
|
@@ -4477,11 +4515,7 @@ async function deleteDeploymentCommand(deploymentId, options) {
|
|
|
4477
4515
|
`)
|
|
4478
4516
|
);
|
|
4479
4517
|
} catch (error) {
|
|
4480
|
-
|
|
4481
|
-
source_default.red.bold("\n\u2717 Failed to delete deployment:"),
|
|
4482
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4483
|
-
);
|
|
4484
|
-
process.exit(1);
|
|
4518
|
+
handleCommandError(error, "Failed to delete deployment");
|
|
4485
4519
|
}
|
|
4486
4520
|
}
|
|
4487
4521
|
async function logsCommand(deploymentId, options) {
|
|
@@ -4570,11 +4604,7 @@ async function logsCommand(deploymentId, options) {
|
|
|
4570
4604
|
}
|
|
4571
4605
|
console.log();
|
|
4572
4606
|
} catch (error) {
|
|
4573
|
-
|
|
4574
|
-
source_default.red.bold("\n\u2717 Failed to get logs:"),
|
|
4575
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4576
|
-
);
|
|
4577
|
-
process.exit(1);
|
|
4607
|
+
handleCommandError(error, "Failed to get logs");
|
|
4578
4608
|
}
|
|
4579
4609
|
}
|
|
4580
4610
|
async function stopDeploymentCommand(deploymentId) {
|
|
@@ -4594,11 +4624,7 @@ async function stopDeploymentCommand(deploymentId) {
|
|
|
4594
4624
|
\u2713 Deployment stopped
|
|
4595
4625
|
`));
|
|
4596
4626
|
} catch (error) {
|
|
4597
|
-
|
|
4598
|
-
source_default.red.bold("\n\u2717 Failed to stop deployment:"),
|
|
4599
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4600
|
-
);
|
|
4601
|
-
process.exit(1);
|
|
4627
|
+
handleCommandError(error, "Failed to stop deployment");
|
|
4602
4628
|
}
|
|
4603
4629
|
}
|
|
4604
4630
|
async function startDeploymentCommand(deploymentId) {
|
|
@@ -4618,11 +4644,7 @@ async function startDeploymentCommand(deploymentId) {
|
|
|
4618
4644
|
)
|
|
4619
4645
|
);
|
|
4620
4646
|
} catch (error) {
|
|
4621
|
-
|
|
4622
|
-
source_default.red.bold("\n\u2717 Failed to start deployment:"),
|
|
4623
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4624
|
-
);
|
|
4625
|
-
process.exit(1);
|
|
4647
|
+
handleCommandError(error, "Failed to start deployment");
|
|
4626
4648
|
}
|
|
4627
4649
|
}
|
|
4628
4650
|
function createDeploymentsCommand() {
|
|
@@ -4691,87 +4713,103 @@ async function requireLogin() {
|
|
|
4691
4713
|
}
|
|
4692
4714
|
}
|
|
4693
4715
|
async function listEnvCommand(options) {
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4716
|
+
try {
|
|
4717
|
+
await requireLogin();
|
|
4718
|
+
const api = await McpUseAPI.create();
|
|
4719
|
+
const vars = await api.listEnvVariables(options.server);
|
|
4720
|
+
if (vars.length === 0) {
|
|
4721
|
+
console.log(
|
|
4722
|
+
source_default.yellow("\nNo environment variables set for this server.\n")
|
|
4723
|
+
);
|
|
4724
|
+
return;
|
|
4725
|
+
}
|
|
4726
|
+
console.log(source_default.cyan.bold(`
|
|
4704
4727
|
Environment Variables (${vars.length})
|
|
4705
4728
|
`));
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4729
|
+
for (const v of vars) {
|
|
4730
|
+
printEnvVar(v, options.showValues);
|
|
4731
|
+
console.log();
|
|
4732
|
+
}
|
|
4733
|
+
} catch (error) {
|
|
4734
|
+
handleCommandError(error, "Failed to list environment variables");
|
|
4709
4735
|
}
|
|
4710
4736
|
}
|
|
4711
4737
|
async function addEnvCommand(assignment, options) {
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
+
try {
|
|
4739
|
+
await requireLogin();
|
|
4740
|
+
const eqIdx = assignment.indexOf("=");
|
|
4741
|
+
if (eqIdx === -1) {
|
|
4742
|
+
console.error(
|
|
4743
|
+
source_default.red(
|
|
4744
|
+
"\u2717 Expected KEY=VALUE format, e.g. mcp-use servers env add API_KEY=abc123"
|
|
4745
|
+
)
|
|
4746
|
+
);
|
|
4747
|
+
process.exit(1);
|
|
4748
|
+
}
|
|
4749
|
+
const key = assignment.substring(0, eqIdx).trim();
|
|
4750
|
+
const value = assignment.substring(eqIdx + 1);
|
|
4751
|
+
if (!key) {
|
|
4752
|
+
console.error(source_default.red("\u2717 Key must not be empty."));
|
|
4753
|
+
process.exit(1);
|
|
4754
|
+
}
|
|
4755
|
+
const environments = options.env ? parseEnvironments(options.env) : ALL_ENVS;
|
|
4756
|
+
const api = await McpUseAPI.create();
|
|
4757
|
+
const created = await api.createEnvVariable(options.server, {
|
|
4758
|
+
key,
|
|
4759
|
+
value,
|
|
4760
|
+
environments,
|
|
4761
|
+
sensitive: options.sensitive ?? false
|
|
4762
|
+
});
|
|
4763
|
+
console.log(
|
|
4764
|
+
source_default.green(`
|
|
4738
4765
|
\u2713 Environment variable "${created.key}" added.
|
|
4739
4766
|
`)
|
|
4740
|
-
);
|
|
4741
|
-
printEnvVar(created, true);
|
|
4742
|
-
console.log();
|
|
4743
|
-
}
|
|
4744
|
-
async function updateEnvCommand(varId, options) {
|
|
4745
|
-
await requireLogin();
|
|
4746
|
-
if (!options.value && !options.env && options.sensitive === void 0) {
|
|
4747
|
-
console.error(
|
|
4748
|
-
source_default.red(
|
|
4749
|
-
"\u2717 Nothing to update. Provide at least one of --value, --env, --sensitive."
|
|
4750
|
-
)
|
|
4751
4767
|
);
|
|
4752
|
-
|
|
4768
|
+
printEnvVar(created, true);
|
|
4769
|
+
console.log();
|
|
4770
|
+
} catch (error) {
|
|
4771
|
+
handleCommandError(error, "Failed to add environment variable");
|
|
4753
4772
|
}
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4773
|
+
}
|
|
4774
|
+
async function updateEnvCommand(varId, options) {
|
|
4775
|
+
try {
|
|
4776
|
+
await requireLogin();
|
|
4777
|
+
if (!options.value && !options.env && options.sensitive === void 0) {
|
|
4778
|
+
console.error(
|
|
4779
|
+
source_default.red(
|
|
4780
|
+
"\u2717 Nothing to update. Provide at least one of --value, --env, --sensitive."
|
|
4781
|
+
)
|
|
4782
|
+
);
|
|
4783
|
+
process.exit(1);
|
|
4784
|
+
}
|
|
4785
|
+
const body = {};
|
|
4786
|
+
if (options.value !== void 0) body.value = options.value;
|
|
4787
|
+
if (options.env) body.environments = parseEnvironments(options.env);
|
|
4788
|
+
if (options.sensitive !== void 0) body.sensitive = options.sensitive;
|
|
4789
|
+
const api = await McpUseAPI.create();
|
|
4790
|
+
const updated = await api.updateEnvVariable(options.server, varId, body);
|
|
4791
|
+
console.log(
|
|
4792
|
+
source_default.green(`
|
|
4762
4793
|
\u2713 Environment variable "${updated.key}" updated.
|
|
4763
4794
|
`)
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4795
|
+
);
|
|
4796
|
+
printEnvVar(updated, !!options.value);
|
|
4797
|
+
console.log();
|
|
4798
|
+
} catch (error) {
|
|
4799
|
+
handleCommandError(error, "Failed to update environment variable");
|
|
4800
|
+
}
|
|
4767
4801
|
}
|
|
4768
4802
|
async function removeEnvCommand(varId, options) {
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4803
|
+
try {
|
|
4804
|
+
await requireLogin();
|
|
4805
|
+
const api = await McpUseAPI.create();
|
|
4806
|
+
await api.deleteEnvVariable(options.server, varId);
|
|
4807
|
+
console.log(source_default.green(`
|
|
4773
4808
|
\u2713 Environment variable ${varId} removed.
|
|
4774
4809
|
`));
|
|
4810
|
+
} catch (error) {
|
|
4811
|
+
handleCommandError(error, "Failed to remove environment variable");
|
|
4812
|
+
}
|
|
4775
4813
|
}
|
|
4776
4814
|
function createEnvCommand() {
|
|
4777
4815
|
const envCommand = new import_commander3.Command("env").description(
|
|
@@ -4901,11 +4939,7 @@ async function listServersCommand(options) {
|
|
|
4901
4939
|
}
|
|
4902
4940
|
console.log();
|
|
4903
4941
|
} catch (error) {
|
|
4904
|
-
|
|
4905
|
-
source_default.red.bold("\n\u2717 Failed to list servers:"),
|
|
4906
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
4907
|
-
);
|
|
4908
|
-
process.exit(1);
|
|
4942
|
+
handleCommandError(error, "Failed to list servers");
|
|
4909
4943
|
}
|
|
4910
4944
|
}
|
|
4911
4945
|
async function getServerCommand(idOrSlug, options) {
|
|
@@ -5005,11 +5039,7 @@ async function getServerCommand(idOrSlug, options) {
|
|
|
5005
5039
|
}
|
|
5006
5040
|
console.log();
|
|
5007
5041
|
} catch (error) {
|
|
5008
|
-
|
|
5009
|
-
source_default.red.bold("\n\u2717 Failed to get server:"),
|
|
5010
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
5011
|
-
);
|
|
5012
|
-
process.exit(1);
|
|
5042
|
+
handleCommandError(error, "Failed to get server");
|
|
5013
5043
|
}
|
|
5014
5044
|
}
|
|
5015
5045
|
async function deleteServerCommand(serverId, options) {
|
|
@@ -5062,11 +5092,7 @@ async function deleteServerCommand(serverId, options) {
|
|
|
5062
5092
|
)
|
|
5063
5093
|
);
|
|
5064
5094
|
} catch (error) {
|
|
5065
|
-
|
|
5066
|
-
source_default.red.bold("\n\u2717 Failed to delete server:"),
|
|
5067
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
5068
|
-
);
|
|
5069
|
-
process.exit(1);
|
|
5095
|
+
handleCommandError(error, "Failed to delete server");
|
|
5070
5096
|
}
|
|
5071
5097
|
}
|
|
5072
5098
|
function createServersCommand() {
|
|
@@ -5118,11 +5144,7 @@ async function orgListCommand() {
|
|
|
5118
5144
|
);
|
|
5119
5145
|
}
|
|
5120
5146
|
} catch (error) {
|
|
5121
|
-
|
|
5122
|
-
source_default.red.bold("\n\u2717 Failed to list organizations:"),
|
|
5123
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
5124
|
-
);
|
|
5125
|
-
process.exit(1);
|
|
5147
|
+
handleCommandError(error, "Failed to list organizations");
|
|
5126
5148
|
}
|
|
5127
5149
|
}
|
|
5128
5150
|
async function orgSwitchCommand() {
|
|
@@ -5167,11 +5189,7 @@ async function orgSwitchCommand() {
|
|
|
5167
5189
|
source_default.green.bold("\n\u2713 Switched to ") + source_default.cyan.bold(selected.name) + slug
|
|
5168
5190
|
);
|
|
5169
5191
|
} catch (error) {
|
|
5170
|
-
|
|
5171
|
-
source_default.red.bold("\n\u2717 Failed to switch organization:"),
|
|
5172
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
5173
|
-
);
|
|
5174
|
-
process.exit(1);
|
|
5192
|
+
handleCommandError(error, "Failed to switch organization");
|
|
5175
5193
|
}
|
|
5176
5194
|
}
|
|
5177
5195
|
async function orgCurrentCommand() {
|
|
@@ -5191,11 +5209,7 @@ async function orgCurrentCommand() {
|
|
|
5191
5209
|
source_default.cyan.bold("\u{1F3E2} Active organization: ") + source_default.white(config.orgName || config.orgId) + slug
|
|
5192
5210
|
);
|
|
5193
5211
|
} catch (error) {
|
|
5194
|
-
|
|
5195
|
-
source_default.red.bold("\n\u2717 Failed to get organization:"),
|
|
5196
|
-
source_default.red(error instanceof Error ? error.message : "Unknown error")
|
|
5197
|
-
);
|
|
5198
|
-
process.exit(1);
|
|
5212
|
+
handleCommandError(error, "Failed to get organization");
|
|
5199
5213
|
}
|
|
5200
5214
|
}
|
|
5201
5215
|
|