k8s-rca-mcp
Read-only diagnostic access to a Kubernetes cluster via least-privilege RBAC (get/list/watch only, no secrets, no write verbs): lists pods with phases, restart counts and waiting/termination reasons, fetches sanitized Warning/Normal events, retrieves previous container logs with credential redaction and prompt-injection filtering, lists ReplicaSets for rollout/image history, and correlates all evidence into a structured, evidence-cited RCA report with safe recommended next steps.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
k8s-rca-mcp
Read-only Model Context Protocol (MCP) server and automated 15-scenario chaos evaluation harness for Kubernetes root-cause analysis—enforcing least-privilege RBAC, secret redaction, prompt-injection quarantine, and OpenTelemetry tracing at $0 cost.
Architecture
flowchart LR
Agent[AI Client: Cursor / Ollama / LangGraph] <-->|JSON-RPC 2.0 stdio MCP| Server[k8s-rca-mcp Server]
Server --> Guard[Security Guardrails: Read-Only Allowlist + Secret Redaction + Prompt-Injection Filter]
Guard --> Analyzer[Grounded RCA Correlation Engine]
Analyzer -->|Least-Privilege ClusterRole: NO secrets, NO write verbs| K8s[(Kubernetes API: Pods, Events, Logs, ReplicaSets)]
Server --> OTel[OpenTelemetry Spans]Related MCP server: mcp-k8s-context-server
Security & Guardrail Model
Zero Secret Access (RBAC + Code Enforcement): Both
deploy/rbac/readonly-clusterrole.yamlandguardrails.enforce_read_only_access()explicitly allow onlyget/list/watchon non-secret diagnostic resources. Readingsecretsor invoking any mutating verb (delete,patch,apply) raisesGuardrailViolationand returns403 Forbiddenin Kubernetes.Automatic Secret Redaction: Scrubs PEM private keys, JWTs, AWS access keys (
AKIA...),Bearertokens, database URI credentials, andpassword=/api_key=patterns from pod logs and Kubernetes events before any text reaches an LLM.Prompt-Injection Quarantine: Detects and neutralizes untrusted instructions embedded in pod logs (e.g.,
"ignore previous instructions","kubectl delete ...") while flaggingprompt_injection_quarantined: truein the response audit metadata.
Exposed MCP Tools (tools/list)
Tool | Read-Only Scope | Purpose |
|
| Pod phases, restart counts, waiting/termination reasons & exit codes |
|
| Sanitized Kubernetes Warning/Normal events |
|
| Previous container logs with credential redaction & injection filtering |
|
| Recent deployment revisions and container images |
| Read-only correlation | Structured, evidence-cited RCA report + safe recommended next steps |
15-Scenario Chaos & Adversarial Benchmark (eval/run_eval.py)
Covers OOMKilled, CrashLoopBackOff, ImagePullBackOff, CreateContainerConfigError, InitContainerFailure, ResourceQuotaExceeded, FailedScheduling-PVC, FailedScheduling-Resources, ExpiredTLSCertificate, DNSResolutionFailure, NetworkPolicyDrop, RBACForbidden, LivenessProbeKillLoop, ReadinessProbeFailure, and PromptInjection + JWT Leak.
Quick Start ($0 Local)
# Run unit, RBAC policy, MCP JSON-RPC, and guardrail tests
PYTHONPATH=src:. python -m unittest discover -s tests -v
# Run 15-scenario evaluation harness and print Markdown scorecard
PYTHONPATH=src:. python -m eval.run_evalZero-Cost CI Pipeline (.github/workflows/ci.yml)
unit-and-eval-harness: Runspytest(guardrails, RBAC YAML audit, MCP JSON-RPC protocol) and executes all 15 chaos scenarios, uploadingeval-scorecard.md.kind-rbac-and-chaos-e2e: Spins up a freekindcluster in GitHub Actions, appliesreadonly-clusterrole.yaml, proves viakubectl auth can-ithatget secretsanddelete podsare denied, deploys real failing workloads (chaos/manifests/sample-failures.yaml), and runs live RCA diagnosis against the cluster.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only production context for AI agents: Docker/K8s health, deploys, logs, traffic, code graph
Fail-closed policy guardrails for AI agents running kubectl, terraform, helm, and argocd.
Provides read access to your GKE and Kubernetes resources.
Read-only finance and operations controls for AI agents with evidence and safe next actions.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables read-only Kubernetes incident investigation through MCP tools for listing pods, describing resources, fetching logs, and searching runbooks.1-
- FlicenseNot gradedqualityDmaintenanceProvides a read-only interface to Kubernetes clusters, enabling LLMs to list pods, get pod status and logs, fetch deployment manifests, and perform pod health analysis with resource trend tracking.-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to diagnose Kubernetes clusters through read-only MCP tools, such as inspecting pod status, logs, events, nodes, deployments, and HPA metrics via natural language queries.MIT
- AlicenseNot gradedqualityCmaintenanceExposes read-only Kubernetes investigation tools — pod listing/descriptions, log tails (including previous crashes), events, deployment and rollout history, node status, and Prometheus metrics — over MCP so Claude Desktop or any MCP client can diagnose the root cause of an incident. Proposed fixes are never exposed as executable actions; remediation stays behind a policy-checked human approval gate.1MIT