# Portainer MCP for AI Agents AI Agent Connect

> Portainer MCP. Manage Docker containers and environments through your AI agent. List, create, and start containers or manage remote endpoints directly from your chat interface without switching tabs.

## Overview
- **Category:** ship-it
- **Price:** Free
- **Endpoint:** https://edge.vinkius.com/vk_preview_vAtyUqdwLcdumic07vZOqC4647ETb6UK429Uaxij/ai-agent-connect
- **Tags:** docker, kubernetes, container-management, orchestration, infrastructure-as-code

## Description

This Portainer MCP lets you handle all those Docker and Kubernetes tasks directly through your AI client. Instead of manually navigating the Portainer UI, you can just tell your agent to list your current services or deploy a new image with specific port mappings. It works by connecting to your existing Portainer instance, giving your agent the permissions it needs to manage your infrastructure. When you're setting up your workspace, you'll find it's a lot faster to have the AI handle the repetitive configuration work. It's part of the massive library of tools available on Vinkius, where you can connect your preferred AI client once to access thousands of different services. You can manage local dev environments or remote production clusters with the same set of commands, making it a go-to for keeping your infrastructure organized without the constant context switching. Whether you're checking the health of a database, spinning up a new staging environment, or managing multiple remote endpoints, the agent handles the heavy lifting. You get to stay in your flow while the Connector manages the technical details of your containerized ecosystem. It's built for people who need to move fast and want to interact with their infrastructure using natural language instead of a dozen different dashboard clicks.

## Tools

### init_admin
Set the initial admin password for a fresh Portainer installation. It speeds up the initial setup process.

### list_docker_containers
See all containers currently running in a specific environment. Use this to get a quick status overview.

### add_endpoint
Add a new Docker or Kubernetes environment to your Portainer setup. This helps you manage multiple clusters in one place.

### authenticate
Get a secure JWT token to authorize your agent's actions. This keeps your connection private and valid.

### create_docker_container
Deploy a new container from a specific image with custom settings. You can define ports and host configurations easily.

### start_docker_container
Turn on a container that is currently stopped. This is useful for restarting services after maintenance.

## Prompt Examples

**Prompt:** 
```
Show me what's running on my dev cluster.
```

**Response:** 
```
I've checked your dev cluster. Here is the current status of your containers:

| Container Name | Status | Image |
| :--- | :--- | :--- |
| nginx-proxy | Running | nginx:latest |
| db-postgres | Running | postgres:14 |
| redis-cache | Stopped | redis:alpine |
| app-worker | Running | my-app:v2 |
```

**Prompt:** 
```
Spin up a new redis instance on port 6379.
```

**Response:** 
```
I've deployed the new redis container for you.

- **Name**: redis-instance
- **Image**: redis:alpine
- **Port Mapping**: 6379:6379
- **Status**: Created successfully.

Would you like me to start it now?
```

**Prompt:** 
```
Is the web-proxy container active?
```

**Response:** 
```
Yes, the `nginx-proxy` container is currently running. It's active and reachable on its assigned ports.
```

## Capabilities

### List active containers
See every container currently running in a specific environment at a glance.

### Deploy new images
Spin up new containers from images with custom port and host settings.

### Boot up stopped services
Turn on containers that are currently paused or stopped with a single command.

### Connect remote environments
Add new Docker or Kubernetes endpoints to your existing Portainer setup.

### Set up admin access
Initialize the admin password for fresh Portainer installations automatically.

### Secure your connection
Handle JWT tokens to authorize your agent's actions securely.

## Use Cases

### Checking cluster health
An engineer asks the agent to show all running containers on a dev cluster. The agent uses list_docker_containers to provide a real-time status table.

### Rapid staging deployment
A developer needs a new redis instance on a specific port. The agent uses create_docker_container to launch it with the correct host settings.

### Multi-cluster management
A sysadmin wants to add a new production endpoint. The agent uses add_endpoint to link the new environment to the existing Portainer setup.

### Service recovery
A container crashes and stops. The user tells the agent to restart it, and the agent uses start_docker_container to bring it back online.

## Benefits

- Stop switching tabs by using list_docker_containers to check service status instantly from your agent.
- Deploy faster with create_docker_container to spin up new images with specific port and host settings.
- Manage remote clusters easily by using add_endpoint to bring new environments into your workflow.
- Secure your infrastructure by using authenticate to handle JWT tokens without manual copy-pasting.
- Simplify setup by using init_admin to handle the first-time configuration of new Portainer instances.
- Keep services running by using start_docker_container to boot up paused containers with a simple command.

## How It Works

The bottom line is you get a direct chat interface for your entire Docker and Kubernetes infrastructure.

1. Subscribe to the Portainer MCP and grab your Portainer URL and API Key.
2. Plug those credentials into your AI client's connection settings.
3. Ask your agent to list containers, deploy new ones, or manage your endpoints.

## Frequently Asked Questions

**Does Portainer MCP work with my existing Docker setup?**
Yes, it connects to your current Portainer instance. You just need to provide your URL and API key to give your agent the necessary permissions.

**Can I manage multiple remote servers with Portainer MCP?**
Yes, you can use the add_endpoint tool to bring new remote Docker or Kubernetes environments into your management workflow.

**Is it safe to use Portainer MCP for production?**
Yes, it uses the authenticate tool to handle secure JWT tokens. This ensures that your agent's actions are authorized and encrypted.

**Can I deploy new images using Portainer MCP?**
Yes, you can tell your agent to deploy a new image using the create_docker_container tool, specifying your desired ports and host settings.

**How do I set up the first admin for Portainer MCP?**
You can use the init_admin tool to set the initial admin password for a fresh Portainer installation directly through your agent.

**What happens if a container stops?**
Your agent can check the status via list_docker_containers and you can tell it to restart the service using the start_docker_container tool.

**How do I see all containers running in a specific environment?**
Use the `list_docker_containers` tool by providing the specific `endpoint_id`. The agent will return a list of all containers managed within that Portainer environment.

**Can I add a new remote Docker endpoint through the AI?**
Yes! Use the `add_endpoint` action. You can specify the name, set the type to 2 (Remote), and provide the URL (e.g., tcp://10.0.0.1:2375) to connect a new environment.

**Is it possible to deploy a container with specific port mappings?**
Yes. When using `create_docker_container`, you can provide a `config_json` string containing standard Docker API parameters like `ExposedPorts` or `HostConfig` to define your network and port requirements.