Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

docker_compose_up

Start and run Docker containers from your docker-compose.yml file to launch development environments and services with options for background operation, selective services, and custom compose files.

Instructions

Create and start containers defined in docker-compose.yml

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
detachNoDetached mode: run in background
buildNoBuild images before starting
servicesNoOnly start specific services
fileNoPath to compose file (default: docker-compose.yml)
cwdNoWorking directory (where docker-compose.yml is located)

Implementation Reference

  • The core handler function that constructs and executes the 'docker compose up' command using dynamic flags based on input arguments and the executeDockerCommand helper.
    export async function dockerComposeUp(args: z.infer<typeof dockerComposeUpSchema>): Promise<ToolResponse> { const detachFlag = args.detach ? '-d' : ''; const buildFlag = args.build ? '--build' : ''; const services = args.services ? args.services.join(' ') : ''; const fileFlag = args.file ? `-f ${args.file}` : ''; const composeCmd = await getComposeCmd(); return executeDockerCommand( `${composeCmd} ${fileFlag} up ${detachFlag} ${buildFlag} ${services}`.trim(), args.cwd ); }
  • Zod schema defining the input validation for the docker_compose_up tool parameters.
    export const dockerComposeUpSchema = z.object({ detach: z.boolean().optional().default(true).describe('Detached mode: run in background'), build: z.boolean().optional().default(false).describe('Build images before starting'), services: z.array(z.string()).optional().describe('Only start specific services'), file: z.string().optional().describe('Path to compose file (default: docker-compose.yml)'), cwd: z.string().optional().describe('Working directory (where docker-compose.yml is located)') });
  • Tool registration entry in the dockerTools array, providing the MCP-compatible tool definition with name, description, and JSON input schema.
    { name: 'docker_compose_up', description: 'Create and start containers defined in docker-compose.yml', inputSchema: { type: 'object', properties: { detach: { type: 'boolean', default: true, description: 'Detached mode: run in background' }, build: { type: 'boolean', default: false, description: 'Build images before starting' }, services: { type: 'array', items: { type: 'string' }, description: 'Only start specific services' }, file: { type: 'string', description: 'Path to compose file (default: docker-compose.yml)' }, cwd: { type: 'string', description: 'Working directory (where docker-compose.yml is located)' } } } },
  • src/index.ts:483-486 (registration)
    Dynamic tool dispatch handler in the main MCP server that routes calls to 'docker_compose_up' by validating arguments with the schema and invoking the handler function.
    if (name === 'docker_compose_up') { const validated = dockerComposeUpSchema.parse(args); return await dockerComposeUp(validated); }
  • Core helper function that executes shell commands (used by dockerComposeUp) and formats output as ToolResponse with success/error handling.
    async function executeDockerCommand(command: string, cwd?: string): Promise<ToolResponse> { try { const { stdout, stderr } = await execAsync(command, { cwd: cwd || process.cwd(), shell: '/bin/bash', maxBuffer: 10 * 1024 * 1024, // 10MB buffer for logs timeout: 60000 // 60 second timeout for builds }); return { content: [ { type: "text" as const, text: JSON.stringify({ success: true, command: command, stdout: stdout.trim(), stderr: stderr.trim(), cwd: cwd || process.cwd() }, null, 2) } ] }; } catch (error: any) { return { content: [ { type: "text" as const, text: JSON.stringify({ success: false, command: command, stdout: error.stdout?.trim() || '', stderr: error.stderr?.trim() || error.message, exitCode: error.code || 1, cwd: cwd || process.cwd() }, null, 2) } ], isError: true }; } }

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/ConnorBoetig-dev/mcp2'

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