Skip to main content
Glama
mcp-docker-compose

mcp-docker-compose

by Ricrdoss

mcp-docker-compose

An open-source Model Context Protocol (MCP) server that gives AI coding agents safe, structured access to local Docker Compose services, logs, configuration inspection, and service restarts.

Security Guarantees

  • No shell execution: All docker compose commands are invoked directly via node:child_process execFile with explicit argument arrays—never exec or shell string concatenation. Flag-like arguments (-...) are rejected.

  • Automatic secret redaction: Sensitive environment variables (PASSWORD, SECRET, TOKEN, API_KEY, PRIVATE_KEY, ACCESS_KEY, AUTH, DSN, DATABASE_URL), bearer tokens, and embedded URI credentials (e.g., postgres://user:pass@host) are automatically replaced with [REDACTED] in both compose_inspect_config and compose_get_logs.

  • Non-destructive toolset: Exposes only read/inspection tools and single-service graceful restarts—no down, rm, prune, or exec operations.

  • Output & timeout safety: Commands enforce configurable timeouts and maxBuffer limits, and log output is capped at 20,000 characters.

Related MCP server: docker-compose-mcp

Quick Start

Run directly with npx (requires Node.js >= 20 and Docker Compose v2):

npx -y mcp-docker-compose

Client Configuration

Claude Code

Add to your project .mcp.json or ~/.claude.json:

{
  "mcpServers": {
    "docker-compose": {
      "command": "npx",
      "args": ["-y", "mcp-docker-compose"]
    }
  }
}

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "docker-compose": {
      "command": "npx",
      "args": ["-y", "mcp-docker-compose"]
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project or global Cursor settings:

{
  "mcpServers": {
    "docker-compose": {
      "command": "npx",
      "args": ["-y", "mcp-docker-compose"]
    }
  }
}

Tools Reference

Tool

Description

Parameters

compose_list_services

Lists services with state, health status, and published ports.

composeFile?: string, cwd?: string

compose_get_logs

Fetches recent logs with secret redaction, optional error filtering, and 20k-char truncation.

service?: string, tail?: number (1–500, default 100), errorsOnly?: boolean (default false), composeFile?: string, cwd?: string

compose_inspect_config

Inspects resolved service config (image, redacted environment, ports, depends_on).

service?: string, composeFile?: string, cwd?: string

compose_restart_service

Gracefully restarts a single service with a shutdown timeout.

service: string (required), timeoutSeconds?: number (1–120, default 10), composeFile?: string, cwd?: string

Development

npm install
npm run lint
npm run build
npm test

License

MIT

Available Tools

4 tools
compose_get_logsGet Docker Compose Logs
Read-only

Fetch recent Docker Compose logs with automatic secret redaction, optional error filtering, and 20,000-char safety truncation.

Inputs: cwd, tail, service, errorsOnly, +1 more.

compose_inspect_configInspect Docker Compose Config
Read-only

Inspect resolved Docker Compose service configuration (image, redacted environment variables, ports, and depends_on).

Inputs: cwd, service, composeFile.

compose_list_servicesList Docker Compose Services
Read-only

List local Docker Compose services with their state, health status, and published ports.

Inputs: cwd, composeFile.

compose_restart_serviceRestart Docker Compose Service
Idempotent

Restart a single Docker Compose service with a configurable graceful shutdown timeout.

Inputs: service (required), cwd, composeFile, timeoutSeconds.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers