Docker MCP Server
About
MCP Server for docker container creation and code execution
Details
- Author
- zaycruz
- GitHub stars
- 5
- Downloads
- 429
- Categories
- Cloud Service
Jump to
- Isolated code execution in Docker containers
- Multi-language support with any Docker image
- Run simple commands and multi-line scripts
- Package management via pip, npm, apt-get, or apk
- Create, list, and clean up containers easily
- Graceful timeout management and fallback mechanisms
- Clear, color-coded console feedback
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Docker MCP ServerCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install Python 3.9+, Docker, and the fastmcp library. Clone the repository, create a virtual environment, and install requirements. Run python run_server.py to open the MCP Inspector at http://localhost:5173. Use the provided tools (list containers, create container, add dependencies, execute code, execute Python script, cleanup container) to run code in Docker. Integrate with Claude by running fastmcp install src/docker_mcp.py.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"docker mcp server": {
"DockerManager": {
"command": "python3",
"args": [
"{REPOSITORY_PATH}/src/docker_mcp.py"
]
}
}
}
}
McpServers
{
"DockerManager": {
"command": "python3",
"args": [
"{REPOSITORY_PATH}/src/docker_mcp.py"
]
}
}
Docker MCP Server
A powerful Model Context Protocol (MCP) server that executes code in isolated Docker containers and returns the results to language models like Claude.
Features
- Isolated Code Execution: Run code in Docker containers separated from your main system
- Multi-language Support: Execute code in any language with a Docker image
- Complex Script Support: Run both simple commands and complete multi-line scripts
- Package Management: Install dependencies using pip, npm, apt-get, or apk
- Container Management: Create, list, and clean up Docker containers easily
- Robust Error Handling: Graceful timeout management and fallback mechanisms
- Colorful Output: Clear, color-coded console feedback
Requirements
- Python 3.9+
- Docker installed and running
- fastmcp library
Installation
1. Clone this repository:
git clone https://github.com/yourusername/docker_mcp_server.git
cd docker_mcp_server
2. Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install required packages:
pip install -r requirements.txt
Usage
Running the MCP Inspector
To test and explore the server's functionality:
python run_server.py
The MCP Inspector interface will open in your browser at http://localhost:5173.
Available Tools
The Docker MCP server provides the following tools:
1. List Containers
Lists all Docker containers and their details:
- Parameters:
- show_all: (Optional) Whether to show all containers including stopped ones (default: True)
2. Create Container
Creates and starts a Docker container with optional dependencies:
- Parameters:
- image: The Docker image to use (e.g., "python:3.9-slim", "node:16")
- container_name: A unique name for the container
- dependencies: (Optional) Space-separated list of packages to install (e.g., "numpy pandas", "express lodash")
3. Add Dependencies
Installs additional packages in an existing Docker container:
- Parameters:
- container_name: The name of the target container
- dependencies: Space-separated list of packages to install
4. Execute Code
Executes a command inside a running Docker container:
- Parameters:
- container_name: The name of the target container
- command: The command to execute inside the container
5. Execute Python Script
Executes a multi-line Python script inside a running Docker container:
- Parameters:
- container_name: The name of the target container
- script_content: The full Python script content
- script_args: Optional arguments to pass to the script
6. Cleanup Container
Stops and removes a Docker container:
- Parameters:
- container_name: The name of the container to clean up
Examples
Basic Workflow Example
```python
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.

