Enables management of Docker containers through Portainer's API, including listing and inspecting environments, containers, stacks, images, volumes, and networks; viewing container logs; and performing actions like starting, stopping, removing containers, deploying Docker Compose stacks, and managing Docker resources.
Portainer MCP Server
An MCP (Model Context Protocol) server that enables AI assistants like Claude to manage Docker containers through Portainer's API.
Fair Warning: This project has been thoroughly vibe coded. What does that mean? It means I built this for my own personal use and experimentation, guided primarily by vibes and AI-assisted development. Use at your own risk. Feel free to submit issues, but be aware they will be vibe fixed as well. No guarantees, no SLAs, just vibes.
What is this?
This MCP server acts as a bridge between AI models and your Portainer instance. Once connected, your AI assistant can:
List and inspect your Docker environments, containers, stacks, images, volumes, and networks
View container logs
Perform actions like starting, stopping, and removing containers
Deploy new Docker Compose stacks
Manage Docker resources (images, volumes, networks)
All write operations are disabled by default and must be explicitly enabled.
Quick Start
Docker (Recommended)
Node.js
Configuration
Variable | Required | Default | Description |
| Yes | - | Your Portainer instance URL |
| Yes | - | Portainer API access token |
| No |
| Set to |
Getting a Portainer API Key
Log into Portainer
Go to My Account → Access Tokens
Click Add access token
Give it a descriptive name and copy the generated token
Claude Desktop Integration
Add to your Claude Desktop config:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Using Docker
Using Node.js
Available Tools
Read-Only (Always Available)
Tool | Description |
| List all Portainer environments (Docker endpoints) |
| List containers in an environment (optionally include stopped) |
| Get detailed information about a container |
| Get container logs (default 100 lines, max 10,000) |
| List all stacks (optionally filter by environment) |
| Get stack details including the compose file content |
| List Docker images in an environment |
| List Docker volumes in an environment |
| List Docker networks in an environment |
Write Operations (Require PORTAINER_WRITE_ENABLED=true)
Tool | Description |
| Start, stop, restart, kill, or remove a container |
| Start, stop, or remove a stack |
| Create a new Docker Compose stack |
| Pull or remove a Docker image |
| Create or remove a Docker volume |
| Create or remove a Docker network (with optional custom subnet) |
Example Workflows
Check what's running
View logs for a problematic container
Deploy a new stack
Development
Project Structure
Tech Stack
TypeScript - Type safety throughout
@modelcontextprotocol/sdk - MCP protocol implementation
Zod - Runtime validation of tool arguments
Node.js 18+ - Runtime requirement
Docker - Optimized multi-stage build (~148MB image)
License
MIT