/** * Coolify types for MCP server and CLI. * * Internal options use camelCase for consistency with TypeScript conventions. * API response types use snake_case to match Coolify API responses. * * @module */ /** * Options for deploying to Coolify. */ export interface ICoolifyDeployOptions { /** Application UUID */ uuid?: string; /** Application tag */ tag?: string; /** Force rebuild without cache */ force?: boolean; /** Progress callback for deployment status updates */ onProgress?: IProgressCallback; } /** * Application types supported by Coolify. */ export type TCoolifyApplicationType = | "public" | "private-github-app" | "private-deploy-key" | "dockerfile" | "docker-image" | "docker-compose"; /** * Options for creating a Coolify application. */ export interface ICoolifyAppOptions { /** Application name */ name: string; /** Application description */ description?: string; /** Project UUID */ projectUuid: string; /** Environment UUID */ environmentUuid: string; /** Environment name (required by API alongside environment_uuid) */ environmentName?: string; /** Server UUID */ serverUuid: string; /** Destination UUID (optional, for specific destination targeting) */ destinationUuid?: string; /** Application type */ type?: TCoolifyApplicationType; /** GitHub App UUID (required for private-github-app type — get from listGithubApps) */ githubAppUuid?: string; /** Git repository URL (for git-based apps) */ githubRepoUrl?: string; /** Git branch */ branch?: string; /** Build pack type */ buildPack?: "dockerfile" | "nixpacks" | "static" | "dockercompose"; /** Ports to expose */ portsExposes?: string; /** Docker image (for docker-image type) */ dockerImage?: string; /** Docker Compose content (for docker-compose type) */ dockerCompose?: string; /** Docker Compose file location relative to repo root (for dockercompose buildPack) */ dockerComposeLocation?: string; /** Environment variables */ envVars?: Record; /** Dockerfile location (path relative to repo root, e.g., "apps/haidodocs/Dockerfile") */ dockerfileLocation?: string; /** Base directory for build context (default: "/") */ baseDirectory?: string; /** Private key UUID (required for private-deploy-key type) */ privateKeyUuid?: string; } /** * Options for updating a Coolify application. */ export interface ICoolifyUpdateOptions { /** Application name */ name?: string; /** Application description */ description?: string; /** Build pack type */ buildPack?: "dockerfile" | "nixpacks" | "static" | "dockercompose"; /** Git branch */ gitBranch?: string; /** Ports to expose */ portsExposes?: string; /** Install command (nixpacks) */ installCommand?: string; /** Build command */ buildCommand?: string; /** Start command */ startCommand?: string; /** Dockerfile location (path relative to repo root, e.g., "apps/haidodocs/Dockerfile") */ dockerfileLocation?: string; /** Base directory for build context (default: "/") */ baseDirectory?: string; /** Domains/FQDN - comma separated list of domains with protocol (e.g., "https://app.example.com") — NOT for dockercompose apps */ domains?: string; /** Docker Compose domains - JSON object: { "service-name": { "domain": "https://..." } } — for dockercompose apps */ dockerComposeDomains?: string; /** Raw docker-compose YAML content — for dockercompose buildPack only. * Pass the full compose string; Coolify will replace the existing one. */ dockerComposeRaw?: string; /** Force HTTPS redirect */ isForceHttpsEnabled?: boolean; /** Enable auto deploy on git push */ isAutoDeployEnabled?: boolean; /** Watch paths for selective auto-deploy (newline-separated globs, e.g. "src/**\npackages/**") */ watchPaths?: string | null; /** Enable health check for the application */ healthCheckEnabled?: boolean; /** Health check endpoint path (e.g., "/health") */ healthCheckPath?: string; /** Health check port (defaults to application port) */ healthCheckPort?: string | number; /** Health check HTTP method (e.g., "GET") */ healthCheckMethod?: string; /** Health check interval in seconds */ healthCheckInterval?: number; /** Health check timeout in seconds */ healthCheckTimeout?: number; /** Number of retries before marking unhealthy */ healthCheckRetries?: number; /** Grace period in seconds before health checks start */ healthCheckStartPeriod?: number; /** Expected HTTP return code for healthy status */ healthCheckReturnCode?: number; } /** * Options for retrieving application logs. */ export interface ICoolifyLogsOptions { /** Follow logs in real-time */ follow?: boolean; /** Number of lines to retrieve */ tail?: number; /** Service name for docker-compose apps */ serviceName?: string; } /** * Result of a Coolify deployment. */ export interface ICoolifyDeployResult { /** Whether the deployment started successfully */ success: boolean; /** Deployment UUID */ deploymentUuid?: string; /** Resource UUID */ resourceUuid?: string; /** Error message if failed */ error?: string; } /** * Result of creating a Coolify application. */ export interface ICoolifyAppResult { /** Whether the application was created */ success: boolean; /** Application UUID */ uuid?: string; /** Error message if failed */ error?: string; } /** * Result of a delete operation. */ export interface ICoolifyDeleteResult { /** Whether the deletion was successful */ success: boolean; /** Optional message */ message?: string; } /** * Application logs response. */ export interface ICoolifyLogs { /** Log lines */ logs: string[]; /** Timestamp of log retrieval */ timestamp: string; } /** * Deployment record from API (snake_case). */ export interface ICoolifyDeployment { /** Deployment ID */ id: number; /** Deployment UUID */ uuid: string; /** Deployment status */ status: string; /** Application ID */ application_id?: number; /** Pull request ID if applicable */ pull_request_id?: number | null; /** Force rebuild flag */ force_rebuild?: boolean; /** Commit hash */ commit?: string | null; /** Rollback flag */ rollback?: boolean; /** Commit message */ commit_message?: string | null; /** Creation timestamp */ created_at: string; /** Update timestamp */ updated_at: string; } /** * Application details from API (snake_case). */ export interface ICoolifyApplication { /** Application UUID */ uuid: string; /** Application name */ name: string; /** Application description */ description?: string | null; /** Current status (e.g., "running:unknown", "stopped") */ status: string; /** FQDN if configured */ fqdn?: string | null; /** Git repository (e.g., "MKS2508/repo-name") */ git_repository?: string | null; /** Git branch */ git_branch?: string | null; /** Full git URL */ git_full_url?: string | null; /** Build pack type */ build_pack?: string | null; /** Ports exposed */ ports_exposes?: string | null; /** Dockerfile location */ dockerfile_location?: string | null; /** Base directory */ base_directory?: string | null; /** Watch paths for selective auto-deploy (newline-separated globs) */ watch_paths?: string | null; /** Raw docker-compose YAML content (dockercompose buildPack only) */ docker_compose_raw?: string | null; /** Application settings (returned from GET /applications/{uuid}) */ settings?: { is_auto_deploy_enabled?: boolean; is_force_https_enabled?: boolean; is_preview_deployments_enabled?: boolean; [key: string]: unknown; } | null; /** Server status (boolean) */ server_status?: boolean; /** Environment ID (numeric) */ environment_id?: number; /** Project UUID */ project_uuid?: string; /** Environment UUID */ environment_uuid?: string; /** Source type (e.g., "App\\Models\\GithubApp", "App\\Models\\DeployKey") */ source_type?: string; /** Type (legacy, may be null) */ type?: string; /** Destination info */ destination?: { uuid: string; name: string; server?: { uuid: string; name: string; ip: string; }; } | null; /** Install command */ install_command?: string | null; /** Build command */ build_command?: string | null; /** Start command */ start_command?: string | null; /** Creation timestamp */ created_at?: string; /** Update timestamp */ updated_at?: string; } /** * Server details from API (snake_case). */ export interface ICoolifyServer { /** Server UUID */ uuid: string; /** Server name */ name: string; /** Server description */ description?: string | null; /** Server IP address */ ip?: string; /** SSH port */ port?: number; /** Whether this is the Coolify host */ is_coolify_host?: boolean; /** Whether server is reachable */ is_reachable?: boolean; /** Whether server is usable */ is_usable?: boolean; /** Proxy configuration */ proxy?: { redirect_enabled?: boolean; } | null; /** Server settings */ settings?: Record | null; } /** * Destination (Docker network) from API (snake_case). */ export interface ICoolifyDestination { /** Destination UUID */ uuid: string; /** Destination name */ name: string; /** Network name */ network?: string; /** Server UUID */ server_uuid?: string; } /** * Project details from API (snake_case). */ export interface ICoolifyProject { /** Project UUID */ uuid: string; /** Project name */ name: string; /** Project description */ description?: string | null; /** Environments in this project */ environments?: ICoolifyEnvironment[]; } /** * Environment within a project from API (snake_case). */ export interface ICoolifyEnvironment { /** Environment UUID (needed for API calls) */ uuid: string; /** Environment ID */ id: number; /** Environment name */ name: string; /** Environment description */ description?: string | null; /** Project ID */ project_id: number; /** Creation timestamp */ created_at?: string; /** Update timestamp */ updated_at?: string; } /** * Team details from API (snake_case). */ export interface ICoolifyTeam { /** Team ID */ id: number; /** Team name */ name: string; /** Team description */ description?: string | null; /** Personal team flag */ personal_team?: boolean; } /** * Progress callback function type. * * @param percent - Progress percentage (0-100) * @param message - Progress message * @param step - Current step identifier */ export type IProgressCallback = ( percent: number, message: string, step?: string, ) => void; /** * Database details from API (snake_case). */ export interface ICoolifyDatabase { uuid: string; name: string; type: string; status: string; version?: string; description?: string | null; /** Environment ID (numeric, for grouping under projects) */ environment_id?: number; destination?: { uuid: string; name: string; server?: { uuid: string; name: string; ip: string; }; } | null; } /** * Service details from API (snake_case). */ export interface ICoolifyService { uuid: string; name: string; type: string; status: string; version?: string; description?: string | null; /** Environment ID (numeric, for grouping under projects) */ environment_id?: number; project_uuid?: string; environment_uuid?: string; server_uuid?: string; } /** * Private key details from API (snake_case). */ export interface ICoolifyPrivateKey { uuid: string; name: string; private_key?: string; is_git_related?: boolean; created_at?: string; updated_at?: string; } /** * Database backup details from API (snake_case). */ export interface ICoolifyDatabaseBackup { uuid: string; name: string; status: string; created_at: string; finished_at?: string; size?: number; } /** * Server resource details from API. */ export interface ICoolifyServerResource { uuid: string; name: string; type: string; status: string; } /** * Server domain details from API. */ export interface ICoolifyServerDomain { uuid: string; domain: string; status: string; force_https: boolean; } /** * Coolify version info. */ export interface ICoolifyVersion { version: string; latest_version?: string; is_latest?: boolean; } /** * A resource (app, database, or service) within an environment. */ export interface ICoolifyResource { /** Resource UUID */ uuid: string; /** Resource name */ name: string; /** Resource type: app, database, or service */ kind: "app" | "database" | "service"; /** Current status */ status: string; /** FQDN/domain if configured */ fqdn?: string | null; /** Database engine type (only for databases) */ dbType?: string; } /** * An environment within a project, containing resources. */ export interface ICoolifyEnvironmentNode { /** Environment ID (numeric) */ id: number; /** Environment UUID */ uuid: string; /** Environment name (e.g., "production", "staging") */ name: string; /** Resources in this environment */ resources: ICoolifyResource[]; } /** * A project node in the infrastructure tree. */ export interface ICoolifyProjectNode { /** Project UUID */ uuid: string; /** Project name */ name: string; /** Project description */ description?: string | null; /** Environments in this project */ environments: ICoolifyEnvironmentNode[]; } /** * Full infrastructure tree: projects → environments → resources. * Also includes global server info and aggregate counts. */ export interface ICoolifyInfrastructureTree { /** Server info */ server: { name: string; ip?: string; uuid?: string; }; /** Projects with their environments and resources */ projects: ICoolifyProjectNode[]; /** Aggregate counts */ counts: { projects: number; apps: number; databases: number; services: number; healthy: number; running: number; stopped: number; unhealthy: number; }; } /** * GitHub App configuration from Coolify API (snake_case). * OpenAPI schema: GET /github-apps returns ~16 fields. * * @see https://docs.coolify.io/api-reference/github-apps */ export interface ICoolifyGithubApp { /** Coolify internal ID */ id: number; /** Coolify UUID */ uuid: string; /** App display name */ name: string; /** GitHub organization or null for personal apps */ organization: string | null; /** GitHub API URL (e.g., https://api.github.com) */ api_url: string; /** GitHub App web URL (e.g., https://github.com/apps/my-app) */ html_url: string; /** Custom SSH user for git operations (default: "git") */ custom_user: string; /** Custom SSH port (default: 22) */ custom_port: number; /** GitHub App ID (different from Coolify's internal id) */ app_id: number; /** GitHub Installation ID */ installation_id: number; /** GitHub OAuth App Client ID */ client_id: string; /** GitHub private key ID on the Coolify server */ private_key_id: number; /** Whether app is installed across all org repos (not just selected ones) */ is_system_wide: boolean; /** Whether this is a public GitHub App (public installer) vs private */ is_public: boolean; /** Coolify team ID that owns this app */ team_id: number; /** App type string */ type: string; }