Portainer Container Management MCP server

Provides a bridge between AI and Portainer container management platform, enabling environment monitoring, access control management, and stack deployment through Docker and Kubernetes API proxying
Back to servers
Provider
Portainer
Release date
Apr 22, 2025
Language
Go
Stats
9 stars

Portainer MCP connects your AI assistant directly to your Portainer environments, enabling you to manage Portainer resources like users and environments or execute Docker and Kubernetes commands through AI interactions. This tool implements the Model Context Protocol (MCP) to standardize connections between Portainer's container management capabilities and AI models.

Installation

You can download pre-built binaries for Linux (amd64) and macOS (arm64) from the Latest Release Page.

Download and Setup

  1. Download the appropriate archive for your system:
# Example for macOS (ARM64) - adjust version and architecture as needed
curl -Lo portainer-mcp-v0.2.0-darwin-arm64.tar.gz https://github.com/portainer/portainer-mcp/releases/download/v0.2.0/portainer-mcp-v0.2.0-darwin-arm64.tar.gz
  1. Optionally verify the checksum:
# Download the checksum file (adjust version/arch)
curl -Lo portainer-mcp-v0.2.0-darwin-arm64.tar.gz.md5 https://github.com/portainer/portainer-mcp/releases/download/v0.2.0/portainer-mcp-v0.2.0-darwin-arm64.tar.gz.md5

# Verify (macOS)
if [ "$(md5 -q portainer-mcp-v0.2.0-darwin-arm64.tar.gz)" = "$(cat portainer-mcp-v0.2.0-darwin-arm64.tar.gz.md5)" ]; then echo "OK"; else echo "FAILED"; fi

# For Linux
# md5sum -c portainer-mcp-v0.2.0-linux-amd64.tar.gz.md5
  1. Extract the archive:
# Adjust the filename based on the downloaded version/OS/architecture
tar -xzf portainer-mcp-v0.2.0-darwin-arm64.tar.gz
  1. Move the executable to a location in your $PATH or note its location for configuration.

Usage

Configuration with Claude Desktop

Configure Claude Desktop with the following settings:

{
    "mcpServers": {
        "portainer": {
            "command": "/path/to/portainer-mcp",
            "args": [
                "-server",
                "[IP]:[PORT]",
                "-token",
                "[TOKEN]",
                "-tools",
                "/tmp/tools.yaml"
            ]
        }
    }
}

Replace [IP], [PORT], and [TOKEN] with your Portainer instance's IP address, port, and API access token.

Tool Customization

You can customize the tool definitions by specifying a custom tools file path:

{
    "mcpServers": {
        "portainer": {
            "command": "/path/to/portainer-mcp",
            "args": [
                "-server",
                "[IP]:[PORT]",
                "-token",
                "[TOKEN]",
                "-tools",
                "/path/to/custom/tools.yaml"
            ]
        }
    }
}

By default, the tool definitions are embedded in the binary, and the application will create a tools file at the default location if one doesn't exist.

Read-Only Mode

For enhanced security, enable read-only mode to prevent any modifications to your Portainer resources:

{
    "mcpServers": {
        "portainer": {
            "command": "/path/to/portainer-mcp",
            "args": [
                "-server",
                "[IP]:[PORT]",
                "-token",
                "[TOKEN]",
                "-read-only"
            ]
        }
    }
}

In read-only mode:

  • Only read operations (list, get) are available
  • Write operations (create, update, delete) are disabled
  • Docker and Kubernetes proxy requests are disabled

Version Compatibility

Portainer MCP is version-specific and validates the Portainer server version at startup.

Portainer MCP Version Supported Portainer Version
0.1.0 2.28.1
0.2.0 2.28.1
0.3.0 2.28.1

Supported Features

The latest version supports the following operations:

Environments

  • ListEnvironments - List all available environments
  • UpdateEnvironmentTags - Update environment tags
  • UpdateEnvironmentUserAccesses - Update user access policies
  • UpdateEnvironmentTeamAccesses - Update team access policies

Environment Groups

  • ListEnvironmentGroups - List all environment groups
  • CreateEnvironmentGroup - Create a new environment group
  • UpdateEnvironmentGroupName - Update group name
  • UpdateEnvironmentGroupEnvironments - Update associated environments
  • UpdateEnvironmentGroupTags - Update group tags

Access Groups

  • ListAccessGroups - List all access groups
  • CreateAccessGroup - Create a new access group
  • UpdateAccessGroupName - Update group name
  • UpdateAccessGroupUserAccesses - Update user accesses
  • UpdateAccessGroupTeamAccesses - Update team accesses
  • AddEnvironmentToAccessGroup - Add environment to group
  • RemoveEnvironmentFromAccessGroup - Remove environment from group

Stacks

  • ListStacks - List all stacks
  • GetStackFile - Get compose file for a stack
  • CreateStack - Create a new Docker stack
  • UpdateStack - Update an existing Docker stack

Tags

  • ListEnvironmentTags - List all environment tags
  • CreateEnvironmentTag - Create a new environment tag

Teams

  • ListTeams - List all teams
  • CreateTeam - Create a new team
  • UpdateTeamName - Update team name
  • UpdateTeamMembers - Update team members

Users

  • ListUsers - List all users
  • UpdateUser - Update an existing user
  • GetSettings - Get Portainer instance settings

Docker & Kubernetes

  • DockerProxy - Proxy any Docker API requests
  • KubernetesProxy - Proxy any Kubernetes API requests

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later