Skip to main content
Glama
KumarSwarnim19

docker-ops-server

README.md
# πŸš€ AI Assistant for Local Docker & Kubernetes (MCP Agent)

This project connects an AI Assistant (like Claude Desktop) directly to your local **Docker** and **Kubernetes** environment.

Instead of manually running terminal commands, copying logs, and pasting them into a chat window, the AI agent can run commands, check container logs, and inspect cluster health for you in real timeβ€”all with your approval.

---

## 🌟 Why Use This?

* **No More Copy-Pasting Logs:** The AI checks live container and cluster status directly.
* **Safe & Secure:** The AI asks for your permission before running any command on your machine.
* **Easy Debugging:** Helps you troubleshoot local DevOps setups faster.

---

## πŸ“ Project Files

```plaintext
AGENTIC/
β”œβ”€β”€ mcp_server.py          # The backend server that runs Docker/K8s commands
β”œβ”€β”€ agent_with_mcp.py      # Script to run and test the MCP agent
β”œβ”€β”€ agent.py               # Main agent execution script
β”œβ”€β”€ generative_ai.py       # Helper functions for the AI model
β”œβ”€β”€ requirements.txt       # Python libraries needed for this project
└── README.md              # Project documentation
```

---

## ⚑ Quick Setup Guide

### 1. Clone the Repository & Set Up Python

```bash
# Clone this repository

# Create a virtual environment
python -m venv .venv

# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On Mac/Linux:
source .venv/bin/activate

# Install required packages
pip install -r requirements.txt
```

---

## βš™οΈ How to Connect Claude Desktop to Your Local MCP Server

Follow these steps to open the configuration file directly from Claude Desktop:

1. Open **Claude Desktop** on your computer.
2. Click on the **Claude Menu** (top left on macOS or via your Profile/Settings on Windows).
3. Select **Settings...** from the dropdown menu.
4. Go to the **Developer** tab in the left sidebar.
5. Click the **Edit Config** button. This will automatically open or locate the `claude_desktop_config.json` file in your system text editor.
6. Paste the following configuration block into the file:

```json
{
  "mcpServers": {
    "docker-ops-server": {
      "command": "C:\\path\\to\\your\\AGENTIC\\.venv\\Scripts\\python.exe",
      "args": [
        "C:\\path\\to\\your\\AGENTIC\\mcp_server.py"
      ]
    }
  }
}
```

> ⚠️ **Important:** Replace `C:\path\to\your\AGENTIC` with the actual full path to your project folder. Make sure you point directly to the Python interpreter inside `.venv` to prevent connection errors.

7. Save the file and completely restart Claude Desktop for the changes to take effect.

---

## πŸš€ How to Use

1. Make sure Docker Desktop is running on your machine.
2. Open Claude Desktop.
3. Look for the hammer / tool icon at the bottom of the chat boxβ€”this confirms your local MCP tools are active.
4. Ask Claude questions like:
   * "Show me all running Docker containers."
   * "Check the health of my Kubernetes nodes."
5. Click **Allow** when Claude requests permission to run a tool!

---

## πŸ› οΈ Common Issue & Fix

* **Error:** `Server disconnected` in Claude Desktop
   * **Fix:** Open **Settings β†’ Developer** in Claude Desktop and click **View Logs** to check the error stream. Double-check that your path to `.venv\Scripts\python.exe` in `claude_desktop_config.json` is completely accurate.