@mks2508/coolify-mks-cli-mcp 0.3.1 → 0.4.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.
package/dist/index.js CHANGED
@@ -28068,7 +28068,12 @@ var CoolifyService = class {
28068
28068
  };
28069
28069
  }
28070
28070
  if (!response.ok) {
28071
- const errorMessage = data?.message || `HTTP ${response.status}`;
28071
+ const parsed = data;
28072
+ let errorMessage = parsed?.message || `HTTP ${response.status}`;
28073
+ if (parsed?.errors) {
28074
+ const details = Object.entries(parsed.errors).map(([field, reasons]) => `${field}: ${Array.isArray(reasons) ? reasons.join(", ") : String(reasons)}`).join("; ");
28075
+ errorMessage += ` — ${details}`;
28076
+ }
28072
28077
  return {
28073
28078
  error: errorMessage,
28074
28079
  status: response.status,
@@ -28166,7 +28171,8 @@ var CoolifyService = class {
28166
28171
  server_uuid: options.serverUuid
28167
28172
  };
28168
28173
  if (appType === "public" || appType === "private-github-app" || appType === "private-deploy-key") {
28169
- if (options.githubRepoUrl) body.git_repository = options.githubRepoUrl;
28174
+ if (options.githubRepoUrl) body.git_repository = options.githubRepoUrl.replace(/^https?:\/\/github\.com\//, "").replace(/\.git$/, "");
28175
+ if (options.githubAppUuid) body.github_app_uuid = options.githubAppUuid;
28170
28176
  body.git_branch = options.branch || "main";
28171
28177
  body.build_pack = options.buildPack || "dockerfile";
28172
28178
  if (options.portsExposes) body.ports_exposes = options.portsExposes;
@@ -28175,6 +28181,8 @@ var CoolifyService = class {
28175
28181
  if (options.baseDirectory) body.base_directory = options.baseDirectory;
28176
28182
  } else if (appType === "docker-image" && options.dockerImage) body.docker_image = options.dockerImage;
28177
28183
  else if (appType === "docker-compose" && options.dockerCompose) body.docker_compose = options.dockerCompose;
28184
+ log.debug(`Create application body: ${JSON.stringify(body, null, 2)}`);
28185
+ log.debug(`Endpoint: POST ${endpoint}`);
28178
28186
  const result = await this.request(endpoint, {
28179
28187
  method: "POST",
28180
28188
  body: JSON.stringify(body)
@@ -28198,21 +28206,24 @@ var CoolifyService = class {
28198
28206
  * @returns Result indicating success or error
28199
28207
  */
28200
28208
  async setEnvironmentVariables(appUuid, envVars) {
28201
- log.info(`Setting environment variables for ${appUuid}`);
28202
- const envArray = Object.entries(envVars).map(([key, value]) => ({
28203
- key,
28204
- value,
28205
- is_build_time: false
28206
- }));
28207
- const result = await this.request(`/applications/${appUuid}/envs`, {
28208
- method: "POST",
28209
- body: JSON.stringify({ data: envArray })
28210
- });
28211
- if (result.error) {
28212
- log.error(`Failed to set env vars: ${result.error}`);
28213
- return err(new Error(result.error));
28209
+ log.info(`Setting ${Object.keys(envVars).length} environment variables for ${appUuid}`);
28210
+ for (const [key, value] of Object.entries(envVars)) {
28211
+ const result = await this.request(`/applications/${appUuid}/envs`, {
28212
+ method: "POST",
28213
+ body: JSON.stringify({
28214
+ key,
28215
+ value,
28216
+ is_preview: false,
28217
+ is_build_time: false,
28218
+ is_literal: false
28219
+ })
28220
+ });
28221
+ if (result.error) {
28222
+ log.error(`Failed to set env var ${key}: ${result.error}`);
28223
+ return err(new Error(`Failed to set ${key}: ${result.error}`));
28224
+ }
28214
28225
  }
28215
- log.success("Environment variables set");
28226
+ log.success(`${Object.keys(envVars).length} environment variables set`);
28216
28227
  return ok(void 0);
28217
28228
  }
28218
28229
  /**
@@ -28338,6 +28349,16 @@ var CoolifyService = class {
28338
28349
  return ok(result.data);
28339
28350
  }
28340
28351
  /**
28352
+ * Lists all GitHub Apps configured in Coolify.
28353
+ *
28354
+ * @returns Result with GitHub Apps list or error
28355
+ */
28356
+ async listGithubApps() {
28357
+ const result = await this.request("/github-apps");
28358
+ if (result.error) return err(new Error(result.error));
28359
+ return ok(result.data || []);
28360
+ }
28361
+ /**
28341
28362
  * Lists all projects.
28342
28363
  *
28343
28364
  * @returns Result with projects list or error