Portainer MCP
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.45.x with Portainer 2.45.x. See Version compatibility for details.
Intended use
Portainer MCP is intended for evaluation, homelabs, and other non-production use. It is not supported in business, production, or any other environment where uptime, security posture, or data integrity matter. There is no SLA, no guaranteed response to issues, no further feature development, and no roadmap commitment. If you run it, you are choosing to self-support.
For a supported way to use an LLM with Portainer, use Portainer Command (Business Edition, including the free 3-node license).
Getting started
The MCP server supports different deployment scenarios:
- execute it locally via
uvx - install it as a MCP bundle
- deploy it as a container
Use the uvx approach or the MCP bundle to explore the MCP capabilities locally and deploy it inside your infrastructure as a container for a team based deployment setup.
MCP bundle (one-click install)
A convenient way to try the MCP server locally. Your client must support MCP bundles:
- Fetch the self-contained
.mcpbbundle for your platform from the latest release - Double-click to install
- Enter your Portainer URL and API key.
Single user (stdio via uvx)
The other way to test the MCP server locally. Runs as a stdio process on your machine and connects directly to the Portainer instance.
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.45.0" mcp-portainer
For other clients, see
docs/distribution/.
Team deployment (container)
A 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 HTTPS. A shared secret gates the MCP server and every client also forwards its own Portainer API key so that each user acts under their own Portainer identity.
See more info below about the different deployment scenarios. For any of these scenarios:
- Set
PORTAINER_MCP_ALLOWED_HOSTSto 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_TOKENis required in HTTP mode. It's the shared front-gate secret you distribute to your users; their MCP client sends it via theAuthorizationheader. It only admits the request — what each user can do is governed by their own Portainer API key. The one exception: behind an identity-aware proxy that owns theAuthorizationheader, usePORTAINER_MCP_TRUST_PROXY_AUTH=1instead (see Option D).
Option A - BYO certificates
Deploy the container to use your own set of TLS certificates:
TOKEN=$(openssl rand -hex 32)
docker run -d --name portainer-mcp -p 17717:17717 \
-v /etc/portainer-mcp/tls:/tls:ro \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_MCP_AUTH_TOKEN="$TOKEN" \
-e PORTAINER_MCP_ALLOWED_HOSTS=mcp.example.com:17717 \
-e PORTAINER_MCP_TLS_CERT=/tls/cert.pem \
-e PORTAINER_MCP_TLS_KEY=/tls/key.pem \
portainer/portainer-mcp:2.45
Then connect your client:
claude mcp add portainer --transport http https://mcp.example.com:17717/mcp \
--header "Authorization: Bearer <gate-token>" \
--header "X-Portainer-API-Key: <ptr_user_key>"
Option B - TLS-terminated reverse proxy
BYO proxy and set up a TLS-terminated proxy in front of the container:
TOKEN=$(openssl rand -hex 32)
docker run -d --name portainer-mcp \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_MCP_AUTH_TOKEN="$TOKEN" \
-e PORTAINER_MCP_ALLOWED_HOSTS=mcp.example.com \
-e PORTAINER_MCP_TRUST_PROXY_TLS=1 \
-e PORTAINER_MCP_FORWARDED_ALLOW_IPS=172.18.0.0/16 \
portainer/portainer-mcp:2.45
Then connect your client:
claude mcp add portainer --transport http https://mcp.example.com/mcp \
--header "Authorization: Bearer <gate-token>" \
--header "X-Portainer-API-Key: <ptr_user_key>"
Option C - Plaintext HTTP
Use the PORTAINER_MCP_DANGEROUSLY_ALLOW_PLAINTEXT_HTTP=1 flag to start the server with HTTP only.
TOKEN=$(openssl rand -hex 32)
docker run -d --name portainer-mcp -p 17717:17717 \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_MCP_AUTH_TOKEN="$TOKEN" \
-e PORTAINER_MCP_ALLOWED_HOSTS=mcp.example.com:17717 \
-e PORTAINER_MCP_DANGEROUSLY_ALLOW_PLAINTEXT_HTTP=1 \
portainer/portainer-mcp:2.45
Then connect your client:
claude mcp add portainer --transport http http://mcp.example.com:17717/mcp \
--header "Authorization: Bearer <gate-token>" \
--header "X-Portainer-API-Key: <ptr_user_key>"
Option D - Identity-aware proxy (MCP OAuth)
If your users authenticate through an identity-aware proxy that speaks the MCP OAuth flow (such as Pomerium in MCP server mode), the proxy mints its own access token and owns the Authorization header. Declare the trust-proxy auth posture instead of PORTAINER_MCP_AUTH_TOKEN:
docker run -d --name portainer-mcp \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_MCP_TRUST_PROXY_AUTH=1 \
-e PORTAINER_MCP_ALLOWED_HOSTS=mcp.example.com \
-e PORTAINER_MCP_TRUST_PROXY_TLS=1 \
-e PORTAINER_MCP_FORWARDED_ALLOW_IPS=172.18.0.0/16 \
portainer/portainer-mcp:2.45
No gate token is configured: the request is admitted by proxy attestation (it must arrive from PORTAINER_MCP_FORWARDED_ALLOW_IPS — inherited as the trust boundary, * refuses to boot) and by the caller's validated Portainer key. If the MCP server terminates TLS itself instead of the proxy, set PORTAINER_MCP_TRUSTED_PROXY_AUTH_IPS=<proxy ip/cidr> in place of the two TRUST_PROXY_TLS/FORWARDED_ALLOW_IPS lines. See docs/configuration.md for the full posture rules.
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.45.x |
2.45.x |
2.44.x |
2.44.x |
2.43.x |
2.43.x |
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
- Tuning the transport capabilities and configuring the TLS posture
- Logging configuration
For more information about the MCP server configuration, refer to docs/configuration.md.
Getting help
Portainer MCP has no official support channel. Issues may be filed on GitHub, but doing so does not create any obligation on the project to respond, triage, or fix them.
There is no supported version of Portainer MCP; it is provided as-is and without warranty.
Metadata
Release files for mcp-portainer 2.45.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_portainer-2.45.3.tar.gz | 396.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_portainer-2.45.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 637.3 kB
Release files / mcp_portainer-2.45.3.tar.gz
| Download URL | mcp_portainer-2.45.3.tar.gz |
|---|---|
| Size | 396.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8aa04e4caf7659eb1d4b89eb75e4f19e2e739bfa344f496b3111f6269caacedd
|
|
BLAKE2b-256 checksum How to use checksums |
e7e5f1363cb5f051e3f6f72f9ba9c7f85b68993d59e7f11ca6a261b73e4fa977
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logRelease files / mcp_portainer-2.45.3-py3-none-any.whl
| Download URL | mcp_portainer-2.45.3-py3-none-any.whl |
|---|---|
| Size | 240.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff825e3d1f6e1ee6fb41325e5a434d320624d5a56feb88a4223c1a1baf3ca4ea
|
|
BLAKE2b-256 checksum How to use checksums |
dd264f5537ca03814928254d73fef10d0a04537b2f1920cd8656e44b1b20b248
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logSecurity for mcp-portainer 2.45.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mcp_portainer-2.45.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.