coolify_environment_configuration
Configure and manage environment variables, domains, and application logs for self-hosted applications on Coolify MCP Server. Perform actions like updating or retrieving environment settings, setting domains, and fetching logs efficiently.
Instructions
Manage environment variables, configure domains, and retrieve application logs
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: update env vars, get env vars, set domain, or get logs | |
| applicationId | Yes | Application ID (required for all actions) | |
| domain | No | Domain name to set (for set_domain action) | |
| enableHttps | No | Whether to enable HTTPS/SSL (for set_domain action) | |
| lines | No | Number of log lines to retrieve (for get_logs action) | |
| since | No | Retrieve logs since this timestamp (ISO format, for get_logs action) | |
| variables | No | Array of environment variables to set (for update_env) |
Input Schema (JSON Schema)
{
"properties": {
"action": {
"description": "Action to perform: update env vars, get env vars, set domain, or get logs",
"enum": [
"update_env",
"get_env",
"set_domain",
"get_logs"
],
"type": "string"
},
"applicationId": {
"description": "Application ID (required for all actions)",
"type": "string"
},
"domain": {
"description": "Domain name to set (for set_domain action)",
"type": "string"
},
"enableHttps": {
"default": true,
"description": "Whether to enable HTTPS/SSL (for set_domain action)",
"type": "boolean"
},
"lines": {
"default": 100,
"description": "Number of log lines to retrieve (for get_logs action)",
"maximum": 1000,
"minimum": 1,
"type": "number"
},
"since": {
"description": "Retrieve logs since this timestamp (ISO format, for get_logs action)",
"type": "string"
},
"variables": {
"description": "Array of environment variables to set (for update_env)",
"items": {
"properties": {
"is_build_time": {
"default": false,
"description": "Whether this variable is available at build time",
"type": "boolean"
},
"is_sensitive": {
"default": false,
"description": "Whether this is a sensitive variable (will be hidden in UI)",
"type": "boolean"
},
"key": {
"description": "Environment variable key/name",
"type": "string"
},
"value": {
"description": "Environment variable value",
"type": "string"
}
},
"required": [
"key",
"value"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"action",
"applicationId"
],
"type": "object"
}
Implementation Reference
- src/tools/environment-unified.ts:84-154 (handler)The handler function that implements the core logic for the 'coolify_environment_configuration' tool, dispatching to specific actions like updating environment variables, getting env vars, setting domains, and retrieving logs using the Coolify API client.export async function handleEnvironmentConfiguration( coolifyClient: CoolifyApiClient, args: any ): Promise<any> { try { const { action, applicationId, ...params } = args; let result; let message; switch (action) { case 'update_env': if (!params.variables || !Array.isArray(params.variables)) { throw new Error('variables array is required for update_env action'); } result = await coolifyClient.updateEnvironmentVariables(applicationId, params.variables); message = `Updated ${params.variables.length} environment variables for application ${applicationId}`; break; case 'get_env': result = await coolifyClient.getEnvironmentVariables(applicationId); message = `Retrieved environment variables for application ${applicationId}`; break; case 'set_domain': if (!params.domain) { throw new Error('domain is required for set_domain action'); } result = await coolifyClient.setDomain(applicationId, params.domain, params.enableHttps); message = `Set domain ${params.domain} for application ${applicationId}`; break; case 'get_logs': result = await coolifyClient.getApplicationLogs( applicationId, params.lines || 100, params.since ); message = `Retrieved ${params.lines || 100} log lines for application ${applicationId}`; break; default: throw new Error(`Unknown environment action: ${action}`); } return { content: [ { type: 'text', text: JSON.stringify({ success: true, data: result, message: message }, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error occurred' }, null, 2) } ], isError: true }; } }
- The Tool object definition including name, description, and detailed inputSchema for validating tool inputs.export const environmentConfigurationTool: Tool = { name: 'coolify_environment_configuration', description: 'Manage environment variables, configure domains, and retrieve application logs', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['update_env', 'get_env', 'set_domain', 'get_logs'], description: 'Action to perform: update env vars, get env vars, set domain, or get logs', }, applicationId: { type: 'string', description: 'Application ID (required for all actions)', }, // Environment variable parameters variables: { type: 'array', description: 'Array of environment variables to set (for update_env)', items: { type: 'object', properties: { key: { type: 'string', description: 'Environment variable key/name', }, value: { type: 'string', description: 'Environment variable value', }, is_sensitive: { type: 'boolean', description: 'Whether this is a sensitive variable (will be hidden in UI)', default: false, }, is_build_time: { type: 'boolean', description: 'Whether this variable is available at build time', default: false, }, }, required: ['key', 'value'], }, }, // Domain parameters domain: { type: 'string', description: 'Domain name to set (for set_domain action)', }, enableHttps: { type: 'boolean', description: 'Whether to enable HTTPS/SSL (for set_domain action)', default: true, }, // Log parameters lines: { type: 'number', description: 'Number of log lines to retrieve (for get_logs action)', default: 100, minimum: 1, maximum: 1000, }, since: { type: 'string', description: 'Retrieve logs since this timestamp (ISO format, for get_logs action)', }, }, required: ['action', 'applicationId'], }, };
- src/index.ts:39-42 (registration)Import of the tool schema and handler function from the unified environment tool module.import { environmentConfigurationTool, handleEnvironmentConfiguration, } from './tools/environment-unified';
- src/index.ts:125-134 (registration)Registration of the tool in the listTools handler, making it discoverable by clients.this.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ applicationManagementTool, environmentConfigurationTool, systemManagementTool, documentationTool, ], }; });
- src/index.ts:153-154 (registration)Registration of the handler dispatch in the CallToolRequestSchema switch statement.case 'coolify_environment_configuration': return await handleEnvironmentConfiguration(this.coolifyClient, args);