docker-mcp-server
Automate Docker operations through AI agents with this powerful Model Context Protocol integration.
<<<<<<< HEAD
![]()
Docker MCP Server ๐ณโก
Automate Docker operations through AI agents with this powerful Model Context Protocol integration. Manage containers, monitor deployments, and orchestrate workflows using natural language commands.
Key Features:
- ๐ค AI-powered container lifecycle management
- โก Real-time status monitoring dashboard
- ๐ Seamless Docker API integration via Dockerode
- ๐งฉ Extensible MCP tool ecosystem
- ๐ก JSON schema validation with Zod
Quick Start ๐
# Clone and setup
git clone https://github.com/yourusername/docker-mcp.git
cd docker-mcp
npm install
# Start the MCP server (requires Docker running)
node index.js
Configuration โ๏ธ
// config/docker.config.js
=======
# Docker MCP Server
A Model Context Protocol (MCP) server for Docker container management, providing tools to automate Docker operations through AI agents.
## Features
- Container lifecycle management
- Real-time container status monitoring
- Docker API integration via Dockerode
- MCP protocol implementation for AI-driven automation
## Installation
```bash
cd docker-mcp
npm install
Configuration
Ensure Docker is running and configure connection in config/docker.config.js:
// Example configuration
>>>>>>> 6e98bb6301c09b419ffc162c14b7a36ab249c4ea
export const dockerConfig = {
socketPath: process.env.DOCKER_SOCKET || '/var/run/docker.sock'
};
<<<<<<< HEAD
Global MCP Configuration โก
=======
MCP Configuration โก
6e98bb6301c09b419ffc162c14b7a36ab249c4ea Add the server to your MCP configuration file (
cline_mcp_settings.json):
{
"mcpServers": {
"dockerMcp": {
"command": "node",
<<<<<<< HEAD
"args": ["D:/Lern2025/mcp/docker-mcp/index.js"],
=======
"args": ["docker-mcp/index.js"],
>>>>>>> 6e98bb6301c09b419ffc162c14b7a36ab249c4ea
"env": {},
"disabled": false,
"autoApprove": []
}
}
}
This configuration will:
- Make the Docker MCP server available system-wide
- Auto-start with your development environment
- Allow seamless integration with other MCP tools
<<<<<<< HEAD
MCP Tools Reference ๐ ๏ธ
1. ๐ฃ createConatinerByImage
{
"image_name": "nginx",
"tag": "latest"
}
Spin up new containers from any Docker image
2. ๐ getConatinerById
{
"container_id": "abc123"
}
Get detailed container inspection data
3. ๐ getConatinerStatus
{
"container_id": "abc123"
}
Check real-time status (running/paused/exited)
4. ๐ฎ startPauseOrKill
{
"container_id": "abc123",
"desired_state": "start|pause|kill"
}
Control container states with one command
Usage Example ๐ค
=======
Available MCP Tools
1. createConatinerByImage
{
"image_name": "string",
"tag": "string"
}
Creates a new container from specified image and tag
2. getConatinerById
{
"container_id": "string"
}
Retrieves detailed information about a container
3. getConatinerStatus
{
"container_id": "string"
}
Checks current status of a container (running, paused, exited)
4. startPauseOrKill
{
"container_id": "string",
"desired_state": "start|pause|kill"
}
Manages container state transitions
Usage Example
6e98bb6301c09b419ffc162c14b7a36ab249c4ea
<use_mcp_tool>
<server_name>dockerMcp</server_name>
<tool_name>createConatinerByImage</tool_name>
<arguments>
{
<<<<<<< HEAD
"image_name": "postgres",
"tag": "alpine"
=======
"image_name": "nginx",
"tag": "latest"
>>>>>>> 6e98bb6301c09b419ffc162c14b7a36ab249c4ea
}
</arguments>
</use_mcp_tool>
<<<<<<< HEAD
Security ๐
# For production environments:
export DOCKER_SOCKET="/var/run/docker.sock" # Restrict socket permissions
Contributing ๐ฅ
We welcome contributions! Please follow our contribution guidelines.
Powered by:

Development
# Start the MCP server
node index.js
Dependencies
- @modelcontextprotocol/sdk: MCP SDK
- Dockerode: Docker API client
- Zod: Schema validation
Note: Requires Docker Engine running with exposed Docker socket
6e98bb6301c09b419ffc162c14b7a36ab249c4ea