Skip to main content
Glama
portainer-mcp-server

portainer-mcp-server

by hlavrencic

portainer-mcp-server

MCP server for the Portainer REST API. Manage Docker containers, stacks, images, networks and volumes from any AI assistant that supports the Model Context Protocol.

Usage

npx portainer-mcp-server

Or with a permanent install:

npm install -g portainer-mcp-server
portainer-mcp-server

Related MCP server: Docker MCP Server

Configuration

Two environment variables are required:

Variable

Description

Default

PORTAINER_URL

Portainer base URL

http://localhost:9000

PORTAINER_PAT

Portainer API token (Personal Access Token)

(required)

To generate a PAT: Portainer UI → Account → Access Tokens → Add access token.

OpenCode / Claude Desktop config

{
  "mcp": {
    "portainer": {
      "type": "local",
      "command": ["npx", "-y", "portainer-mcp-server"],
      "enabled": true,
      "environment": {
        "PORTAINER_URL": "http://your-portainer-host:9000",
        "PORTAINER_PAT": "<your-token>"
      }
    }
  }
}

Available tools

Tool

Description

list_environments

List all Portainer environments/endpoints

list_containers

List containers in an environment

inspect_container

Get detailed info about a container

get_container_logs

Get logs from a container

start_container

Start a stopped container

stop_container

Stop a running container

restart_container

Restart a container

list_stacks

List all Portainer stacks

inspect_stack

Get details of a specific stack

get_stack_file

Get the docker-compose file of a stack

list_images

List Docker images in an environment

list_networks

List Docker networks in an environment

list_volumes

List Docker volumes in an environment

License

MIT

Available Tools

18 tools
delete_imageC

Delete a Docker image

Inputs: imageId (required), environmentId (required), force.

get_container_logsC

Get logs from a container

Inputs: containerId (required), environmentId (required), tail, timestamps.

get_stack_fileA

Get the docker-compose file content of a stack

Inputs: stackId (required).

inspect_containerC

Get detailed info about a container

Inputs: containerId (required), environmentId (required).

inspect_stackC

Get details of a specific stack

Inputs: stackId (required).

list_containersA

List containers in a Portainer environment

Inputs: environmentId (required), all.

list_environmentsA

List all Portainer environments/endpoints

Inputs: no named parameters.

list_imagesB

List Docker images in an environment

Inputs: environmentId (required).

list_networksB

List Docker networks in an environment

Inputs: environmentId (required).

list_stacksA

List all stacks in Portainer

Inputs: no named parameters.

list_volumesB

List Docker volumes in an environment

Inputs: environmentId (required).

portainer_cleanup_unused_imagesB

Delete all unused Docker images with optional force flag

Inputs: environmentId (required), force.

portainer_list_unused_imagesA

List Docker images not used by any container (dangling images)

Inputs: environmentId (required).

pull_imageB

Pull a Docker image from a registry

Inputs: image (required), environmentId (required).

recreate_containerA

Recreate a container with an updated image (stops old container, pulls new image, starts new container)

Inputs: image (required), containerId (required), environmentId (required).

restart_containerC

Restart a container

Inputs: containerId (required), environmentId (required).

start_containerB

Start a stopped container

Inputs: containerId (required), environmentId (required).

stop_containerB

Stop a running container

Inputs: containerId (required), environmentId (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 18 tools

    Disambiguation4/5

    Most tools target distinct resource-action pairs, but list_images and portainer_list_unused_images overlap in purpose, as do delete_image and portainer_cleanup_unused_images. However, the names and descriptions clearly distinguish 'all' vs 'unused' variants, reducing ambiguity.

    Naming Consistency3/5

    The majority follow a verb_noun pattern (list_, get_, inspect_, start_, stop_, etc.), but the two tools prefixed with portainer_ (portainer_list_unused_images, portainer_cleanup_unused_images) break the pattern. The mix of list/get/inspect verbs is also slightly inconsistent, though still readable.

    Tool Count4/5

    18 tools is on the heavier side but reasonable for a Docker/Portainer management server covering environments, containers, images, stacks, networks, and volumes. Each tool serves a distinct purpose, with no apparent duplication.

    Completeness3/5

    The toolset covers container lifecycle (start/stop/restart/recreate), image management (pull/delete/cleanup), and stack inspection, but lacks container removal, stack create/update/delete, and network/volume mutations. These are notable gaps for a comprehensive Portainer manager.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Universal Docker MCP server for AI assistants (Cursor, Claude Desktop). Manage Docker containers, execute commands, query databases, and handle environment configurations — all through natural language.
      10
      277 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Lightweight MCP server for Portainer CE, focused on Docker Swarm environments with read-only tools by default and optional mutations.
      MIT