Skip to main content
Glama

Coolify MCP Server

by GoCoder7
system.tsโ€ข5.32 kB
/** * Coolify System Management Tools * MCP tools for managing servers, teams, and system-level operations */ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { CoolifyApiClient } from '../utils/coolify-client'; import { GetServersInput, GetTeamsInput, } from '../types/mcp'; /** * Tool: Get Servers * Lists all servers managed by Coolify */ export const getServersTool: Tool = { name: 'coolify_get_servers', description: 'Get list of all servers managed by Coolify, including their status and connection details.', inputSchema: { type: 'object', properties: {}, required: [], }, }; export async function handleGetServers( client: CoolifyApiClient, _args: GetServersInput ): Promise<any> { try { const servers = await client.getServers(); if (servers.length === 0) { return { content: [ { type: 'text', text: '๐Ÿ–ฅ๏ธ No servers found in Coolify.', }, ], }; } const serverList = servers .map(server => `โ€ข ${server.name} (${server.id})\n` + ` IP: ${server.ip}:${server.port}\n` + ` User: ${server.user}\n` + ` Status: ${server.status}` ) .join('\n\n'); return { content: [ { type: 'text', text: `๐Ÿ–ฅ๏ธ Servers (${servers.length} found):\n\n${serverList}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `โŒ Failed to get servers: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } /** * Tool: Get Teams * Lists all teams in Coolify */ export const getTeamsTool: Tool = { name: 'coolify_get_teams', description: 'Get list of all teams in Coolify with their details.', inputSchema: { type: 'object', properties: {}, required: [], }, }; export async function handleGetTeams( client: CoolifyApiClient, _args: GetTeamsInput ): Promise<any> { try { const teams = await client.getTeams(); if (teams.length === 0) { return { content: [ { type: 'text', text: '๐Ÿ‘ฅ No teams found in Coolify.', }, ], }; } const teamList = teams .map(team => `โ€ข ${team.name} (${team.id})\n` + ` Description: ${team.description || 'No description'}` ) .join('\n\n'); return { content: [ { type: 'text', text: `๐Ÿ‘ฅ Teams (${teams.length} found):\n\n${teamList}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `โŒ Failed to get teams: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } /** * Tool: Test Connection * Tests the connection to Coolify instance */ export const testConnectionTool: Tool = { name: 'coolify_test_connection', description: 'Test the connection to the Coolify instance to verify API credentials and connectivity.', inputSchema: { type: 'object', properties: {}, required: [], }, }; export async function handleTestConnection( client: CoolifyApiClient, _args: {} ): Promise<any> { try { const isConnected = await client.testConnection(); if (isConnected) { return { content: [ { type: 'text', text: 'โœ… Connection to Coolify instance successful! API credentials are valid.', }, ], }; } else { return { content: [ { type: 'text', text: 'โŒ Connection to Coolify instance failed. Please check your configuration.', }, ], }; } } catch (error) { return { content: [ { type: 'text', text: `โŒ Connection test failed: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } /** * Tool: Get Services * Lists all services deployed in Coolify */ export const getServicesTool: Tool = { name: 'coolify_get_services', description: 'Get list of all services (databases, caches, etc.) deployed in Coolify.', inputSchema: { type: 'object', properties: {}, required: [], }, }; export async function handleGetServices( client: CoolifyApiClient, _args: {} ): Promise<any> { try { const services = await client.getServices(); if (services.length === 0) { return { content: [ { type: 'text', text: '๐Ÿ› ๏ธ No services found in Coolify.', }, ], }; } const serviceList = services .map(service => `โ€ข ${service.name} (${service.id})\n` + ` Type: ${service.type}\n` + ` Status: ${service.status}` ) .join('\n\n'); return { content: [ { type: 'text', text: `๐Ÿ› ๏ธ Services (${services.length} found):\n\n${serviceList}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `โŒ Failed to get services: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } }

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