home / mcp / portainer mcp server
Bridges AI assistants with Portainer to manage Docker environments, containers, stacks, and networks via MCP.
Configuration
View docs{
"mcpServers": {
"caffeineflo-portainer-mcp": {
"command": "docker",
"args": [
"run",
"--rm",
"-e",
"PORTAINER_URL=https://portainer.example.com",
"-e",
"PORTAINER_API_KEY=ptr_your_key_here",
"ghcr.io/caffeineflo/portainer-mcp:latest"
],
"env": {
"PORTAINER_URL": "https://portainer.example.com",
"PORTAINER_API_KEY": "ptr_your_key_here",
"PORTAINER_WRITE_ENABLED": "true"
}
}
}
}This MCP server acts as a bridge between AI assistants and your Portainer instance, letting you list, inspect, and manage Docker environments, containers, stacks, images, volumes, and networks through Portainerβs API. You can perform read operations by default and enable write actions when you need to deploy or modify resources.
Connect your MCP client to the Portainer MCP Server to start listing resources and, when enabled, performing actions. You can browse environments, containers, stacks, images, volumes, and networks, view container logs, and deploy new Docker Compose stacks. All write operations are disabled by default and must be explicitly enabled to prevent accidental changes.
Prerequisites: you need Docker or Node.js installed on the host where youβll run the MCP server. You will also need a Portainer instance with an API key to authorize actions.
# Option 1: Run via Docker (recommended)
docker run --rm \
-e PORTAINER_URL=https://portainer.example.com \
-e PORTAINER_API_KEY=ptr_your_key_here \
ghcr.io/caffeineflo/portainer-mcp:latest
```
```bash
# Option 2: Run with Node.js
pnpm install
pnpm build
PORTAINER_URL=https://portainer.example.com \
PORTAINER_API_KEY=ptr_your_key_here \
node dist/index.jsConfiguration involves providing your Portainer URL and API key to the MCP server. You can enable write operations by setting the PORTAINER_WRITE_ENABLED variable to true. The server supports both HTTP-based remote configuration and local runtime execution via Node.js.
List all Portainer environments (Docker endpoints) with their IDs and basic metadata.
List containers within an environment, with an option to include stopped containers.
Retrieve detailed information about a specific container, including status and configuration.
Fetch logs for a container, with tail and max line options.
List all Docker Compose stacks across environments, with optional environment filtering.
Get detailed information about a stack, including the compose content.
List Docker images available in an environment.
List Docker volumes in an environment.
List Docker networks in an environment.
Start, stop, restart, kill, or remove a container.
Start, stop, or remove a stack.
Deploy a new Docker Compose stack from compose content.
Pull or remove a Docker image.
Create or remove a Docker volume.
Create or remove a Docker network, with optional custom subnet.