Stu Mason
Stu Mason

Activity

Issue Resolved

Issue #69 closed: Improve validation error details and add Docker image deployment

Problem

When creating an application via the MCP, validation errors from the Coolify API return only "Validation failed." without details about which fields failed validation or why.

Example

mcp__coolify__application action=create_key ...
Error: Validation failed.

This makes it difficult to debug what's actually wrong with the request.

Investigation

Looking at coolify-client.ts, error handling extracts error.message from the API response:

if (!response.ok) {
  const error = data as ErrorResponse;
  throw new Error(error.message || `HTTP ${response.status}: ${response.statusText}`);
}

The issue is that Coolify's API likely returns validation errors in a different format (possibly error.errors or similar) that isn't being captured.

Suggestions

1. Improve error handling

Capture and return full validation error details:

if (!response.ok) {
  const error = data as ErrorResponse;
  const errorDetails = error.errors 
    ? JSON.stringify(error.errors) 
    : error.message;
  throw new Error(errorDetails || `HTTP ${response.status}: ${response.statusText}`);
}

2. Add Docker image deployment tool

The client has createApplicationDockerImage but it's not exposed as a tool. This would be useful for deploying pre-built images from Docker Hub:

// In mcp-server.ts application tool
case 'create_dockerimage':
  // Deploy from Docker Hub image like stumason/polar-flow-server:latest
  return this.client.createApplicationDockerImage(args);

Context

Was trying to deploy stumason/polar-flow-server:latest to Coolify and kept getting unhelpful validation errors.