Skip to main content
Glama

servers

Manage Coolify servers by listing, creating, updating, deleting, or validating deployments to control infrastructure and applications.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
operationYesOperation to perform
idNoServer UUID
bodyNoJSON request body

Implementation Reference

  • Main execution handler for the 'servers' MCP tool. Implements switch statement for operations: list, get, create, update, delete, validate, resources, domains. Uses safeApiCall wrappers to generated API functions.
    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}`); } }
  • MCP tool registration for 'servers' using McpServer.tool(). Includes inline Zod input schema and async wrapper that calls the core serversHandler, formats response, handles errors.
    // 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 }; } } );
  • JSON Schema definition for servers tool inputs (not used in registration, which uses Zod instead). Defines operations enum and parameters.
    export const serversTool = { name: "servers_tool", description: "Manage server connections, validate connectivity, and monitor resources", inputSchema: { type: "object", properties: { operation: { type: "string", description: "Operation to perform", enum: ["list", "get", "create", "update", "delete", "validate", "resources", "domains"] }, id: { type: "string", description: "Server UUID" }, body: { type: "string", description: "JSON request body" } }, required: ["operation"] }, handler: serversHandler };

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