@mcp-use/cli 3.0.2-canary.5 → 3.0.2-canary.6
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/env.d.ts +3 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/servers.d.ts.map +1 -1
- package/dist/index.cjs +188 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +187 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/api.d.ts +26 -0
- package/dist/utils/api.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/commands/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8KpC,wBAAgB,gBAAgB,IAAI,OAAO,CAmD1C"}
|
|
@@ -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;AA6UpC,wBAAgB,oBAAoB,IAAI,OAAO,CAkC9C"}
|
package/dist/index.cjs
CHANGED
|
@@ -523,8 +523,8 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
|
523
523
|
var source_default = chalk;
|
|
524
524
|
|
|
525
525
|
// src/index.ts
|
|
526
|
-
var
|
|
527
|
-
var
|
|
526
|
+
var import_commander6 = require("commander");
|
|
527
|
+
var import_config8 = 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");
|
|
@@ -1385,6 +1385,36 @@ var McpUseAPI = class _McpUseAPI {
|
|
|
1385
1385
|
}
|
|
1386
1386
|
);
|
|
1387
1387
|
}
|
|
1388
|
+
// ── Env Variables ────────────────────────────────────────────────
|
|
1389
|
+
async listEnvVariables(serverId) {
|
|
1390
|
+
return this.request(
|
|
1391
|
+
`/servers/${encodeURIComponent(serverId)}/env-variables`
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1394
|
+
async createEnvVariable(serverId, body) {
|
|
1395
|
+
return this.request(
|
|
1396
|
+
`/servers/${encodeURIComponent(serverId)}/env-variables`,
|
|
1397
|
+
{
|
|
1398
|
+
method: "POST",
|
|
1399
|
+
body: JSON.stringify(body)
|
|
1400
|
+
}
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
async updateEnvVariable(serverId, varId, body) {
|
|
1404
|
+
return this.request(
|
|
1405
|
+
`/servers/${encodeURIComponent(serverId)}/env-variables/${encodeURIComponent(varId)}`,
|
|
1406
|
+
{
|
|
1407
|
+
method: "PATCH",
|
|
1408
|
+
body: JSON.stringify(body)
|
|
1409
|
+
}
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
async deleteEnvVariable(serverId, varId) {
|
|
1413
|
+
await this.request(
|
|
1414
|
+
`/servers/${encodeURIComponent(serverId)}/env-variables/${encodeURIComponent(varId)}`,
|
|
1415
|
+
{ method: "DELETE" }
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1388
1418
|
// ── Deployments ─────────────────────────────────────────────────
|
|
1389
1419
|
async createDeployment(input) {
|
|
1390
1420
|
return this.request("/deployments", {
|
|
@@ -4570,7 +4600,158 @@ function createDeploymentsCommand() {
|
|
|
4570
4600
|
}
|
|
4571
4601
|
|
|
4572
4602
|
// src/commands/servers.ts
|
|
4603
|
+
var import_commander4 = require("commander");
|
|
4604
|
+
|
|
4605
|
+
// src/commands/env.ts
|
|
4573
4606
|
var import_commander3 = require("commander");
|
|
4607
|
+
var ALL_ENVS = ["production", "preview", "development"];
|
|
4608
|
+
function parseEnvironments(raw) {
|
|
4609
|
+
const parts = raw.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean);
|
|
4610
|
+
const valid = [];
|
|
4611
|
+
for (const p of parts) {
|
|
4612
|
+
if (p === "production" || p === "preview" || p === "development") {
|
|
4613
|
+
valid.push(p);
|
|
4614
|
+
} else {
|
|
4615
|
+
console.error(
|
|
4616
|
+
source_default.red(
|
|
4617
|
+
`\u2717 Unknown environment "${p}". Valid values: production, preview, development`
|
|
4618
|
+
)
|
|
4619
|
+
);
|
|
4620
|
+
process.exit(1);
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4623
|
+
if (valid.length === 0) {
|
|
4624
|
+
console.error(source_default.red("\u2717 At least one environment must be specified."));
|
|
4625
|
+
process.exit(1);
|
|
4626
|
+
}
|
|
4627
|
+
return valid;
|
|
4628
|
+
}
|
|
4629
|
+
function envBadge(env2) {
|
|
4630
|
+
if (env2 === "production") return source_default.green("prod");
|
|
4631
|
+
if (env2 === "preview") return source_default.yellow("prev");
|
|
4632
|
+
return source_default.blue("dev");
|
|
4633
|
+
}
|
|
4634
|
+
function printEnvVar(v, showValue = false) {
|
|
4635
|
+
const envs = v.environments.map(envBadge).join(" ");
|
|
4636
|
+
const val = v.sensitive ? source_default.gray("<sensitive>") : showValue ? source_default.cyan(v.value) : source_default.gray("(hidden \u2014 use --show-values to reveal)");
|
|
4637
|
+
console.log(` ${source_default.white.bold(v.key.padEnd(32))} ${val}`);
|
|
4638
|
+
console.log(
|
|
4639
|
+
` ${source_default.gray("id:")} ${source_default.gray(v.id)} ${envs}${v.sensitive ? " " + source_default.yellow("\u{1F512} sensitive") : ""}`
|
|
4640
|
+
);
|
|
4641
|
+
}
|
|
4642
|
+
async function requireLogin() {
|
|
4643
|
+
if (!await isLoggedIn()) {
|
|
4644
|
+
console.log(source_default.red("\u2717 You are not logged in."));
|
|
4645
|
+
console.log(
|
|
4646
|
+
source_default.gray("Run " + source_default.white("npx mcp-use login") + " to get started.")
|
|
4647
|
+
);
|
|
4648
|
+
process.exit(1);
|
|
4649
|
+
}
|
|
4650
|
+
}
|
|
4651
|
+
async function listEnvCommand(options) {
|
|
4652
|
+
await requireLogin();
|
|
4653
|
+
const api = await McpUseAPI.create();
|
|
4654
|
+
const vars = await api.listEnvVariables(options.server);
|
|
4655
|
+
if (vars.length === 0) {
|
|
4656
|
+
console.log(
|
|
4657
|
+
source_default.yellow("\nNo environment variables set for this server.\n")
|
|
4658
|
+
);
|
|
4659
|
+
return;
|
|
4660
|
+
}
|
|
4661
|
+
console.log(source_default.cyan.bold(`
|
|
4662
|
+
Environment Variables (${vars.length})
|
|
4663
|
+
`));
|
|
4664
|
+
for (const v of vars) {
|
|
4665
|
+
printEnvVar(v, options.showValues);
|
|
4666
|
+
console.log();
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
async function addEnvCommand(assignment, options) {
|
|
4670
|
+
await requireLogin();
|
|
4671
|
+
const eqIdx = assignment.indexOf("=");
|
|
4672
|
+
if (eqIdx === -1) {
|
|
4673
|
+
console.error(
|
|
4674
|
+
source_default.red(
|
|
4675
|
+
"\u2717 Expected KEY=VALUE format, e.g. mcp-use servers env add API_KEY=abc123"
|
|
4676
|
+
)
|
|
4677
|
+
);
|
|
4678
|
+
process.exit(1);
|
|
4679
|
+
}
|
|
4680
|
+
const key = assignment.substring(0, eqIdx).trim();
|
|
4681
|
+
const value = assignment.substring(eqIdx + 1);
|
|
4682
|
+
if (!key) {
|
|
4683
|
+
console.error(source_default.red("\u2717 Key must not be empty."));
|
|
4684
|
+
process.exit(1);
|
|
4685
|
+
}
|
|
4686
|
+
const environments = options.env ? parseEnvironments(options.env) : ALL_ENVS;
|
|
4687
|
+
const api = await McpUseAPI.create();
|
|
4688
|
+
const created = await api.createEnvVariable(options.server, {
|
|
4689
|
+
key,
|
|
4690
|
+
value,
|
|
4691
|
+
environments,
|
|
4692
|
+
sensitive: options.sensitive ?? false
|
|
4693
|
+
});
|
|
4694
|
+
console.log(
|
|
4695
|
+
source_default.green(`
|
|
4696
|
+
\u2713 Environment variable "${created.key}" added.
|
|
4697
|
+
`)
|
|
4698
|
+
);
|
|
4699
|
+
printEnvVar(created, true);
|
|
4700
|
+
console.log();
|
|
4701
|
+
}
|
|
4702
|
+
async function updateEnvCommand(varId, options) {
|
|
4703
|
+
await requireLogin();
|
|
4704
|
+
if (!options.value && !options.env && options.sensitive === void 0) {
|
|
4705
|
+
console.error(
|
|
4706
|
+
source_default.red(
|
|
4707
|
+
"\u2717 Nothing to update. Provide at least one of --value, --env, --sensitive."
|
|
4708
|
+
)
|
|
4709
|
+
);
|
|
4710
|
+
process.exit(1);
|
|
4711
|
+
}
|
|
4712
|
+
const body = {};
|
|
4713
|
+
if (options.value !== void 0) body.value = options.value;
|
|
4714
|
+
if (options.env) body.environments = parseEnvironments(options.env);
|
|
4715
|
+
if (options.sensitive !== void 0) body.sensitive = options.sensitive;
|
|
4716
|
+
const api = await McpUseAPI.create();
|
|
4717
|
+
const updated = await api.updateEnvVariable(options.server, varId, body);
|
|
4718
|
+
console.log(
|
|
4719
|
+
source_default.green(`
|
|
4720
|
+
\u2713 Environment variable "${updated.key}" updated.
|
|
4721
|
+
`)
|
|
4722
|
+
);
|
|
4723
|
+
printEnvVar(updated, !!options.value);
|
|
4724
|
+
console.log();
|
|
4725
|
+
}
|
|
4726
|
+
async function removeEnvCommand(varId, options) {
|
|
4727
|
+
await requireLogin();
|
|
4728
|
+
const api = await McpUseAPI.create();
|
|
4729
|
+
await api.deleteEnvVariable(options.server, varId);
|
|
4730
|
+
console.log(source_default.green(`
|
|
4731
|
+
\u2713 Environment variable ${varId} removed.
|
|
4732
|
+
`));
|
|
4733
|
+
}
|
|
4734
|
+
function createEnvCommand() {
|
|
4735
|
+
const envCommand = new import_commander3.Command("env").description(
|
|
4736
|
+
"Manage environment variables for a server"
|
|
4737
|
+
);
|
|
4738
|
+
envCommand.command("list").alias("ls").description("List environment variables for a server").requiredOption("--server <id>", "Server UUID").option("--show-values", "Reveal non-sensitive values in output").action(listEnvCommand);
|
|
4739
|
+
envCommand.command("add").argument("<KEY=VALUE>", "Variable assignment, e.g. API_KEY=abc123").description("Add an environment variable to a server").requiredOption("--server <id>", "Server UUID").option(
|
|
4740
|
+
"--env <environments>",
|
|
4741
|
+
"Comma-separated environments: production,preview,development (default: all)"
|
|
4742
|
+
).option(
|
|
4743
|
+
"--sensitive",
|
|
4744
|
+
"Mark the variable as sensitive (value masked in UI)"
|
|
4745
|
+
).action(addEnvCommand);
|
|
4746
|
+
envCommand.command("update").argument("<var-id>", "Environment variable UUID").description("Update an existing environment variable").requiredOption("--server <id>", "Server UUID").option("--value <value>", "New value").option(
|
|
4747
|
+
"--env <environments>",
|
|
4748
|
+
"New environments (comma-separated: production,preview,development)"
|
|
4749
|
+
).option("--sensitive", "Mark as sensitive").option("--no-sensitive", "Unmark as sensitive").action(updateEnvCommand);
|
|
4750
|
+
envCommand.command("remove").alias("rm").argument("<var-id>", "Environment variable UUID").description("Remove an environment variable from a server").requiredOption("--server <id>", "Server UUID").action(removeEnvCommand);
|
|
4751
|
+
return envCommand;
|
|
4752
|
+
}
|
|
4753
|
+
|
|
4754
|
+
// src/commands/servers.ts
|
|
4574
4755
|
async function prompt3(question) {
|
|
4575
4756
|
const readline = await import("readline");
|
|
4576
4757
|
const rl = readline.createInterface({
|
|
@@ -4849,12 +5030,13 @@ async function deleteServerCommand(serverId, options) {
|
|
|
4849
5030
|
}
|
|
4850
5031
|
}
|
|
4851
5032
|
function createServersCommand() {
|
|
4852
|
-
const serversCommand = new
|
|
5033
|
+
const serversCommand = new import_commander4.Command("servers").description(
|
|
4853
5034
|
"Manage cloud servers (Git-backed deploy targets)"
|
|
4854
5035
|
);
|
|
4855
5036
|
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);
|
|
4856
5037
|
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);
|
|
4857
5038
|
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);
|
|
5039
|
+
serversCommand.addCommand(createEnvCommand());
|
|
4858
5040
|
return serversCommand;
|
|
4859
5041
|
}
|
|
4860
5042
|
|
|
@@ -4978,7 +5160,7 @@ async function orgCurrentCommand() {
|
|
|
4978
5160
|
}
|
|
4979
5161
|
|
|
4980
5162
|
// src/commands/skills.ts
|
|
4981
|
-
var
|
|
5163
|
+
var import_commander5 = require("commander");
|
|
4982
5164
|
var import_node_fs8 = require("fs");
|
|
4983
5165
|
var import_node_os5 = require("os");
|
|
4984
5166
|
var import_node_path6 = require("path");
|
|
@@ -5048,7 +5230,7 @@ async function addSkillsToProject(projectPath) {
|
|
|
5048
5230
|
}
|
|
5049
5231
|
}
|
|
5050
5232
|
function createSkillsCommand() {
|
|
5051
|
-
const skills = new
|
|
5233
|
+
const skills = new import_commander5.Command("skills").description(
|
|
5052
5234
|
"Manage mcp-use AI agent skills"
|
|
5053
5235
|
);
|
|
5054
5236
|
const installAction = async (options) => {
|
|
@@ -5224,7 +5406,7 @@ A new release of ${source_default.bold(PACKAGE_NAME)} is available: ${source_def
|
|
|
5224
5406
|
}
|
|
5225
5407
|
|
|
5226
5408
|
// src/index.ts
|
|
5227
|
-
var program = new
|
|
5409
|
+
var program = new import_commander6.Command();
|
|
5228
5410
|
var packageContent = (0, import_node_fs10.readFileSync)(
|
|
5229
5411
|
import_node_path8.default.join(__dirname, "../package.json"),
|
|
5230
5412
|
"utf-8"
|