@mks2508/coolify-mks-cli-mcp 0.2.1 → 0.3.0

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.
@@ -17252,6 +17252,9 @@ class CoolifyService {
17252
17252
  if (options.dockerfileLocation) {
17253
17253
  body.dockerfile_location = options.dockerfileLocation;
17254
17254
  }
17255
+ if (options.dockerComposeLocation) {
17256
+ body.docker_compose_location = options.dockerComposeLocation;
17257
+ }
17255
17258
  if (options.baseDirectory) {
17256
17259
  body.base_directory = options.baseDirectory;
17257
17260
  }
@@ -17303,6 +17306,58 @@ class CoolifyService {
17303
17306
  log.success(`Environment variables retrieved for ${appUuid}`);
17304
17307
  return ok(result.data || []);
17305
17308
  }
17309
+ async setEnvironmentVariable(appUuid, key, value, isBuildTime = false) {
17310
+ log.info(`Setting environment variable ${key} for ${appUuid}`);
17311
+ const existingVars = await this.getEnvironmentVariables(appUuid);
17312
+ if (isErr(existingVars)) {
17313
+ return err(existingVars.error);
17314
+ }
17315
+ const exists = existingVars.value.some((ev) => ev.key === key);
17316
+ if (exists) {
17317
+ log.debug(`Variable ${key} exists, using PATCH to update`);
17318
+ const result = await this.request(`/applications/${appUuid}/envs`, {
17319
+ method: "PATCH",
17320
+ body: JSON.stringify({ key, value })
17321
+ });
17322
+ if (result.error) {
17323
+ log.error(`Failed to update env var: ${result.error}`);
17324
+ return err(new Error(result.error));
17325
+ }
17326
+ } else {
17327
+ log.debug(`Variable ${key} does not exist, using POST to create`);
17328
+ const result = await this.request(`/applications/${appUuid}/envs`, {
17329
+ method: "POST",
17330
+ body: JSON.stringify({ key, value })
17331
+ });
17332
+ if (result.error) {
17333
+ log.error(`Failed to create env var: ${result.error}`);
17334
+ return err(new Error(result.error));
17335
+ }
17336
+ }
17337
+ log.success(`Environment variable ${key} set for ${appUuid}`);
17338
+ return ok(undefined);
17339
+ }
17340
+ async deleteEnvironmentVariable(appUuid, key) {
17341
+ log.info(`Deleting environment variable ${key} from ${appUuid}`);
17342
+ const envVarsResult = await this.getEnvironmentVariables(appUuid);
17343
+ if (isErr(envVarsResult)) {
17344
+ return err(envVarsResult.error);
17345
+ }
17346
+ const envVar = envVarsResult.value.find((ev) => ev.key === key);
17347
+ if (!envVar) {
17348
+ log.error(`Environment variable ${key} not found`);
17349
+ return err(new Error(`Environment variable ${key} not found`));
17350
+ }
17351
+ const result = await this.request(`/applications/${appUuid}/envs/${envVar.uuid}`, {
17352
+ method: "DELETE"
17353
+ });
17354
+ if (result.error) {
17355
+ log.error(`Failed to delete env var: ${result.error}`);
17356
+ return err(new Error(result.error));
17357
+ }
17358
+ log.success(`Environment variable ${key} deleted from ${appUuid}`);
17359
+ return ok(undefined);
17360
+ }
17306
17361
  async getApplicationStatus(appUuid) {
17307
17362
  const result = await this.request(`/applications/${appUuid}`);
17308
17363
  if (result.error) {
@@ -17334,6 +17389,19 @@ class CoolifyService {
17334
17389
  }
17335
17390
  return ok(result.data || []);
17336
17391
  }
17392
+ async createProject(name, description) {
17393
+ log.info(`Creating project: ${name}`);
17394
+ const result = await this.request("/projects", {
17395
+ method: "POST",
17396
+ body: JSON.stringify({ name, description: description || "" })
17397
+ });
17398
+ if (result.error) {
17399
+ log.error(`Failed to create project: ${result.error}`);
17400
+ return err(new Error(result.error));
17401
+ }
17402
+ log.success(`Project created: ${result.data?.uuid}`);
17403
+ return ok(result.data);
17404
+ }
17337
17405
  async getProjectEnvironments(projectUuid) {
17338
17406
  log.info(`Getting environments for project ${projectUuid}`);
17339
17407
  const result = await this.request(`/projects/${projectUuid}`);
@@ -17412,6 +17480,12 @@ class CoolifyService {
17412
17480
  body.dockerfile_location = options.dockerfileLocation;
17413
17481
  if (options.baseDirectory)
17414
17482
  body.base_directory = options.baseDirectory;
17483
+ if (options.domains)
17484
+ body.domains = options.domains;
17485
+ if (options.isForceHttpsEnabled !== undefined)
17486
+ body.is_force_https_enabled = options.isForceHttpsEnabled;
17487
+ if (options.isAutoDeployEnabled !== undefined)
17488
+ body.is_auto_deploy_enabled = options.isAutoDeployEnabled;
17415
17489
  const result = await this.request(`/applications/${appUuid}`, {
17416
17490
  method: "PATCH",
17417
17491
  body: JSON.stringify(body)
@@ -17436,9 +17510,12 @@ class CoolifyService {
17436
17510
  log.error(`Failed to get logs: ${result.error}`);
17437
17511
  return err(new Error(result.error));
17438
17512
  }
17513
+ const rawLogs = result.data?.logs;
17514
+ const logsArray = Array.isArray(rawLogs) ? rawLogs : typeof rawLogs === "string" ? rawLogs.split(`
17515
+ `).filter((l) => l.length > 0) : [];
17439
17516
  log.success(`Logs retrieved for application: ${appUuid}`);
17440
17517
  return ok({
17441
- logs: result.data?.logs || [],
17518
+ logs: logsArray,
17442
17519
  timestamp: new Date().toISOString()
17443
17520
  });
17444
17521
  }
@@ -17488,6 +17565,43 @@ class CoolifyService {
17488
17565
  log.success(`Application restarted: ${appUuid}`);
17489
17566
  return ok(result.data);
17490
17567
  }
17568
+ async listDeployments() {
17569
+ log.info("Listing active deployments");
17570
+ const result = await this.request("/deployments");
17571
+ if (result.error) {
17572
+ log.error(`Failed to list deployments: ${result.error}`);
17573
+ return err(new Error(result.error));
17574
+ }
17575
+ log.success(`Listed ${result.data?.length || 0} active deployments`);
17576
+ return ok(result.data || []);
17577
+ }
17578
+ async getDeployment(deploymentUuid) {
17579
+ log.info(`Getting deployment details for ${deploymentUuid}`);
17580
+ const result = await this.request(`/deployments/${deploymentUuid}`);
17581
+ if (result.error) {
17582
+ log.error(`Failed to get deployment: ${result.error}`);
17583
+ return err(new Error(result.error));
17584
+ }
17585
+ log.success(`Deployment details retrieved: ${deploymentUuid}`);
17586
+ return ok(result.data);
17587
+ }
17588
+ async getApplicationDeployments(appUuid, skip = 0, take = 10) {
17589
+ log.info(`Getting deployments for application ${appUuid}`);
17590
+ const params = new URLSearchParams;
17591
+ if (skip > 0)
17592
+ params.set("skip", skip.toString());
17593
+ if (take !== 10)
17594
+ params.set("take", take.toString());
17595
+ const endpoint = `/applications/${appUuid}/deployments${params.toString() ? `?${params.toString()}` : ""}`;
17596
+ const result = await this.request(endpoint);
17597
+ if (result.error) {
17598
+ log.error(`Failed to get application deployments: ${result.error}`);
17599
+ return err(new Error(result.error));
17600
+ }
17601
+ const deployments = result.data?.deployments || [];
17602
+ log.success(`Retrieved ${deployments.length} deployments for ${appUuid}`);
17603
+ return ok(deployments);
17604
+ }
17491
17605
  }
17492
17606
  var instance = null;
17493
17607
  function getCoolifyService() {
@@ -17716,7 +17830,7 @@ Returns list of all deployments with status, timestamps, and commit info.`,
17716
17830
  name: "update_application",
17717
17831
  description: `Update configuration for a Coolify application.
17718
17832
 
17719
- Can modify name, description, build settings, and commands.
17833
+ Can modify name, description, build settings, commands, and domains.
17720
17834
  Redeploy after updating to apply changes.`,
17721
17835
  inputSchema: {
17722
17836
  type: "object",
@@ -17737,7 +17851,7 @@ Redeploy after updating to apply changes.`,
17737
17851
  buildPack: {
17738
17852
  type: "string",
17739
17853
  description: "Build pack type",
17740
- enum: ["dockerfile", "nixpacks", "static"]
17854
+ enum: ["dockerfile", "nixpacks", "static", "dockercompose"]
17741
17855
  },
17742
17856
  gitBranch: {
17743
17857
  type: "string",
@@ -17758,11 +17872,54 @@ Redeploy after updating to apply changes.`,
17758
17872
  startCommand: {
17759
17873
  type: "string",
17760
17874
  description: "Start command"
17875
+ },
17876
+ domains: {
17877
+ type: "string",
17878
+ description: 'Domains/FQDN - comma separated list with protocol (e.g., "https://app.example.com,https://www.example.com")'
17879
+ },
17880
+ isForceHttpsEnabled: {
17881
+ type: "boolean",
17882
+ description: "Force HTTPS redirect"
17883
+ },
17884
+ isAutoDeployEnabled: {
17885
+ type: "boolean",
17886
+ description: "Enable auto deploy on git push"
17761
17887
  }
17762
17888
  },
17763
17889
  required: ["uuid"]
17764
17890
  }
17765
17891
  },
17892
+ {
17893
+ name: "set_domains",
17894
+ description: `Set domains/FQDN for a Coolify application.
17895
+
17896
+ Configure custom domains for your application. Coolify automatically handles SSL certificates via Let's Encrypt.
17897
+
17898
+ Domain format:
17899
+ - Use FQDN with protocol: https://app.example.com
17900
+ - Multiple domains separated by comma: https://app.example.com,https://www.example.com
17901
+ - Can include port mapping: https://api.example.com:3000`,
17902
+ inputSchema: {
17903
+ type: "object",
17904
+ properties: {
17905
+ uuid: {
17906
+ type: "string",
17907
+ description: "Application UUID",
17908
+ format: "uuid"
17909
+ },
17910
+ domains: {
17911
+ type: "string",
17912
+ description: 'Domains/FQDN - comma separated list with protocol (e.g., "https://app.example.com,https://www.example.com")'
17913
+ },
17914
+ forceHttps: {
17915
+ type: "boolean",
17916
+ description: "Force HTTPS redirect (default: true)",
17917
+ default: true
17918
+ }
17919
+ },
17920
+ required: ["uuid", "domains"]
17921
+ }
17922
+ },
17766
17923
  {
17767
17924
  name: "list_servers",
17768
17925
  description: `List all available servers in Coolify.
@@ -17867,11 +18024,49 @@ The GitHub repository must be accessible via the configured GitHub App.`,
17867
18024
  buildPack: {
17868
18025
  type: "string",
17869
18026
  description: "Build pack type",
17870
- enum: ["dockerfile", "nixpacks", "static"],
18027
+ enum: ["dockerfile", "nixpacks", "static", "dockercompose"],
17871
18028
  default: "nixpacks"
18029
+ },
18030
+ type: {
18031
+ type: "string",
18032
+ description: "Application type",
18033
+ enum: ["public", "private-github-app", "private-deploy-key", "dockerfile", "docker-image", "docker-compose"],
18034
+ default: "public"
18035
+ },
18036
+ dockerComposeLocation: {
18037
+ type: "string",
18038
+ description: "Docker Compose file location relative to repo root (for dockercompose buildPack)"
18039
+ },
18040
+ dockerfileLocation: {
18041
+ type: "string",
18042
+ description: "Dockerfile location relative to repo root"
18043
+ },
18044
+ baseDirectory: {
18045
+ type: "string",
18046
+ description: 'Base directory for build context (default: "/")'
18047
+ }
18048
+ },
18049
+ required: ["name", "serverUuid", "githubRepoUrl"]
18050
+ }
18051
+ },
18052
+ {
18053
+ name: "create_project",
18054
+ description: `Create a new project in Coolify.
18055
+
18056
+ Projects organize applications into logical groups. Each project has one or more environments (e.g., production, staging).`,
18057
+ inputSchema: {
18058
+ type: "object",
18059
+ properties: {
18060
+ name: {
18061
+ type: "string",
18062
+ description: "Project name"
18063
+ },
18064
+ description: {
18065
+ type: "string",
18066
+ description: "Project description"
17872
18067
  }
17873
18068
  },
17874
- required: ["name", "serverUuid", "destinationUuid", "githubRepoUrl"]
18069
+ required: ["name"]
17875
18070
  }
17876
18071
  },
17877
18072
  {
@@ -17901,6 +18096,62 @@ Returns connection status and API version info if available.`,
17901
18096
  properties: {}
17902
18097
  }
17903
18098
  },
18099
+ {
18100
+ name: "list_deployments",
18101
+ description: `List all active and queued deployments across all applications.
18102
+
18103
+ Returns deployments that are currently in progress or waiting in queue.
18104
+ Useful for monitoring ongoing builds and deployments.`,
18105
+ inputSchema: {
18106
+ type: "object",
18107
+ properties: {}
18108
+ }
18109
+ },
18110
+ {
18111
+ name: "get_deployment",
18112
+ description: `Get detailed information about a specific deployment.
18113
+
18114
+ Returns deployment status, logs, timestamps, and error messages if any.
18115
+ Use deployment UUID from list_deployments or get_application_deployments.`,
18116
+ inputSchema: {
18117
+ type: "object",
18118
+ properties: {
18119
+ deploymentUuid: {
18120
+ type: "string",
18121
+ description: "Deployment UUID"
18122
+ }
18123
+ },
18124
+ required: ["deploymentUuid"]
18125
+ }
18126
+ },
18127
+ {
18128
+ name: "get_application_deployments",
18129
+ description: `Get deployment history for a specific application.
18130
+
18131
+ Returns list of all deployments with status, timestamps, commit info, and logs.
18132
+ Useful for debugging failed deployments and tracking deployment history.`,
18133
+ inputSchema: {
18134
+ type: "object",
18135
+ properties: {
18136
+ uuid: {
18137
+ type: "string",
18138
+ description: "Application UUID",
18139
+ format: "uuid"
18140
+ },
18141
+ skip: {
18142
+ type: "number",
18143
+ description: "Number of deployments to skip (pagination)",
18144
+ default: 0
18145
+ },
18146
+ take: {
18147
+ type: "number",
18148
+ description: "Number of deployments to return (default: 10)",
18149
+ default: 10
18150
+ }
18151
+ },
18152
+ required: ["uuid"]
18153
+ }
18154
+ },
17904
18155
  {
17905
18156
  name: "get_application_details",
17906
18157
  description: `Get detailed information about a Coolify application.
@@ -17955,6 +18206,8 @@ async function handleToolCall(name, args, coolify) {
17955
18206
  return handleGetDeploymentHistory(coolify, args);
17956
18207
  case "update_application":
17957
18208
  return handleUpdateApplication(coolify, args);
18209
+ case "set_domains":
18210
+ return handleSetDomains(coolify, args);
17958
18211
  case "list_servers":
17959
18212
  return handleListServers(coolify);
17960
18213
  case "get_server":
@@ -17967,12 +18220,20 @@ async function handleToolCall(name, args, coolify) {
17967
18220
  return handleGetServerDestinations(coolify, args);
17968
18221
  case "create_application":
17969
18222
  return handleCreateApplication(coolify, args);
18223
+ case "create_project":
18224
+ return handleCreateProject(coolify, args);
17970
18225
  case "get_resource_usage":
17971
18226
  return handleGetResourceUsage(coolify, args);
17972
18227
  case "health_check":
17973
18228
  return handleHealthCheck(coolify);
17974
18229
  case "get_application_details":
17975
18230
  return handleGetApplicationDetails(coolify, args);
18231
+ case "list_deployments":
18232
+ return handleListDeployments(coolify);
18233
+ case "get_deployment":
18234
+ return handleGetDeployment(coolify, args);
18235
+ case "get_application_deployments":
18236
+ return handleGetApplicationDeployments(coolify, args);
17976
18237
  default:
17977
18238
  return {
17978
18239
  content: [{ type: "text", text: `Unknown tool: ${name}` }],
@@ -18174,7 +18435,10 @@ async function handleUpdateApplication(coolify, args) {
18174
18435
  portsExposes: args.portsExposes,
18175
18436
  installCommand: args.installCommand,
18176
18437
  buildCommand: args.buildCommand,
18177
- startCommand: args.startCommand
18438
+ startCommand: args.startCommand,
18439
+ domains: args.domains,
18440
+ isForceHttpsEnabled: args.isForceHttpsEnabled,
18441
+ isAutoDeployEnabled: args.isAutoDeployEnabled
18178
18442
  });
18179
18443
  if (isOk(result)) {
18180
18444
  return {
@@ -18193,6 +18457,35 @@ async function handleUpdateApplication(coolify, args) {
18193
18457
  isError: true
18194
18458
  };
18195
18459
  }
18460
+ async function handleSetDomains(coolify, args) {
18461
+ const result = await coolify.updateApplication(args.uuid, {
18462
+ domains: args.domains,
18463
+ isForceHttpsEnabled: args.forceHttps ?? true
18464
+ });
18465
+ if (isOk(result)) {
18466
+ const domainList = args.domains.split(",").map((d) => d.trim());
18467
+ return {
18468
+ content: [{
18469
+ type: "text",
18470
+ text: JSON.stringify({
18471
+ success: true,
18472
+ message: `Domains configured for application ${args.uuid}`,
18473
+ domains: domainList,
18474
+ forceHttps: args.forceHttps ?? true,
18475
+ nextSteps: [
18476
+ "Ensure DNS records point to your server IP",
18477
+ "Use deploy tool to apply domain changes",
18478
+ "SSL certificates will be auto-generated via Let's Encrypt"
18479
+ ]
18480
+ }, null, 2)
18481
+ }]
18482
+ };
18483
+ }
18484
+ return {
18485
+ content: [{ type: "text", text: `Failed to set domains: ${result.error.message}` }],
18486
+ isError: true
18487
+ };
18488
+ }
18196
18489
  async function handleListServers(coolify) {
18197
18490
  const result = await coolify.listServers();
18198
18491
  if (isOk(result)) {
@@ -18277,10 +18570,13 @@ async function handleCreateApplication(coolify, args) {
18277
18570
  projectUuid: args.projectUuid,
18278
18571
  environmentUuid: args.environmentUuid,
18279
18572
  serverUuid: args.serverUuid,
18280
- type: "public",
18573
+ type: args.type || "public",
18281
18574
  githubRepoUrl: args.githubRepoUrl,
18282
18575
  branch: args.branch,
18283
- buildPack: args.buildPack
18576
+ buildPack: args.buildPack,
18577
+ dockerComposeLocation: args.dockerComposeLocation,
18578
+ dockerfileLocation: args.dockerfileLocation,
18579
+ baseDirectory: args.baseDirectory
18284
18580
  });
18285
18581
  if (isOk(result)) {
18286
18582
  return {
@@ -18303,6 +18599,25 @@ async function handleCreateApplication(coolify, args) {
18303
18599
  isError: true
18304
18600
  };
18305
18601
  }
18602
+ async function handleCreateProject(coolify, args) {
18603
+ const result = await coolify.createProject(args.name, args.description);
18604
+ if (isOk(result)) {
18605
+ return {
18606
+ content: [{
18607
+ type: "text",
18608
+ text: JSON.stringify({
18609
+ success: true,
18610
+ message: `Project "${args.name}" created successfully`,
18611
+ uuid: result.value.uuid
18612
+ }, null, 2)
18613
+ }]
18614
+ };
18615
+ }
18616
+ return {
18617
+ content: [{ type: "text", text: `Failed to create project: ${result.error.message}` }],
18618
+ isError: true
18619
+ };
18620
+ }
18306
18621
  async function handleGetResourceUsage(coolify, args) {
18307
18622
  const result = await coolify.getApplicationStatus(args.uuid);
18308
18623
  if (isOk(result)) {
@@ -18349,6 +18664,62 @@ async function handleGetApplicationDetails(coolify, args) {
18349
18664
  isError: true
18350
18665
  };
18351
18666
  }
18667
+ async function handleListDeployments(coolify) {
18668
+ const result = await coolify.listDeployments();
18669
+ if (isOk(result)) {
18670
+ return {
18671
+ content: [{
18672
+ type: "text",
18673
+ text: JSON.stringify({
18674
+ success: true,
18675
+ count: result.value.length,
18676
+ deployments: result.value
18677
+ }, null, 2)
18678
+ }]
18679
+ };
18680
+ }
18681
+ return {
18682
+ content: [{ type: "text", text: `Failed to list deployments: ${result.error.message}` }],
18683
+ isError: true
18684
+ };
18685
+ }
18686
+ async function handleGetDeployment(coolify, args) {
18687
+ const result = await coolify.getDeployment(args.deploymentUuid);
18688
+ if (isOk(result)) {
18689
+ return {
18690
+ content: [{
18691
+ type: "text",
18692
+ text: JSON.stringify({
18693
+ success: true,
18694
+ deployment: result.value
18695
+ }, null, 2)
18696
+ }]
18697
+ };
18698
+ }
18699
+ return {
18700
+ content: [{ type: "text", text: `Failed to get deployment: ${result.error.message}` }],
18701
+ isError: true
18702
+ };
18703
+ }
18704
+ async function handleGetApplicationDeployments(coolify, args) {
18705
+ const result = await coolify.getApplicationDeployments(args.uuid, args.skip, args.take);
18706
+ if (isOk(result)) {
18707
+ return {
18708
+ content: [{
18709
+ type: "text",
18710
+ text: JSON.stringify({
18711
+ success: true,
18712
+ count: result.value.length,
18713
+ deployments: result.value
18714
+ }, null, 2)
18715
+ }]
18716
+ };
18717
+ }
18718
+ return {
18719
+ content: [{ type: "text", text: `Failed to get application deployments: ${result.error.message}` }],
18720
+ isError: true
18721
+ };
18722
+ }
18352
18723
 
18353
18724
  // src/server/stdio.ts
18354
18725
  var coolify = getCoolifyService();
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,IAAI,EAqa9B,CAAA"}
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/tools/definitions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,IAAI,EA8iB9B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAExE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CA0DzB"}
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/tools/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAExE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,cAAc,CAAC,CAoEzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mks2508/coolify-mks-cli-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "MCP server and CLI for Coolify deployment management",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,12 +8,19 @@ import { isErr } from '@mks2508/no-throw'
8
8
  import chalk from 'chalk'
9
9
  import { getCoolifyService } from '../../coolify/index.js'
10
10
 
11
+ interface IEnvCommandOptions {
12
+ set?: string
13
+ delete?: string
14
+ buildtime?: boolean
15
+ }
16
+
11
17
  /**
12
18
  * Env vars command handler.
13
19
  *
14
20
  * @param uuid - Application UUID
21
+ * @param options - Command options
15
22
  */
16
- export async function envCommand(uuid: string) {
23
+ export async function envCommand(uuid: string, options: IEnvCommandOptions = {}) {
17
24
  const coolify = getCoolifyService()
18
25
  const initResult = await coolify.init()
19
26
 
@@ -22,6 +29,41 @@ export async function envCommand(uuid: string) {
22
29
  return
23
30
  }
24
31
 
32
+ // Handle --set KEY=VALUE
33
+ if (options.set) {
34
+ const [key, ...valueParts] = options.set.split('=')
35
+ const value = valueParts.join('=') // Handle values with = in them
36
+
37
+ if (!key || value === undefined) {
38
+ console.error(chalk.red('Error: Invalid format. Use --set KEY=VALUE'))
39
+ return
40
+ }
41
+
42
+ const result = await coolify.setEnvironmentVariable(uuid, key, value, options.buildtime ?? false)
43
+
44
+ if (isErr(result)) {
45
+ console.error(chalk.red(`Error: ${result.error.message}`))
46
+ return
47
+ }
48
+
49
+ console.log(chalk.green(`✓ Set ${chalk.bold(key)} for ${uuid.slice(0, 8)}`))
50
+ return
51
+ }
52
+
53
+ // Handle --delete KEY
54
+ if (options.delete) {
55
+ const result = await coolify.deleteEnvironmentVariable(uuid, options.delete)
56
+
57
+ if (isErr(result)) {
58
+ console.error(chalk.red(`Error: ${result.error.message}`))
59
+ return
60
+ }
61
+
62
+ console.log(chalk.green(`✓ Deleted ${chalk.bold(options.delete)} from ${uuid.slice(0, 8)}`))
63
+ return
64
+ }
65
+
66
+ // Default: list env vars
25
67
  const result = await coolify.getEnvironmentVariables(uuid)
26
68
 
27
69
  if (isErr(result)) {
package/src/cli/index.ts CHANGED
@@ -112,8 +112,11 @@ program
112
112
  // Env vars command
113
113
  program
114
114
  .command('env <uuid>')
115
- .description('Get environment variables for an application')
116
- .action(envCommand)
115
+ .description('Manage environment variables for an application')
116
+ .option('--set <KEY=VALUE>', 'Set an environment variable')
117
+ .option('--delete <KEY>', 'Delete an environment variable')
118
+ .option('--buildtime', 'Mark variable as build-time only (use with --set)')
119
+ .action((uuid, options) => envCommand(uuid, options))
117
120
 
118
121
  // Update application
119
122
  program