Portainer MCP server — manage Docker, Kubernetes, stacks, and Helm via the Model Context Protocol.
Project description
Portainer MCP
Official MCP server for Portainer, generated from the Portainer OpenAPI spec via FastMCP.
Overview
This MCP server exposes the Portainer REST API as MCP tools: list and inspect environments, manage GitOps workflows, troubleshoot Docker and Kubernetes resources. It also supports proxying requests to the underlying Docker and K8s APIs of each environment.
Match the MCP server's minor version to your Portainer instance's minor — e.g. MCP server 2.42.x with Portainer 2.42.x. See Version compatibility for details.
Getting started
The MCP server can be executed locally via uvx or as a container.
Use the first approach to explore the MCP capabilities locally and deploy it inside your infrastructure as a container for a team based deployment setup.
[!NOTE] Before using the MCP, make sure to generate an API key in Portainer under My Account → Access tokens first as both paths need it.
Single user (stdio via uvx)
The recommended way to test the MCP server locally. Runs as a stdio process on your machine and connects directly to the Portainer instance.
[!NOTE]
uvmust be installed and available onPATH. See the uv install docs.
Register with Claude Code:
claude mcp add portainer \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_API_KEY=ptr_xxxxxxxxxxxxxxxx \
-- uvx --from "mcp-portainer~=2.42.0" mcp-portainer
[!NOTE] Set
PORTAINER_TLS_VERIFY=0if your Portainer instance uses self-signed TLS certificates.
For other clients, see
docs/distribution/.
Contributions for other client instructions are welcome!
Team deployment (container)
The recommended way to have multiple users interacting with your Portainer instance via MCP. Deployed as a container inside your infrastructure, accessed by users from their workstations over HTTP, gated by a shared bearer secret.
[!IMPORTANT] The container terminates HTTP, NOT HTTPS, and serves auth as a single shared bearer. The secret can be intercepted on any path between client and server without TLS termination.
It is NOT recommended to expose this MCP server on the public internet.
Even with a TLS-terminating reverse proxy in front, the recommendation is to gate this MCP server inside your private infrastructure.
Run the MCP server as a container in your infrastructure:
docker run -d --name portainer-mcp -p 17717:17717 \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_API_KEY=ptr_xxxxxxxxxxxxxxxx \
-e PORTAINER_MCP_AUTH_TOKEN="$(openssl rand -hex 32)" \
-e PORTAINER_MCP_ALLOWED_HOSTS=mcp.example.com:17717 \
portainer/portainer-mcp:2.42
Set PORTAINER_MCP_ALLOWED_HOSTS to the hostname or IP address that users will use to reach the MCP — otherwise the DNS-rebinding allowlist 421-rejects the request.
PORTAINER_MCP_AUTH_TOKEN is required in HTTP mode. It provides the key to gate access to the MCP, distribute this token to the users; their MCP client will send it via the Authorization header.
Adding the MCP endpoint on Claude Code:
claude mcp add portainer --transport http http://mcp.example.com:17717/mcp --header "Authorization: Bearer <token>"
Hygiene skill (recommended)
This repo ships a Claude Code skill (portainer-mcp-hygiene) that helps the model query the MCP efficiently and keep responses within context. Install user-wide, pinned to the same tag as the server:
mkdir -p ~/.claude/skills/portainer-mcp-hygiene && \
curl -fsSL https://raw.githubusercontent.com/portainer/portainer-mcp/2.42.0/skills/portainer-mcp-hygiene/SKILL.md \
-o ~/.claude/skills/portainer-mcp-hygiene/SKILL.md
It is recommended to re-run on each server upgrade so the skill stays in sync.
Restricting and expanding the MCP server capabilities
The MCP server comes with the following capabilities enabled by default:
- Basic Portainer operation support (settings, version, environments...)
- Docker operation support
- Kubernetes operation support
- Docker and Kubernetes proxy support
- Redacting environment variables values (enabled by default)
For restricting or expanding this set of capabilities, see docs/profiles.md.
Version compatibility
Match the MCP server's minor to your Portainer minor. The major+minor tracks the Portainer API version the embedded spec targets.
| Server version | Portainer (CE / EE) |
|---|---|
2.42.x |
2.42.x |
2.41.x |
2.41.x |
For more information about the versioning policy, see docs/versioning.md.
Configuration
The MCP server exposes different capabilities such as:
- Enable different set of tools based on specific profile configuration
- Widen the API coverage by specifying extra tags to cover
- Expose only read-only capabilities
- Disable proxy capabilities
For more information about the MCP server configuration, refer to docs/configuration.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_portainer-2.42.4.tar.gz.
File metadata
- Download URL: mcp_portainer-2.42.4.tar.gz
- Upload date:
- Size: 242.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ade83396fe23876bf200f16ebea0b65e2baba735167656452927f0cf2f400e55
|
|
| MD5 |
bf08231323997b8e17683bd3cbce77ee
|
|
| BLAKE2b-256 |
4c434abf73eef9a7c205215112cb88d2f642ac588b2f3a99428c651eb26f9d69
|
Provenance
The following attestation bundles were made for mcp_portainer-2.42.4.tar.gz:
Publisher:
release.yml on portainer/portainer-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_portainer-2.42.4.tar.gz -
Subject digest:
ade83396fe23876bf200f16ebea0b65e2baba735167656452927f0cf2f400e55 - Sigstore transparency entry: 1700525524
- Sigstore integration time:
-
Permalink:
portainer/portainer-mcp@d4d1268a5a7d1a1c412bc01423c0a930a64776b3 -
Branch / Tag:
refs/tags/2.42.4 - Owner: https://github.com/portainer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d4d1268a5a7d1a1c412bc01423c0a930a64776b3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcp_portainer-2.42.4-py3-none-any.whl.
File metadata
- Download URL: mcp_portainer-2.42.4-py3-none-any.whl
- Upload date:
- Size: 132.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20aed5e5af05cb5a2c1abc0b7c69da5d99d1eb883cb575df462a149b699e4a8b
|
|
| MD5 |
ab4ef389ac72bb200384fa2ee604ed7a
|
|
| BLAKE2b-256 |
c4e6e1d67789db317ea07c8f45a972dbc835045761c2206ce90c6227d981a6d0
|
Provenance
The following attestation bundles were made for mcp_portainer-2.42.4-py3-none-any.whl:
Publisher:
release.yml on portainer/portainer-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_portainer-2.42.4-py3-none-any.whl -
Subject digest:
20aed5e5af05cb5a2c1abc0b7c69da5d99d1eb883cb575df462a149b699e4a8b - Sigstore transparency entry: 1700525542
- Sigstore integration time:
-
Permalink:
portainer/portainer-mcp@d4d1268a5a7d1a1c412bc01423c0a930a64776b3 -
Branch / Tag:
refs/tags/2.42.4 - Owner: https://github.com/portainer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d4d1268a5a7d1a1c412bc01423c0a930a64776b3 -
Trigger Event:
push
-
Statement type: