@mks2508/coolify-mks-cli-mcp 0.2.1 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH;;GAEG;AACH,eAAO,MAAM,aAAa,yEAs0BxB,CAAA;AAQF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,mBAAmB,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH;;GAEG;AACH,eAAO,MAAM,aAAa,yEA60BxB,CAAA;AAQF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,mBAAmB,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -28171,6 +28171,7 @@ var CoolifyService = class {
28171
28171
  body.build_pack = options.buildPack || "dockerfile";
28172
28172
  if (options.portsExposes) body.ports_exposes = options.portsExposes;
28173
28173
  if (options.dockerfileLocation) body.dockerfile_location = options.dockerfileLocation;
28174
+ if (options.dockerComposeLocation) body.docker_compose_location = options.dockerComposeLocation;
28174
28175
  if (options.baseDirectory) body.base_directory = options.baseDirectory;
28175
28176
  } else if (appType === "docker-image" && options.dockerImage) body.docker_image = options.dockerImage;
28176
28177
  else if (appType === "docker-compose" && options.dockerCompose) body.docker_compose = options.dockerCompose;
@@ -28231,6 +28232,75 @@ var CoolifyService = class {
28231
28232
  return ok(result.data || []);
28232
28233
  }
28233
28234
  /**
28235
+ * Sets a single environment variable for an application.
28236
+ * Uses PATCH if variable exists, POST if it doesn't.
28237
+ *
28238
+ * @param appUuid - Application UUID
28239
+ * @param key - Variable name
28240
+ * @param value - Variable value
28241
+ * @param isBuildTime - Whether the variable is available at build time (only for new vars)
28242
+ * @returns Result indicating success or error
28243
+ */
28244
+ async setEnvironmentVariable(appUuid, key, value, isBuildTime = false) {
28245
+ log.info(`Setting environment variable ${key} for ${appUuid}`);
28246
+ const existingVars = await this.getEnvironmentVariables(appUuid);
28247
+ if (isErr(existingVars)) return err(existingVars.error);
28248
+ const exists = existingVars.value.some((ev) => ev.key === key);
28249
+ if (exists) {
28250
+ log.debug(`Variable ${key} exists, using PATCH to update`);
28251
+ const result = await this.request(`/applications/${appUuid}/envs`, {
28252
+ method: "PATCH",
28253
+ body: JSON.stringify({
28254
+ key,
28255
+ value
28256
+ })
28257
+ });
28258
+ if (result.error) {
28259
+ log.error(`Failed to update env var: ${result.error}`);
28260
+ return err(new Error(result.error));
28261
+ }
28262
+ } else {
28263
+ log.debug(`Variable ${key} does not exist, using POST to create`);
28264
+ const result = await this.request(`/applications/${appUuid}/envs`, {
28265
+ method: "POST",
28266
+ body: JSON.stringify({
28267
+ key,
28268
+ value
28269
+ })
28270
+ });
28271
+ if (result.error) {
28272
+ log.error(`Failed to create env var: ${result.error}`);
28273
+ return err(new Error(result.error));
28274
+ }
28275
+ }
28276
+ log.success(`Environment variable ${key} set for ${appUuid}`);
28277
+ return ok(void 0);
28278
+ }
28279
+ /**
28280
+ * Deletes an environment variable from an application.
28281
+ *
28282
+ * @param appUuid - Application UUID
28283
+ * @param key - Variable name to delete
28284
+ * @returns Result indicating success or error
28285
+ */
28286
+ async deleteEnvironmentVariable(appUuid, key) {
28287
+ log.info(`Deleting environment variable ${key} from ${appUuid}`);
28288
+ const envVarsResult = await this.getEnvironmentVariables(appUuid);
28289
+ if (isErr(envVarsResult)) return err(envVarsResult.error);
28290
+ const envVar = envVarsResult.value.find((ev) => ev.key === key);
28291
+ if (!envVar) {
28292
+ log.error(`Environment variable ${key} not found`);
28293
+ return err(new Error(`Environment variable ${key} not found`));
28294
+ }
28295
+ const result = await this.request(`/applications/${appUuid}/envs/${envVar.uuid}`, { method: "DELETE" });
28296
+ if (result.error) {
28297
+ log.error(`Failed to delete env var: ${result.error}`);
28298
+ return err(new Error(result.error));
28299
+ }
28300
+ log.success(`Environment variable ${key} deleted from ${appUuid}`);
28301
+ return ok(void 0);
28302
+ }
28303
+ /**
28234
28304
  * Gets the status of an application.
28235
28305
  *
28236
28306
  * @param appUuid - Application UUID
@@ -28278,6 +28348,29 @@ var CoolifyService = class {
28278
28348
  return ok(result.data || []);
28279
28349
  }
28280
28350
  /**
28351
+ * Creates a new project.
28352
+ *
28353
+ * @param name - Project name
28354
+ * @param description - Optional project description
28355
+ * @returns Result with created project or error
28356
+ */
28357
+ async createProject(name, description) {
28358
+ log.info(`Creating project: ${name}`);
28359
+ const result = await this.request("/projects", {
28360
+ method: "POST",
28361
+ body: JSON.stringify({
28362
+ name,
28363
+ description: description || ""
28364
+ })
28365
+ });
28366
+ if (result.error) {
28367
+ log.error(`Failed to create project: ${result.error}`);
28368
+ return err(new Error(result.error));
28369
+ }
28370
+ log.success(`Project created: ${result.data?.uuid}`);
28371
+ return ok(result.data);
28372
+ }
28373
+ /**
28281
28374
  * Gets environments for a project.
28282
28375
  *
28283
28376
  * @param projectUuid - Project UUID
@@ -28375,6 +28468,9 @@ var CoolifyService = class {
28375
28468
  if (options.startCommand) body.start_command = options.startCommand;
28376
28469
  if (options.dockerfileLocation) body.dockerfile_location = options.dockerfileLocation;
28377
28470
  if (options.baseDirectory) body.base_directory = options.baseDirectory;
28471
+ if (options.domains) body.domains = options.domains;
28472
+ if (options.isForceHttpsEnabled !== void 0) body.is_force_https_enabled = options.isForceHttpsEnabled;
28473
+ if (options.isAutoDeployEnabled !== void 0) body.is_auto_deploy_enabled = options.isAutoDeployEnabled;
28378
28474
  const result = await this.request(`/applications/${appUuid}`, {
28379
28475
  method: "PATCH",
28380
28476
  body: JSON.stringify(body)
@@ -28404,9 +28500,11 @@ var CoolifyService = class {
28404
28500
  log.error(`Failed to get logs: ${result.error}`);
28405
28501
  return err(new Error(result.error));
28406
28502
  }
28503
+ const rawLogs = result.data?.logs;
28504
+ const logsArray = Array.isArray(rawLogs) ? rawLogs : typeof rawLogs === "string" ? rawLogs.split("\n").filter((l) => l.length > 0) : [];
28407
28505
  log.success(`Logs retrieved for application: ${appUuid}`);
28408
28506
  return ok({
28409
- logs: result.data?.logs || [],
28507
+ logs: logsArray,
28410
28508
  timestamp: new Date().toISOString()
28411
28509
  });
28412
28510
  }
@@ -28474,6 +28572,60 @@ var CoolifyService = class {
28474
28572
  log.success(`Application restarted: ${appUuid}`);
28475
28573
  return ok(result.data);
28476
28574
  }
28575
+ /**
28576
+ * Lists all active and queued deployments.
28577
+ *
28578
+ * @returns Result with deployments list or error
28579
+ */
28580
+ async listDeployments() {
28581
+ log.info("Listing active deployments");
28582
+ const result = await this.request("/deployments");
28583
+ if (result.error) {
28584
+ log.error(`Failed to list deployments: ${result.error}`);
28585
+ return err(new Error(result.error));
28586
+ }
28587
+ log.success(`Listed ${result.data?.length || 0} active deployments`);
28588
+ return ok(result.data || []);
28589
+ }
28590
+ /**
28591
+ * Gets detailed information about a specific deployment.
28592
+ *
28593
+ * @param deploymentUuid - Deployment UUID
28594
+ * @returns Result with deployment details or error
28595
+ */
28596
+ async getDeployment(deploymentUuid) {
28597
+ log.info(`Getting deployment details for ${deploymentUuid}`);
28598
+ const result = await this.request(`/deployments/${deploymentUuid}`);
28599
+ if (result.error) {
28600
+ log.error(`Failed to get deployment: ${result.error}`);
28601
+ return err(new Error(result.error));
28602
+ }
28603
+ log.success(`Deployment details retrieved: ${deploymentUuid}`);
28604
+ return ok(result.data);
28605
+ }
28606
+ /**
28607
+ * Gets deployment history for a specific application.
28608
+ *
28609
+ * @param appUuid - Application UUID
28610
+ * @param skip - Number of deployments to skip
28611
+ * @param take - Number of deployments to return
28612
+ * @returns Result with deployments list or error
28613
+ */
28614
+ async getApplicationDeployments(appUuid, skip = 0, take = 10) {
28615
+ log.info(`Getting deployments for application ${appUuid}`);
28616
+ const params = new URLSearchParams();
28617
+ if (skip > 0) params.set("skip", skip.toString());
28618
+ if (take !== 10) params.set("take", take.toString());
28619
+ const endpoint = `/applications/${appUuid}/deployments${params.toString() ? `?${params.toString()}` : ""}`;
28620
+ const result = await this.request(endpoint);
28621
+ if (result.error) {
28622
+ log.error(`Failed to get application deployments: ${result.error}`);
28623
+ return err(new Error(result.error));
28624
+ }
28625
+ const deployments = result.data?.deployments || [];
28626
+ log.success(`Retrieved ${deployments.length} deployments for ${appUuid}`);
28627
+ return ok(deployments);
28628
+ }
28477
28629
  };
28478
28630
  let instance = null;
28479
28631
  /**
@@ -28837,7 +28989,8 @@ Redeploy after updating to apply changes.`, {
28837
28989
  buildPack: enumType([
28838
28990
  "dockerfile",
28839
28991
  "nixpacks",
28840
- "static"
28992
+ "static",
28993
+ "dockercompose"
28841
28994
  ]).optional().describe("Build pack type"),
28842
28995
  gitBranch: stringType().optional().describe("Git branch to deploy"),
28843
28996
  portsExposes: stringType().optional().describe("Ports to expose (comma-separated)"),
@@ -29034,8 +29187,20 @@ The GitHub repository must be accessible via the configured GitHub App.`, {
29034
29187
  buildPack: enumType([
29035
29188
  "dockerfile",
29036
29189
  "nixpacks",
29037
- "static"
29038
- ]).default("nixpacks").describe("Build pack type")
29190
+ "static",
29191
+ "dockercompose"
29192
+ ]).default("nixpacks").describe("Build pack type"),
29193
+ type: enumType([
29194
+ "public",
29195
+ "private-github-app",
29196
+ "private-deploy-key",
29197
+ "dockerfile",
29198
+ "docker-image",
29199
+ "docker-compose"
29200
+ ]).default("public").describe("Application type"),
29201
+ dockerComposeLocation: stringType().optional().describe("Docker Compose file location relative to repo root"),
29202
+ dockerfileLocation: stringType().optional().describe("Dockerfile location relative to repo root"),
29203
+ baseDirectory: stringType().optional().describe("Base directory for build context")
29039
29204
  }, async (args) => {
29040
29205
  const initResult = await coolify.init();
29041
29206
  if (isErr(initResult)) return {
@@ -29051,10 +29216,13 @@ The GitHub repository must be accessible via the configured GitHub App.`, {
29051
29216
  projectUuid: args.projectUuid,
29052
29217
  environmentUuid: args.environmentUuid,
29053
29218
  serverUuid: args.serverUuid,
29054
- type: "public",
29219
+ type: args.type,
29055
29220
  githubRepoUrl: args.githubRepoUrl,
29056
29221
  branch: args.branch,
29057
- buildPack: args.buildPack
29222
+ buildPack: args.buildPack,
29223
+ dockerComposeLocation: args.dockerComposeLocation,
29224
+ dockerfileLocation: args.dockerfileLocation,
29225
+ baseDirectory: args.baseDirectory
29058
29226
  });
29059
29227
  if (isOk(result)) return { content: [{
29060
29228
  type: "text",