compose_cp
Copy files or folders between a Docker Compose service container and the host filesystem. Specify source and destination as either SERVICE:PATH or a local path, with options for replicas and compose project settings.
Instructions
Copy files/folders between a service container and the server host's filesystem.
Exactly one of source/dest is SERVICE:PATH; the other is a path on the host running this
MCP server, read/written as the server's user (same host exposure as the file-path archive
tools — see SECURITY.md). Copying to stdout (dest="-") is unsupported; use
container_archive_get.
Does not raise on a non-zero CLI exit — inspect returncode/stderr in the result. With no local
compose plugin and an ssh:// target, runs the real docker compose cp on that host instead and
relays whichever side of the copy is local over the same SSH connection — every parameter above
behaves the same either way, since the actual copy always runs through the real CLI. The one
difference: a container->host copy is refused with FileExistsError if the local destination already
exists, since only this host (not the remote one) knows that. unix:///tcp://+TLS hosts with no
local plugin are not covered by this fallback (no shell to run the CLI on) and still raise
RuntimeError — use container_archive_put (host to container) or container_archive_get_to_file
(container to host) there instead; both talk to the daemon directly and need no local CLI
(compose_ps gives you the container name).
args:
source - SERVICE:SRC_PATH or a host path
dest - SERVICE:DEST_PATH or a host path (not "-")
index - Container index when the service has multiple replicas (default 1)
all_containers - Copy to/from all containers of the service (--all)
project_dir - Dir with the compose file (default: server cwd; copied to the target host if no local plugin)
files - Explicit compose file paths (repeatable, -f)
project_name - Compose project name override
timeout_seconds - Subprocess timeout (default 300s)
returns: dict - {"returncode": int, "stdout": str, "stderr": str, "truncated": bool}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dest | Yes | ||
| files | No | ||
| index | No | ||
| source | Yes | ||
| project_dir | No | ||
| project_name | No | ||
| all_containers | No | ||
| timeout_seconds | No |