🤖 AI-Powered Kubernetes Assistant with MCP

by bikramjitchawla

210 downloads Not rated yet

About

An AI‑driven Kubernetes assistant that uses the Model Context Protocol (MCP) to accept natural‑language queries and execute safe kubectl and helm commands. It provides a clean web UI, real‑time AI explanations, and a modular tool‑based architecture. Designed for developers and…

Explore

- Convert natural language into safe kubectl/helm commands
- Dynamic tool dispatching via MCP based on user intent
- Tools for logs, rollouts, scaling, port forwarding, and exec
- AI explanation of command outputs and Kubernetes objects
- Built‑in monitoring for pod health, node resources, cluster health
- Helm chart install, upgrade, and uninstall support

Send natural‑language queries through the web UI. The server exposes an /api/mcp endpoint that routes requests through the tool router and optionally the LLM (Groq/OpenAI). Tools are implemented in /tools and registered centrally in tool.ts. No manual command‑line configuration is required beyond starting the server.

naturalLanguageKubectl

Parse and run safe Kubernetes commands.

logsFetcher

Fetch pod logs.

rolloutChecker

Monitor deployment rollout status.

scaleDeployment

Scale deployments up/down.

namespaceAnalyzer

Analyze namespaces.

explain_kubectl_result

AI explanation of command outputs.

kubectlExplain

Explain Kubernetes object fields.

portForwardPod

Port forward from a pod to your local machine.

execCommandInPod

Execute shell commands in a pod.

getPodEvents

Get Kubernetes event history for a pod.

monitoringTool

Check pod health, node resource usage, cluster health, etc.

helmTool

Install, upgrade, or uninstall Helm charts.

createPodTool

Dynamically generate and deploy pods from templates or custom specs.

Each Kubernetes operation is modularized as a tool, invoked dynamically via MCP based on user intent.

naturalLanguageKubectl — Parse and run safe Kubernetes commands.
logsFetcher — Fetch pod logs.
rolloutChecker — Monitor deployment rollout status.
scaleDeployment — Scale deployments up/down.
namespaceAnalyzer — Analyze namespaces.
explain_kubectl_result — AI explanation of command outputs.
kubectlExplain — Explain Kubernetes object fields.
portForwardPod — Port forward from a pod to your local machine.
execCommandInPod — Execute shell commands in a pod.
getPodEvents — Get Kubernetes event history for a pod.
monitoringTool — Check pod health, node resource usage, cluster health, etc.
helmTool — Install, upgrade, or uninstall Helm charts.

  • createPodTool — Dynamically generate and deploy pods from templates or custom specs.


> 🗂 Tools are located in /tools and registered centrally in tool.ts.

---

An AI-driven Kubernetes assistant built using Model Context Protocol (MCP) that enables natural language interaction with your Kubernetes cluster. It supports dynamic tooling, safe command generation, Helm integration, and real-time AI explanations — all from a clean web UI.

---

🚀 Key Features

🧠 Natural Language Kubernetes Control

Convert natural language queries into safe kubectl/helm commands using Groq/OpenAI (LLM).
Auto-validates generated commands (get, describe, logs, top, etc.).
Fallback mechanism for unsupported or unsafe commands.

🔧 Tool-Based Architecture

Each Kubernetes operation is modularized as a tool, invoked dynamically via MCP based on user intent.

🛠️ Available Tools

naturalLanguageKubectl — Parse and run safe Kubernetes commands.
logsFetcher — Fetch pod logs.
rolloutChecker — Monitor deployment rollout status.
scaleDeployment — Scale deployments up/down.
namespaceAnalyzer — Analyze namespaces.
explain_kubectl_result — AI explanation of command outputs.
kubectlExplain — Explain Kubernetes object fields.
portForwardPod — Port forward from a pod to your local machine.
execCommandInPod — Execute shell commands in a pod.
getPodEvents — Get Kubernetes event history for a pod.
monitoringTool — Check pod health, node resource usage, cluster health, etc.
helmTool — Install, upgrade, or uninstall Helm charts.
createPodTool — Dynamically generate and deploy pods from templates or custom specs.

> 🗂 Tools are located in /tools and registered centrally in tool.ts.

---

🧬 Architecture

User Query (UI)
      ↓
   /api/mcp
      ↓
 +-------------+
 |  MCPServer  |
 +-------------+
     ↓       ↘
 Tool Router   LLM Agent (Groq/OpenAI)
     ↓             ↓
 Tool Handler → kubectl / helm
     ↓             ↓
   Response    (Optional AI Explanation)
      ↓
    UI Renderer

---

🧪 Example Prompts

General Use

"Get all pods not in running state."
"Show logs for pod nginx-deployment-abc123 in namespace default."
"Port-forward traefik pod port 80 to local port 8080."
"Explain what kubectl get namespaces shows."

Monitoring

"Check if any pods are failing their liveness probe."
"What is the current CPU and memory usage across nodes?"

  • "List top resource-consuming pods."

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.