portainer-mcp

v0.9.0
portainer-mcp Checked 13 hours ago Published 8 days ago

MCP server that gives AI assistants 53 tools to manage Portainer: deploy and update stacks, inspect and roll out Swarm services/tasks/nodes, manage containers…

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

portainer_status

Check Portainer connection and authentication status. Also reports how many endpoints Portainer knows and whether the default endpoint is a Swarm cluster — the first thing an agent needs to decide between the service-level and container-level tools.

portainer_endpoints_list

List all Portainer environments (endpoints).

portainer_endpoint_inspect

Get details of a specific Portainer environment (endpoint). Args: endpoint_id: The ID of the endpoint to inspect

ParameterTypeDescription
endpoint_id *integer

portainer_stacks_list

List all Portainer stacks.

portainer_stack_inspect

Get details of a stack including its compose file content. Credential-looking values (stack Env variables named like *PASSWORD, *SECRET, *TOKEN, *KEY, ... and inline environment values in the compose file) are masked as [REDACTED] unless reveal_env=true. Always inspect with reveal_env=true before resending the compose file through portainer_stack_update — a masked file is rejected. Args: stack_id: The ID of the stack to inspect reveal_env: Return credential values unmasked (default false)

ParameterTypeDescription
stack_id *integer
reveal_envboolean

portainer_stack_deploy

Deploy a new stack from a docker-compose string. Args: name: Name of the new stack compose_content: Docker Compose file content (YAML string) env: Stack environment variables (substituted into the compose file by Portainer), e.g. {"DB_PASSWORD": "..."} endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
compose_content *string
name *string
endpoint_id
env

portainer_stack_update

Update (redeploy) an existing stack. The stack's stored Env variables are always preserved: Portainer replaces the whole Env list on every update, so this tool reads the current list first and merges your changes into it. Omit every optional argument to simply redeploy the stack as it is. To pick up a newly pushed build of a `:latest` image, pass pull_image=true — a plain redeploy reuses the image already on the nodes. Args: stack_id: The ID of the stack to update compose_content: New Docker Compose co…

ParameterTypeDescription
stack_id *integer
compose_content
detach_from_gitboolean
endpoint_id
env
env_remove
prune
pull_image

portainer_stack_delete

Delete a stack. Args: stack_id: The ID of the stack to delete endpoint_id: Endpoint ID (derived from the stack itself if omitted)

ParameterTypeDescription
stack_id *integer
endpoint_id

portainer_stack_start

Start a stopped stack. Args: stack_id: The ID of the stack to start endpoint_id: Endpoint ID (derived from the stack itself if omitted)

ParameterTypeDescription
stack_id *integer
endpoint_id

portainer_stack_stop

Stop a running stack. Args: stack_id: The ID of the stack to stop endpoint_id: Endpoint ID (derived from the stack itself if omitted)

ParameterTypeDescription
stack_id *integer
endpoint_id

portainer_containers_list

