Skip to main content
Glama
GoCoder7
by GoCoder7

coolify_environment_configuration

Configure environment variables, set domains, and retrieve application logs for Coolify-hosted applications to manage deployment settings and monitor performance.

Instructions

Manage environment variables, configure domains, and retrieve application logs

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform: update env vars, get env vars, set domain, or get logs
applicationIdYesApplication ID (required for all actions)
variablesNoArray of environment variables to set (for update_env)
domainNoDomain name to set (for set_domain action)
enableHttpsNoWhether to enable HTTPS/SSL (for set_domain action)
linesNoNumber of log lines to retrieve (for get_logs action)
sinceNoRetrieve logs since this timestamp (ISO format, for get_logs action)

Implementation Reference

  • Main handler function that dispatches environment configuration actions (update_env, get_env, set_domain, get_logs) using CoolifyApiClient methods.
    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
        };
      }
    }
  • Tool definition including input schema for parameters like action, applicationId, variables array, domain, logs options.
    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:125-134 (registration)
    Registers the tool in the MCP server's list of available tools.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          applicationManagementTool,
          environmentConfigurationTool,
          systemManagementTool,
          documentationTool,
        ],
      };
    });
  • src/index.ts:153-154 (registration)
    Registers the handler dispatch in the tool call switch statement.
    case 'coolify_environment_configuration':
      return await handleEnvironmentConfiguration(this.coolifyClient, args);
  • src/index.ts:39-42 (registration)
    Imports the tool definition and handler for registration.
    import {
      environmentConfigurationTool,
      handleEnvironmentConfiguration,
    } from './tools/environment-unified';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GoCoder7/coolify-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server