Skip to main content
Glama

servers

Manage Coolify deployments programmatically by performing operations like listing, creating, updating, and deleting servers, validating configurations, and handling resources or domains.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNoJSON request body
idNoServer UUID
operationYesOperation to perform

Implementation Reference

  • Registers the 'servers' MCP tool using server.tool(), defining the input schema with Zod and a wrapper async handler that logs args, calls serversHandler, and formats the response or error.
    // Register servers tool with proper Zod schema format server.tool( 'servers', { operation: z.enum([ 'list', 'get', 'create', 'update', 'delete', 'validate', 'resources', 'domains' ]).describe("Operation to perform"), id: z.string().optional().describe("Server UUID"), body: z.string().optional().describe("JSON request body") }, async ({ operation, id, body }) => { try { console.error('Servers tool received args:', JSON.stringify({ operation, id, body }, null, 2)); const result = await serversHandler({ operation, id, body }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { return { content: [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • The core handler function serversHandler that implements the tool logic by switching on the 'operation' parameter and invoking safeApiCall wrappers around generated API functions for list, get, create, update, delete, validate, resources, and domains.
    export async function serversHandler(args: ServersToolArgs) { const { operation, id, body } = args; switch (operation) { case 'list': return await safeApiCall(() => listServers()); case 'get': if (!id) throw new Error('ID required for get operation'); return await safeApiCall(() => getServerByUuid({ path: { uuid: id } })); case 'create': if (!body) throw new Error('Body required for create operation'); const createData = JSON.parse(body); return await safeApiCall(() => createServer({ body: createData })); case 'update': if (!id || !body) throw new Error('ID and body required for update operation'); const updateData = JSON.parse(body); return await safeApiCall(() => updateServerByUuid({ path: { uuid: id }, body: updateData } as any)); case 'delete': if (!id) throw new Error('ID required for delete operation'); return await safeApiCall(() => deleteServerByUuid({ path: { uuid: id } })); case 'validate': if (!id) throw new Error('ID required for validate operation'); return await safeApiCall(() => validateServerByUuid({ path: { uuid: id } })); case 'resources': if (!id) throw new Error('ID required for resources operation'); return await safeApiCall(() => getResourcesByServerUuid({ path: { uuid: id } })); case 'domains': if (!id) throw new Error('ID required for domains operation'); return await safeApiCall(() => getDomainsByServerUuid({ path: { uuid: id } })); default: throw new Error(`Unknown operation: ${operation}`); } }
  • Input schema for the 'servers' tool defined using Zod, specifying 'operation' enum, optional 'id', and optional 'body'.
    { operation: z.enum([ 'list', 'get', 'create', 'update', 'delete', 'validate', 'resources', 'domains' ]).describe("Operation to perform"), id: z.string().optional().describe("Server UUID"), body: z.string().optional().describe("JSON request body") },

Other Tools

Related Tools

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/FelixAllistar/coolify-mcp'

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