/** * MCP Tool definitions for Coolify. * * Defines all 21 tools with their input schemas. * * @module */ import type { Tool } from "@modelcontextprotocol/sdk/types.js"; /** * All Coolify MCP tool definitions. */ export const coolifyTools: Tool[] = [ { name: "deploy", description: `Deploy or redeploy an application to Coolify. Triggers a new deployment for the specified application UUID. Can force rebuild without cache if needed.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID in Coolify", format: "uuid", }, force: { type: "boolean" as const, description: "Force rebuild without cache", default: false, }, tag: { type: "string" as const, description: "Deploy specific tag/version", }, }, required: ["uuid"], }, }, { name: "get_env_vars", description: `Get environment variables for a Coolify application. Returns all environment variables with metadata including whether they are runtime or buildtime, and if they are required.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, }, required: ["uuid"], }, }, { name: "set_env_vars", description: `Set environment variables for a Coolify application. Updates or adds environment variables. Existing vars not in the input are preserved. Redeploy after setting to apply changes.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, envVars: { type: "object" as const, description: "Key-value pairs of environment variables", additionalProperties: { type: "string" as const }, }, }, required: ["uuid", "envVars"], }, }, { name: "get_deployment_status", description: `Get the current status of a Coolify application. Returns deployment state, health status, and resource usage.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, }, required: ["uuid"], }, }, { name: "list_applications", description: `List all applications in Coolify. Optionally filter by team or project ID.`, inputSchema: { type: "object" as const, properties: { teamId: { type: "string" as const, description: "Filter by Team ID", }, projectId: { type: "string" as const, description: "Filter by Project ID", }, }, }, }, { name: "delete_application", description: `Delete an application from Coolify. WARNING: This action is irreversible. All deployments, environment variables, domains, and history will be permanently deleted.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID to delete", format: "uuid", }, }, required: ["uuid"], }, }, { name: "get_application_logs", description: `Get logs for a Coolify application. Retrieve recent logs. For docker-compose apps, use serviceName to filter by container.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, tail: { type: "number" as const, description: "Number of log lines to retrieve (default: 100)", }, serviceName: { type: "string" as const, description: "Service name to filter logs (for docker-compose apps, e.g., 'app', 'db')", }, }, required: ["uuid"], }, }, { name: "start_application", description: `Start a stopped Coolify application. Use this to start applications that were previously stopped.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID to start", format: "uuid", }, force: { type: "boolean" as const, description: "Force start even if already running", }, instantDeploy: { type: "boolean" as const, description: "Instant deploy without waiting for queue", }, }, required: ["uuid"], }, }, { name: "stop_application", description: `Stop a running Coolify application. WARNING: This will make the application temporarily unavailable. Containers will be stopped but not deleted.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID to stop", format: "uuid", }, }, required: ["uuid"], }, }, { name: "restart_application", description: `Restart a Coolify application. Equivalent to stopping and then starting the application. Useful to apply configuration changes or recover from errors.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID to restart", format: "uuid", }, }, required: ["uuid"], }, }, { name: "get_deployment_history", description: `Get deployment history for a Coolify application. Returns list of all deployments with status, timestamps, and commit info.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, }, required: ["uuid"], }, }, { name: "update_application", description: `Update configuration for a Coolify application. Can modify name, description, build settings, commands, and domains. Redeploy after updating to apply changes.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, name: { type: "string" as const, description: "New application name", }, description: { type: "string" as const, description: "New description", }, buildPack: { type: "string" as const, description: "Build pack type", enum: ["dockerfile", "nixpacks", "static", "dockercompose"], }, gitBranch: { type: "string" as const, description: "Git branch to deploy", }, portsExposes: { type: "string" as const, description: "Ports to expose (comma-separated)", }, installCommand: { type: "string" as const, description: "Install command (nixpacks)", }, buildCommand: { type: "string" as const, description: "Build command", }, startCommand: { type: "string" as const, description: "Start command", }, domains: { type: "string" as const, description: 'Domains/FQDN - comma separated list with protocol (e.g., "https://app.example.com,https://www.example.com")', }, isForceHttpsEnabled: { type: "boolean" as const, description: "Force HTTPS redirect", }, isAutoDeployEnabled: { type: "boolean" as const, description: "Enable auto deploy on git push", }, dockerfileLocation: { type: "string" as const, description: "Dockerfile location relative to repo root", }, baseDirectory: { type: "string" as const, description: 'Base directory for build context (default: "/")', }, watchPaths: { type: "string" as const, description: 'Watch paths for selective auto-deploy. Newline-separated globs (e.g. "src/**\\npackages/**"). Set to empty string or null to clear.', nullable: true, }, dockerComposeDomains: { type: "string" as const, description: 'Docker Compose domains JSON: { "service-name": { "domain": "https://..." } }', }, }, required: ["uuid"], }, }, { name: "get_application", description: `Get detailed information about a Coolify application including settings (auto-deploy, force HTTPS) and watch paths. Returns full application details that list_applications doesn't include.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", }, }, required: ["uuid"], }, }, { name: "set_domains", description: `Set domains/FQDN for a Coolify application. Configure custom domains for your application. Coolify automatically handles SSL certificates via Let's Encrypt. Domain format: - Use FQDN with protocol: https://app.example.com - Multiple domains separated by comma: https://app.example.com,https://www.example.com - Can include port mapping: https://api.example.com:3000`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, domains: { type: "string" as const, description: 'Domains/FQDN - comma separated list with protocol (e.g., "https://app.example.com,https://www.example.com")', }, forceHttps: { type: "boolean" as const, description: "Force HTTPS redirect (default: true)", default: true, }, }, required: ["uuid", "domains"], }, }, { name: "list_servers", description: `List all available servers in Coolify. Returns server UUIDs, names, and IPs. Use server UUID when creating applications.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_server", description: `Get details of a specific Coolify server. Returns server information including name, IP, status, and configuration.`, inputSchema: { type: "object" as const, properties: { serverUuid: { type: "string" as const, description: "Server UUID to get details for", format: "uuid", }, }, required: ["serverUuid"], }, }, { name: "list_projects", description: `List all projects in Coolify. Returns project UUIDs, names, and associated environments.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "list_teams", description: `List all teams in Coolify. Returns team IDs, names, and configuration.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_server_destinations", description: `Get available destinations for a Coolify server. Returns destination UUIDs needed when creating applications. Each destination represents a Docker network/environment on the server.`, inputSchema: { type: "object" as const, properties: { serverUuid: { type: "string" as const, description: "Server UUID to get destinations for", format: "uuid", }, }, required: ["serverUuid"], }, }, { name: "create_application", description: `Create a new application in Coolify from a GitHub repository. Requires server UUID and destination UUID (get them from list_servers and get_server_destinations). The GitHub repository must be accessible via the configured GitHub App.`, inputSchema: { type: "object" as const, properties: { name: { type: "string" as const, description: "Application name", }, serverUuid: { type: "string" as const, description: "Server UUID to deploy to", format: "uuid", }, destinationUuid: { type: "string" as const, description: "Destination UUID (Docker network)", format: "uuid", }, githubRepoUrl: { type: "string" as const, description: "GitHub repository URL (e.g., https://github.com/user/repo)", }, description: { type: "string" as const, description: "Application description", }, branch: { type: "string" as const, description: "Git branch to deploy", default: "main", }, buildPack: { type: "string" as const, description: "Build pack type", enum: ["dockerfile", "nixpacks", "static", "dockercompose"], default: "nixpacks", }, type: { type: "string" as const, description: "Application type", enum: [ "public", "private-github-app", "private-deploy-key", "dockerfile", "docker-image", "docker-compose", ], default: "public", }, dockerComposeLocation: { type: "string" as const, description: "Docker Compose file location relative to repo root (for dockercompose buildPack)", }, dockerfileLocation: { type: "string" as const, description: "Dockerfile location relative to repo root", }, baseDirectory: { type: "string" as const, description: 'Base directory for build context (default: "/")', }, projectUuid: { type: "string" as const, description: "Project UUID", }, environmentUuid: { type: "string" as const, description: "Environment UUID", }, githubAppUuid: { type: "string" as const, description: "GitHub App UUID (for private-github-app type, get from list_github_apps)", }, portsExposes: { type: "string" as const, description: "Ports to expose (e.g., '3000' or '3000,8080')", }, }, required: ["name", "serverUuid"], }, }, { name: "create_project", description: `Create a new project in Coolify. Projects organize applications into logical groups. Each project has one or more environments (e.g., production, staging).`, inputSchema: { type: "object" as const, properties: { name: { type: "string" as const, description: "Project name", }, description: { type: "string" as const, description: "Project description", }, }, required: ["name"], }, }, { name: "get_resource_usage", description: `Get resource usage for a Coolify application. Returns current resource consumption metrics.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, }, required: ["uuid"], }, }, { name: "health_check", description: `Check if Coolify API is accessible and credentials are valid. Returns connection status and API version info if available.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "list_deployments", description: `List all active and queued deployments across all applications. Returns deployments that are currently in progress or waiting in queue. Useful for monitoring ongoing builds and deployments.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_deployment", description: `Get detailed information about a specific deployment. Returns deployment status, logs, timestamps, and error messages if any. Use deployment UUID from list_deployments or get_application_deployments.`, inputSchema: { type: "object" as const, properties: { deploymentUuid: { type: "string" as const, description: "Deployment UUID", }, }, required: ["deploymentUuid"], }, }, { name: "get_application_deployments", description: `Get deployment history for a specific application. Returns list of all deployments with status, timestamps, commit info, and logs. Useful for debugging failed deployments and tracking deployment history.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, skip: { type: "number" as const, description: "Number of deployments to skip (pagination)", default: 0, }, take: { type: "number" as const, description: "Number of deployments to return (default: 10)", default: 10, }, }, required: ["uuid"], }, }, { name: "get_application_details", description: `Get detailed information about a Coolify application. Returns full application configuration including name, description, build settings, environment, and deployment status.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", format: "uuid", }, }, required: ["uuid"], }, }, // =========================================================================== // Version / Health // =========================================================================== { name: "execute_command", description: `Execute a shell command on an application's running container. Useful for debugging, checking file contents, or running one-off operations.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", }, command: { type: "string" as const, description: "Shell command to execute (e.g., 'ls -la', 'cat /app/logs/error.log')", }, }, required: ["uuid", "command"], }, }, { name: "bulk_update_env_vars", description: `Bulk update environment variables for an application. More efficient than setting variables one by one. Accepts an array of key-value pairs.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", }, envVars: { type: "array" as const, description: "Array of { key, value, is_preview? } objects", items: { type: "object" as const, properties: { key: { type: "string" as const }, value: { type: "string" as const }, is_preview: { type: "boolean" as const }, }, required: ["key", "value"], }, }, }, required: ["uuid", "envVars"], }, }, // =========================================================================== // Version / Health // =========================================================================== { name: "get_version", description: `Get the Coolify server version. Returns the version string of the connected Coolify instance.`, inputSchema: { type: "object" as const, properties: {}, }, }, // =========================================================================== // Database Management // =========================================================================== { name: "list_databases", description: `List all databases in Coolify. Returns database UUIDs, names, types, and status.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_database", description: `Get details of a specific database. Returns full database configuration, connection info, and status.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Database UUID", }, }, required: ["uuid"], }, }, { name: "create_database", description: `Create a new database in Coolify. Supports types: postgresql, mysql, mariadb, mongodb, redis, keydb, clickhouse, dragonfly. Requires server_uuid and project_uuid in the data.`, inputSchema: { type: "object" as const, properties: { dbType: { type: "string" as const, description: "Database type", enum: [ "postgresql", "mysql", "mariadb", "mongodb", "redis", "keydb", "clickhouse", "dragonfly", ], }, data: { type: "object" as const, description: "Database creation data (server_uuid, project_uuid, environment_name, etc.)", additionalProperties: true, }, }, required: ["dbType", "data"], }, }, { name: "delete_database", description: `Delete a database from Coolify. WARNING: This action is irreversible.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Database UUID to delete", }, }, required: ["uuid"], }, }, { name: "start_database", description: `Start a stopped database.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Database UUID to start", }, }, required: ["uuid"], }, }, { name: "stop_database", description: `Stop a running database. WARNING: This will make the database temporarily unavailable.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Database UUID to stop", }, }, required: ["uuid"], }, }, { name: "restart_database", description: `Restart a database.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Database UUID to restart", }, }, required: ["uuid"], }, }, // =========================================================================== // Service Management // =========================================================================== { name: "list_services", description: `List all services in Coolify. Returns service UUIDs, names, types, and status.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_service", description: `Get details of a specific service.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Service UUID", }, }, required: ["uuid"], }, }, { name: "start_service", description: `Start a stopped service.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Service UUID to start", }, }, required: ["uuid"], }, }, { name: "stop_service", description: `Stop a running service.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Service UUID to stop", }, }, required: ["uuid"], }, }, { name: "restart_service", description: `Restart a service.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Service UUID to restart", }, }, required: ["uuid"], }, }, { name: "delete_service", description: `Delete a service from Coolify. WARNING: This action is irreversible.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Service UUID to delete", }, }, required: ["uuid"], }, }, // =========================================================================== // Server (additional) // =========================================================================== { name: "get_server_resources", description: `Get all resources deployed on a server. Returns applications, databases, and services running on the server.`, inputSchema: { type: "object" as const, properties: { serverUuid: { type: "string" as const, description: "Server UUID", }, }, required: ["serverUuid"], }, }, { name: "get_server_domains", description: `Get all domains configured on a server.`, inputSchema: { type: "object" as const, properties: { serverUuid: { type: "string" as const, description: "Server UUID", }, }, required: ["serverUuid"], }, }, { name: "validate_server", description: `Validate a server connection in Coolify. Checks if the server is reachable and properly configured.`, inputSchema: { type: "object" as const, properties: { serverUuid: { type: "string" as const, description: "Server UUID to validate", }, }, required: ["serverUuid"], }, }, // =========================================================================== // Deployment Control // =========================================================================== { name: "cancel_deployment", description: `Cancel an in-progress deployment. Stops the build/deployment process for the specified deployment.`, inputSchema: { type: "object" as const, properties: { deploymentUuid: { type: "string" as const, description: "Deployment UUID to cancel", }, }, required: ["deploymentUuid"], }, }, // =========================================================================== // Teams (additional) // =========================================================================== { name: "get_current_team", description: `Get the current team associated with the API token.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_team_members", description: `Get members of a specific team.`, inputSchema: { type: "object" as const, properties: { teamId: { type: "number" as const, description: "Team ID", }, }, required: ["teamId"], }, }, // =========================================================================== // Private Keys / SSH // =========================================================================== { name: "list_private_keys", description: `List all SSH private keys configured in Coolify.`, inputSchema: { type: "object" as const, properties: {}, }, }, { name: "get_private_key", description: `Get details of a specific SSH private key.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Private key UUID", }, }, required: ["uuid"], }, }, // =========================================================================== // Smart Resolution // =========================================================================== { name: "resolve_application", description: `Find an application by name, domain, or UUID. Searches across all applications and returns the match. Useful when you know the app name but not the UUID.`, inputSchema: { type: "object" as const, properties: { query: { type: "string" as const, description: "Application name, domain (FQDN), or UUID to search for", }, }, required: ["query"], }, }, { name: "resolve_server", description: `Find a server by name, IP, or UUID.`, inputSchema: { type: "object" as const, properties: { query: { type: "string" as const, description: "Server name, IP address, or UUID to search for", }, }, required: ["query"], }, }, // =========================================================================== // Diagnostics // =========================================================================== { name: "diagnose_application", description: `Run a comprehensive diagnostic on an application. Aggregates status, recent deployments, environment variables, and logs into a single diagnostic report with identified issues.`, inputSchema: { type: "object" as const, properties: { query: { type: "string" as const, description: "Application name, domain, or UUID to diagnose", }, }, required: ["query"], }, }, { name: "diagnose_server", description: `Run a comprehensive diagnostic on a server. Aggregates server health, deployed resources, and domains into a diagnostic report.`, inputSchema: { type: "object" as const, properties: { query: { type: "string" as const, description: "Server name, IP, or UUID to diagnose", }, }, required: ["query"], }, }, { name: "find_infrastructure_issues", description: `Scan all infrastructure for potential issues. Checks all servers, applications, databases, and services for problems like unreachable servers, stopped apps, failed deployments.`, inputSchema: { type: "object" as const, properties: {}, }, }, // =========================================================================== // Batch Operations // =========================================================================== { name: "restart_project_apps", description: `Restart all applications in a project.`, inputSchema: { type: "object" as const, properties: { projectUuid: { type: "string" as const, description: "Project UUID", }, }, required: ["projectUuid"], }, }, { name: "redeploy_project_apps", description: `Redeploy all applications in a project.`, inputSchema: { type: "object" as const, properties: { projectUuid: { type: "string" as const, description: "Project UUID", }, force: { type: "boolean" as const, description: "Force rebuild without cache", default: false, }, }, required: ["projectUuid"], }, }, { name: "stop_all_apps", description: `Emergency stop all running applications. WARNING: This will stop ALL running applications across all projects.`, inputSchema: { type: "object" as const, properties: {}, }, }, // =========================================================================== // Network Diagnostics // =========================================================================== { name: "inspect_network", description: `Inspect Docker container network environment for an application. Returns /etc/hosts, DNS resolution, network env vars, interfaces, and optionally tests connectivity to other services. Essential for debugging docker-compose networking issues.`, inputSchema: { type: "object" as const, properties: { uuid: { type: "string" as const, description: "Application UUID", }, servicesToTest: { type: "array" as const, description: "Service names to test connectivity (e.g., ['db', 'redis', 'app'])", items: { type: "string" as const }, }, }, required: ["uuid"], }, }, { name: "analyze_deploy_failure", description: `Analyze a failed deployment by inspecting build logs. Automatically extracts error lines, categorizes the failure type (build_error, install_error, docker_error, network_error, timeout), and suggests fixes.`, inputSchema: { type: "object" as const, properties: { deploymentUuid: { type: "string" as const, description: "Deployment UUID of the failed deployment", }, }, required: ["deploymentUuid"], }, }, ];