List containers on an endpoint, with their stack and service. On a Swarm endpoint prefer portainer_services_list / stack_status — containers there are task instances that come and go. Args: endpoint_id: Target endpoint ID (uses default if omitted) show_all: If true, show all containers including stopped ones name_filter: Only return containers whose name contains this substring (server-side Docker filter) stack_filter: Only return containers belonging to this stack (Swarm namespace or Co…

ParameterTypeDescription
endpoint_id
name_filter
show_allboolean
stack_filter

portainer_container_inspect

Get detailed information about a container. Args: container_id: Container ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id

portainer_container_start

Start a stopped container. Args: container_id: Container ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id

portainer_container_stop

Stop a running container. Args: container_id: Container ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id

portainer_container_restart

Restart a container. Args: container_id: Container ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id

portainer_container_remove

Remove a container. Args: container_id: Container ID or name force: Force removal of a running container (default false) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id
forceboolean

portainer_container_logs

Get container logs. Args: container_id: Container ID or name tail: Number of lines from the end of the logs (default 100, max 1000) since: Only lines newer than this: a duration ("10m", "2h", "1d"), a Unix timestamp or an ISO-8601 datetime timestamps: Prefix every line with its timestamp (default false) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id
since
tailinteger
timestampsboolean

portainer_container_logs_grep

Search container logs for lines matching a regex pattern. Returns only matching lines (with optional context). Useful for finding specific errors, status codes, or keywords. With `since`, the MCP server scans the time window even after reaching the match limit. Args: container_id: Container ID or name pattern: Regex pattern to search for (case-insensitive) tail: Lines to fetch without since (default 500, max 1000) context_lines: Lines of context around each match (default 0, max 5) since: Only scan li…

ParameterTypeDescription
container_id *string
pattern *string
context_linesinteger
endpoint_id
max_bytesinteger
max_matchesinteger
since
tailinteger
timestampsboolean
until

portainer_stack_logs_errors

Scan all running containers in a stack for errors. Looks for HTTP 4xx/5xx, exceptions, fatal/critical/emergency log levels, panics, OOM, PHP errors, and similar patterns. Window scans find running replicas by stack labels or legacy names, share a byte limit across replicas, and report coverage and failures by service. Args: stack_name: Stack name prefix (e.g. "taylor", "blog", "somnlyx") tail: Lines to scan per container without since (default 500, max 1000) endpoint_id: Target endpoint ID (uses default if omitted)…

ParameterTypeDescription
stack_name *string
endpoint_id
max_bytesinteger
max_matchesinteger
since
tailinteger
until

portainer_container_stats

Get live CPU, memory, and network stats for a container. Args: container_id: Container ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
endpoint_id

portainer_container_exec

Execute a command inside a running container and return its output. Args: container_id: Container ID or name command: Shell command to execute (run via sh -c) workdir: Working directory inside the container user: User to run the command as (e.g. 'root', '1000:1000') endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
command *string
container_id *string
endpoint_id
user
workdir

portainer_services_list

List Swarm services with running/desired replica counts. On a Swarm endpoint this is the primary view (like `docker service ls`): services are the stable units, containers are their tasks. Cron-driven services (swarm-cronjob) carry `cron: true` and their last run's outcome instead of a meaningful replica count. Args: endpoint_id: Target endpoint ID (uses default if omitted) stack_filter: Only services of this stack (exact stack name)

ParameterTypeDescription
endpoint_id
stack_filter

portainer_service_inspect

Get the full Swarm service definition (spec, update status, endpoint). Credential-looking environment values in the container spec are masked as [REDACTED] unless reveal_env=true. Args: service_id: Service ID or name (e.g. "arena-etl_backend") reveal_env: Return credential values unmasked (default false) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
service_id *string
endpoint_id
reveal_envboolean

portainer_service_tasks

List a service's tasks with state, node and error (`docker service ps`). The first place to look when replicas are not coming up: a task's `error` carries the scheduler / container start failure ("no suitable node", "task: non-zero exit (1)", image pull errors, ...). Args: service_id: Service ID or name limit: Max tasks to return, newest per slot first (default 50, max 500) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
service_id *string
endpoint_id
limitinteger

portainer_service_logs

Get logs of a Swarm service (all its tasks, across nodes). With `since` and an explicit `until`, `max_matches` or `max_bytes`, scans the window and returns its most recent lines in timestamp order. Swarm applies the lower bound. The MCP server applies the upper bound to the timestamped records and counts downloaded bytes toward the limit. Args: service_id: Service ID or name tail: Lines to fetch in tail mode (default 100, max 1000) since: Only lines newer than this: a duration ("10m", "2h", "1d"), a U…

ParameterTypeDescription
service_id *string
endpoint_id
max_bytes
max_matches
since
tailinteger
timestampsboolean
until

portainer_service_update

Update a Swarm service: change its image, scale it, or force a restart. Reads the current spec and version, applies the requested changes and submits the spec back (rolling update per the service's UpdateConfig). At least one of image / replicas / force_restart is required. Follow up with portainer_service_wait to know when the rollout converged. To roll out a new build of the same `:latest` tag, pass image= "<repo>:<tag>" without a digest — Swarm resolves the tag to its current digest at update time. force_restart alone re-creates th…

ParameterTypeDescription
service_id *string
endpoint_id
force_restartboolean
image
registry_id
replicas

portainer_service_rollback

Roll a Swarm service back to its previous spec (`docker service rollback`). Works only while Swarm still holds a PreviousSpec (i.e. after at least one update). Follow up with portainer_service_wait. Args: service_id: Service ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
service_id *string
endpoint_id

portainer_service_wait

Wait for a service's rollout to converge after an update/rollback. Polls until the service is healthy (running == desired and the update finished), the update paused on failure, or the timeout elapses. Returns the final service summary with `converged`, `reason`, `timed_out` and the recent task errors. Args: service_id: Service ID or name timeout_seconds: How long to wait (default 120, clamped to 5..PORTAINER_LONG_TIMEOUT) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
service_id *string
endpoint_id
timeout_secondsinteger

portainer_nodes_list

List Swarm nodes with role, availability, state and resources. Args: endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
endpoint_id

portainer_secrets_list

List Swarm secrets (names and metadata only — never the values). Args: endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
endpoint_id

portainer_configs_list

List Swarm configs (names and metadata only — never the content). Args: endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
endpoint_id

portainer_stack_status

Health summary of a stack: every service with running/desired replicas, update state and the most recent task failures. Start here when asked "is stack X ok / why is X down". Works on Swarm (services + tasks) and falls back to container states on a standalone Compose endpoint. Cron-driven services are judged on their last run, and only failures newer than the last good task are reported. Args: stack_name: Stack name (Swarm namespace / Compose project) endpoint_id: Target endpoint ID (uses default if omitted)…

ParameterTypeDescription
stack_name *string
endpoint_id

portainer_stack_wait

Wait for a stack's rollout to converge after stack_update. Polls portainer_stack_status until every service is healthy, a service's update paused on failure, or the timeout elapses. Returns the final status with `converged`, `reason` and `timed_out`. Args: stack_name: Stack name (Swarm namespace / Compose project) timeout_seconds: How long to wait (default 120, clamped to 5..PORTAINER_LONG_TIMEOUT) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
stack_name *string
endpoint_id
timeout_secondsinteger

portainer_images_list

List Docker images on an endpoint. Args: endpoint_id: Target endpoint ID (uses default if omitted) reference_filter: Only return images matching this reference (e.g. 'nginx' or 'nginx:1.25'; server-side Docker filter)

ParameterTypeDescription
endpoint_id
reference_filter

portainer_image_inspect

Get detailed information about a Docker image. Args: image_id: Image ID or name:tag endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
image_id *string
endpoint_id

portainer_image_pull

Pull a Docker image from a registry. Credentials for a registry configured in Portainer are supplied by Portainer itself: the registry is picked automatically by matching the image's host against portainer_registries_list (Docker Hub images match a DockerHub-type registry), or explicitly via registry_id. registry_id=0 forces an anonymous pull. No password ever passes through the model. Explicit registry_auth is only needed for a registry Portainer does not know. Args: image_name: Image name (e.g. 'nginx', 'ghcr.io/or…

ParameterTypeDescription
image_name *string
endpoint_id
registry_auth
registry_id
tagstring

portainer_image_remove

Remove a Docker image. Args: image_id: Image ID or name:tag endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
image_id *string
endpoint_id

portainer_registries_list

List registries configured in Portainer (id, name, URL, type). Use the id as registry_id in portainer_image_pull / portainer_service_update so Portainer supplies the stored credentials.

portainer_volumes_list

List Docker volumes on an endpoint. Args: endpoint_id: Target endpoint ID (uses default if omitted) name_filter: Only return volumes whose name contains this substring (server-side Docker filter)

ParameterTypeDescription
endpoint_id
name_filter

portainer_volume_inspect

Get detailed information about a Docker volume. Args: volume_name: Volume name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
volume_name *string
endpoint_id

portainer_volume_create

Create a Docker volume. Args: name: Volume name driver: Volume driver (default 'local') labels: Optional labels as key-value pairs endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
name *string
driverstring
endpoint_id
labels

portainer_volume_remove

Remove a Docker volume. Args: volume_name: Volume name force: Force removal even if in use (default false) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
volume_name *string
endpoint_id
forceboolean

portainer_networks_list

List Docker networks on an endpoint. Args: endpoint_id: Target endpoint ID (uses default if omitted) name_filter: Only return networks whose name contains this substring (server-side Docker filter)

ParameterTypeDescription
endpoint_id
name_filter

portainer_network_inspect

Get detailed information about a Docker network. Args: network_id: Network ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
network_id *string
endpoint_id

portainer_network_create

Create a Docker network. Args: name: Network name driver: Network driver (default 'bridge'; use 'overlay' for Swarm) internal: Restrict external access (default false) labels: Optional labels as key-value pairs endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
name *string
driverstring
endpoint_id
internalboolean
labels

portainer_network_remove

Remove a Docker network. Args: network_id: Network ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
network_id *string
endpoint_id

portainer_network_connect

Connect a container to a network. Args: network_id: Network ID or name container_id: Container ID or name endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
network_id *string
endpoint_id

portainer_network_disconnect

Disconnect a container from a network. Args: network_id: Network ID or name container_id: Container ID or name force: Force disconnect (default false) endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
container_id *string
network_id *string
endpoint_id
forceboolean

portainer_docker_info

Get Docker system information for an endpoint (OS, CPU, memory, containers count, etc). Args: endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
endpoint_id

portainer_docker_disk_usage

Get Docker disk usage (containers, images, volumes, build cache). Args: endpoint_id: Target endpoint ID (uses default if omitted)

ParameterTypeDescription
endpoint_id

portainer_docker_prune

Reclaim disk space: remove stopped containers, unused images or build cache. Volumes are never pruned by this tool (that destroys data); use portainer_volume_remove for a specific volume. Check portainer_docker_disk_usage first to see what is reclaimable. Args: target: "containers" (all stopped), "images" (dangling only, or every unused image with all_images=true) or "build_cache" all_images: For target="images": also remove tagged images not used by any container (default false — dangling layers only)…

ParameterTypeDescription
target *string
all_imagesboolean
endpoint_id

portainer_users_list

List all Portainer users.

portainer_user_inspect

Get details of a specific Portainer user. Args: user_id: The ID of the user to inspect

ParameterTypeDescription
user_id *integer