What is this?
Portainer MCP Server is an open-source adapter that enables AI assistants and language models to interact with Portainer’s container management APIs via the Modular Chain-of-Prompts (MCP) protocol. By wrapping Portainer’s Docker and Kubernetes orchestration capabilities into a standardized MCP server, developers can control, monitor, and deploy containers using natural language requests.
In the emerging MCP ecosystem, Portainer MCP Server translates high-level prompts into authenticated API calls—spinning up containers, inspecting logs, and scaling services across Docker Swarm, standalone hosts, and Kubernetes clusters. With secure authentication, low-latency WebSockets support, and extensible toolsets, it offers consistent, interactive container orchestration for AI-driven DevOps workflows.
Quick Start
Install the server using npm:
npm install @modelcontextprotocol/server-portainer-mcp
Then add it to your MCP client configuration:
{
"mcpServers": {
"portainer-mcp": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-portainer-mcp"],
"env": {
"API_KEY": "your-api-key-here"
}
}
}
}
Key Features
Feature 1: Natural Language Container Management – issue plain-English commands to deploy, scale, and inspect containers in real time.
Feature 2: Multi-Cluster Support – seamlessly manage Docker Swarm, standalone Docker hosts, and Kubernetes clusters under a unified MCP interface.
Feature 3: Secure Authentication – leverage Portainer’s API keys and role-based access control to ensure each request is authorized.
Example Usage
A common use case is deploying an Nginx stack with three replicas via a single prompt, letting the AI assistant handle all orchestration steps.
// Example code
const result = await client.callTool({
name: "deployStack",
arguments: {
stackFile: "https://example.com/nginx-compose.yml",
replicas: 3
}
});
This code invokes the deployStack tool to deploy an Nginx stack. The response includes the stack ID and deployment status.
Configuration
The server accepts the following environment variables:
API_KEY – Portainer API key used for authentication.
PORTAINER_ENDPOINT – URL of the Portainer server (e.g., https://portainer.example.com).
SESSION_STORE (optional) – Type of session store (in-memory or redis).
Available Tools/Resources
deployStack: Deploys or updates a Docker Compose stack or Kubernetes manifest.
scaleResource: Adjusts the replica count of a service or deployment.
Who Should Use This?
This server is perfect for:
Use case 1: DevOps engineers automating container workflows with AI-driven commands.
Use case 2: AI platform developers bridging large language models with production-grade orchestration.
Use case 3: Teams seeking self-service infrastructure management via chat interfaces.
Conclusion
Portainer MCP Server makes it easy to integrate AI assistants into container orchestration workflows. Try it today to unlock natural language management of your Docker and Kubernetes environments.
Check out the GitHub repository for more information and to contribute.