K8s Warning Monitor MCP
MCP server that filters Kubernetes warning/failure events and presents them to AI assistants for diagnostics. Enables AI to identify and troubleshoot cluster issues without consuming context on normal events.
README
<div align="center"> <h1>🚨 K8s Warning Monitor MCP</h1> <p><b>A custom Model Context Protocol (MCP) server for intelligent Kubernetes cluster diagnostics.</b></p>
</div>
📖 Overview
The K8s Warning Monitor is a purpose-built Model Context Protocol (MCP) server that acts as a targeted diagnostic bridge between your local Kubernetes cluster (like Minikube) and AI coding assistants (like Cline or Roo Code).
Instead of flooding the AI's context window with thousands of normal cluster scheduling events, this tool strictly filters for Warning or Failed events. It parses the data into clean, formatted text, allowing your AI to instantly understand what is currently broken in your environment without wasting tokens.
✨ Features
- 🎯 Context-Optimized: Only returns actionable warnings (e.g.,
ImagePullBackOff,CrashLoopBackOff,FailedScheduling). - 🐳 Fully Dockerized: Runs ephemerally as an interactive Docker container.
- 🪟 Windows 11 & Minikube Friendly: Includes the exact configuration needed to route container traffic back to a Windows host's Minikube cluster via
host.docker.internal. - ⚡ Automated Lifecycle: The AI spins the container up to execute the tool, communicates via standard streams (
stdio), and the--rmflag cleans it up immediately after.
🛠️ Prerequisites
Before you begin, ensure you have the following installed on your machine:
- Docker Desktop (running)
- Minikube (or any local/remote Kubernetes cluster)
- kubectl configured and authenticated
- VS Code with the Cline (or equivalent MCP-compatible) extension
🚀 Setup & Installation
1. Clone the Repository
git clone https://github.com/your-username/k8s-warning-monitor.git
cd k8s-warning-monitor
2. Build the Docker Image
Build the lightweight Node.js Alpine container:
docker build -t mcp-k8s-warnings .
3. Prepare the Docker-Friendly Kubeconfig
Because Docker containers have their own isolated network loopback, we need to create a flattened kubeconfig that allows the container to talk to your host's Minikube.
Generate the flattened config (embeds certificates directly):
kubectl config view --raw --minify --flatten > kubeconfig-docker
⚠️ CRITICAL MINIKUBE FIX:
Open kubeconfig-docker in your editor. Locate the server: address (it usually points to https://127.0.0.1:<port>).
Change 127.0.0.1 to host.docker.internal.
Example:
# Change this:
server: https://127.0.0.1:58253
# To this:
server: https://host.docker.internal:58253
4. Connect to Cline (VS Code)
Open your MCP settings in VS Code (cline_mcp_settings.json) and add the server configuration.
Note: Update the D:\study\... volume path to match your absolute clone directory.
{
"mcpServers": {
"warning-monitor-docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"D:\path\to\your\clone\k8s-warning-monitor\kubeconfig-docker:/root/.kube/config:ro",
"mcp-k8s-warnings"
]
}
}
}
🤖 Usage Examples
Once configured, reload your VS Code window. Open your AI chat interface and try the following prompts:
🗣️ "Using the warning-monitor-docker tool, get my cluster errors."
🗣️ "Check if there are any failing pods in the cluster, then suggest a fix for the highest priority warning."
🗣️ "Run a cluster health check using the warning monitor tool."
🔒 Security & Architecture Note
Is this safe to run? The TypeScript code executing inside this container is strictly read-only. It only utilizes the @kubernetes/client-node API to perform listEventForAllNamespaces() requests. The AI has no programmed capability to modify, delete, or create resources through this specific MCP server.
However, the container itself inherits your privileges.
Because the installation mounts your local, flattened kubeconfig-docker file into the container, the Docker process has the same cluster administrative rights as your local user. For strict enterprise security, you should replace the flattened config with one utilizing a restricted Kubernetes ServiceAccount bound to a ClusterRole that only permits "get, list, watch" verbs.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.