Portainer MCP connects your AI assistant directly to your Portainer environments, allowing you to manage resources like users and environments, or execute Docker and Kubernetes commands through conversational AI. It implements the Model Context Protocol (MCP) to provide a standardized way to connect AI models with your containerized infrastructure.
You can download pre-built binaries for Linux (amd64, arm64) and macOS (arm64) from the Latest Release Page.
# 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
# Extract the archive
tar -xzf portainer-mcp-v0.2.0-darwin-arm64.tar.gz
# Download the checksum file
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 (for 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, use: md5sum -c portainer-mcp-v0.2.0-linux-amd64.tar.gz.md5
After extraction, move the executable to a location in your $PATH
or note its location for configuration.
{
"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 details and API access token.
If your Portainer version doesn't match the supported version, you can bypass the version check:
{
"mcpServers": {
"portainer": {
"command": "/path/to/portainer-mcp",
"args": [
"-server",
"[IP]:[PORT]",
"-token",
"[TOKEN]",
"-disable-version-check"
]
}
}
}
For enhanced security, you can run in read-only mode which prevents any modifications:
{
"mcpServers": {
"portainer": {
"command": "/path/to/portainer-mcp",
"args": [
"-server",
"[IP]:[PORT]",
"-token",
"[TOKEN]",
"-read-only"
]
}
}
}
You can customize the tool definitions by specifying a custom tools file:
{
"mcpServers": {
"portainer": {
"command": "/path/to/portainer-mcp",
"args": [
"-server",
"[IP]:[PORT]",
"-token",
"[TOKEN]",
"-tools",
"/path/to/custom/tools.yaml"
]
}
}
}
The tool is designed to work with specific Portainer versions:
Portainer MCP Version | Supported Portainer Version |
---|---|
0.1.0 | 2.28.1 |
0.2.0 | 2.28.1 |
0.3.0 | 2.28.1 |
0.4.0 | 2.29.2 |
0.4.1 | 2.29.2 |
0.5.0 | 2.30.0 |
0.6.0 | 2.31.2 |
The MCP server supports various operations on Portainer resources:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "portainer" '{"command":"/path/to/portainer-mcp","args":["-server","[IP]:[PORT]","-token","[TOKEN]","-tools","/tmp/tools.yaml"]}'
See the official Claude Code MCP documentation for more details.
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.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"portainer": {
"command": "/path/to/portainer-mcp",
"args": [
"-server",
"[IP]:[PORT]",
"-token",
"[TOKEN]",
"-tools",
"/tmp/tools.yaml"
]
}
}
}
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.
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"portainer": {
"command": "/path/to/portainer-mcp",
"args": [
"-server",
"[IP]:[PORT]",
"-token",
"[TOKEN]",
"-tools",
"/tmp/tools.yaml"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect