Skip to main content
Glama

Coolify MCP Server

by GoCoder7
applications-unified.tsโ€ข5.8 kB
/** * Unified Coolify Application Management Tools * Consolidated MCP tools for managing Coolify applications */ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { CoolifyApiClient } from '../utils/coolify-client'; /** * Unified Application Management Tool * Combines all application operations into a single tool */ export const applicationManagementTool: Tool = { name: 'coolify_application_management', description: 'Comprehensive application management: deploy, get info, list, check status, start/stop/restart, or create applications', inputSchema: { type: 'object', properties: { action: { type: 'string', enum: ['deploy', 'get', 'list', 'status', 'start', 'stop', 'restart', 'create'], description: 'Action to perform on applications', }, applicationId: { type: 'string', description: 'Application ID (required for most actions except list/create)', }, // Deploy parameters force: { type: 'boolean', description: 'Force deployment even if another is in progress', default: false, }, branch: { type: 'string', description: 'Git branch to deploy', }, // List parameters serverId: { type: 'string', description: 'Filter applications by server ID', }, status: { type: 'string', enum: ['running', 'stopped', 'building', 'error'], description: 'Filter by application status', }, // Create parameters name: { type: 'string', description: 'Application name (for create action)', }, description: { type: 'string', description: 'Application description (for create action)', }, git_repository: { type: 'string', description: 'Git repository URL (for create action)', }, git_branch: { type: 'string', description: 'Git branch (for create action)', }, build_pack: { type: 'string', description: 'Build pack to use (for create action)', }, }, required: ['action'], }, }; export async function handleApplicationManagement( coolifyClient: CoolifyApiClient, args: any ): Promise<any> { try { const { action, applicationId, ...params } = args; let result; let message; switch (action) { case 'deploy': if (!applicationId) throw new Error('applicationId is required for deploy action'); result = await coolifyClient.deployApplication(applicationId, { force: params.force, branch: params.branch }); message = `Deployment triggered for application ${applicationId}`; break; case 'get': if (!applicationId) throw new Error('applicationId is required for get action'); result = await coolifyClient.getApplication(applicationId); message = `Retrieved application ${applicationId}`; break; case 'list': result = await coolifyClient.getApplications(); // Filter locally if parameters provided if (params.serverId || params.status) { result = result.filter((app: any) => { if (params.serverId && app.serverId !== params.serverId) return false; if (params.status && app.status !== params.status) return false; return true; }); } message = `Found ${result.length} applications`; break; case 'status': if (!applicationId) throw new Error('applicationId is required for status action'); result = await coolifyClient.getApplicationStatus(applicationId); message = `Retrieved status for application ${applicationId}`; break; case 'start': if (!applicationId) throw new Error('applicationId is required for start action'); result = await coolifyClient.startApplication(applicationId); message = `Started application ${applicationId}`; break; case 'stop': if (!applicationId) throw new Error('applicationId is required for stop action'); result = await coolifyClient.stopApplication(applicationId); message = `Stopped application ${applicationId}`; break; case 'restart': if (!applicationId) throw new Error('applicationId is required for restart action'); result = await coolifyClient.restartApplication(applicationId); message = `Restarted application ${applicationId}`; break; case 'create': if (!params.name || !params.git_repository || !params.serverId) { throw new Error('name, git_repository, and serverId are required for create action'); } result = await coolifyClient.createApplication({ name: params.name, description: params.description, git_repository: params.git_repository, git_branch: params.git_branch, build_pack: params.build_pack, }); message = `Created application ${params.name}`; break; default: throw new Error(`Unknown application 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 }; } } // Export unified tools export const applicationTools = [applicationManagementTool];

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