Skip to main content
Glama

Docker Compose Management

docker_compose

Manage Docker Compose services to start, stop, monitor, and control multi-container applications through the Docker MCP Server.

Instructions

Manage Docker Compose services

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesDocker Compose action to perform
serviceNoSpecific service name (optional)
detachNoRun in detached mode
buildNoBuild images before starting (for up action)

Implementation Reference

  • src/index.ts:1816-1876 (registration)
    Registration of the 'docker_compose' MCP tool, including schema and inline handler function.
    server.registerTool(
      "docker_compose",
      {
        title: "Docker Compose Management",
        description: "Manage Docker Compose services",
        inputSchema: {
          action: z.enum(["up", "down", "logs", "ps", "restart", "build"]).describe("Docker Compose action to perform"),
          service: z.string().optional().describe("Specific service name (optional)"),
          detach: z.boolean().optional().default(true).describe("Run in detached mode"),
          build: z.boolean().optional().describe("Build images before starting (for up action)")
        }
      },
      async ({ action, service, detach, build }) => {
        try {
          let command: string;
          const serviceArg = service ? ` ${service}` : "";
          
          switch (action) {
            case "up":
              command = `docker-compose up${detach ? " -d" : ""}${build ? " --build" : ""}${serviceArg}`;
              break;
            case "down":
              command = `docker-compose down${serviceArg}`;
              break;
            case "logs":
              command = `docker-compose logs${serviceArg}`;
              break;
            case "ps":
              command = "docker-compose ps";
              break;
            case "restart":
              command = `docker-compose restart${serviceArg}`;
              break;
            case "build":
              command = `docker-compose build${serviceArg}`;
              break;
          }
          
          const result = await executeDockerCommand(command);
          
          return {
            content: [
              {
                type: "text",
                text: `Docker Compose ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error with Docker Compose: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • The handler function that constructs and executes docker-compose commands based on the input action (up, down, logs, ps, restart, build). Uses the shared executeDockerCommand helper.
    async ({ action, service, detach, build }) => {
      try {
        let command: string;
        const serviceArg = service ? ` ${service}` : "";
        
        switch (action) {
          case "up":
            command = `docker-compose up${detach ? " -d" : ""}${build ? " --build" : ""}${serviceArg}`;
            break;
          case "down":
            command = `docker-compose down${serviceArg}`;
            break;
          case "logs":
            command = `docker-compose logs${serviceArg}`;
            break;
          case "ps":
            command = "docker-compose ps";
            break;
          case "restart":
            command = `docker-compose restart${serviceArg}`;
            break;
          case "build":
            command = `docker-compose build${serviceArg}`;
            break;
        }
        
        const result = await executeDockerCommand(command);
        
        return {
          content: [
            {
              type: "text",
              text: `Docker Compose ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error with Docker Compose: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • The input schema defining parameters for the docker_compose tool: action (required enum), optional service, detach, and build flags.
    {
      title: "Docker Compose Management",
      description: "Manage Docker Compose services",
      inputSchema: {
        action: z.enum(["up", "down", "logs", "ps", "restart", "build"]).describe("Docker Compose action to perform"),
        service: z.string().optional().describe("Specific service name (optional)"),
        detach: z.boolean().optional().default(true).describe("Run in detached mode"),
        build: z.boolean().optional().describe("Build images before starting (for up action)")
      }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Manage Docker Compose services' implies mutation capabilities (e.g., 'up', 'down', 'restart'), but it doesn't specify permissions required, side effects, error handling, or output format. For a tool with multiple actions including potentially destructive ones, this lack of detail is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with a single sentence ('Manage Docker Compose services'), which is front-loaded and wastes no words. However, this conciseness comes at the cost of detail, but for scoring this dimension alone, it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (multiple actions with potential mutations), lack of annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects, usage context, or output expectations, leaving significant gaps for an AI agent to understand how to invoke it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter interactions (e.g., 'build' only applies to 'up'), constraints, or examples. Baseline 3 is appropriate when the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Manage Docker Compose services' states a general purpose but is vague about what 'manage' entails. It doesn't specify the specific actions available (up, down, logs, etc.) or distinguish it from sibling tools like 'docker_compose_advanced' or 'execute_docker_command'. The verb 'manage' is too broad for clear differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites, context for choosing specific actions, or how it differs from sibling tools like 'docker_compose_advanced' or 'execute_docker_command'. The description offers no usage context beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/TauqeerAhmad5201/docker-mcp-extension'

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