If you're tired of memorizing kubectl flags and piping JSON through jq, this server turns your kubeconfig into natural language queries. It exposes four main tools: get_resources for filtered queries across namespaces, analyze_pod for correlating events and logs into root cause analysis, compare_deployments for diffing resources across environments, and generate_manifest for creating valid YAML from descriptions. Ships read-only by default with secret masking built in. Works with any MCP client and respects your existing RBAC permissions. The value is in the analysis layer, it doesn't just wrap kubectl commands, it actually correlates pod status with node conditions and resource limits to answer why something is broken.
A Model Context Protocol (MCP) server for intelligent, natural-language-powered Kubernetes operations.
Stop memorizing kubectl flags. Ask your cluster questions in plain English.
K8s Lens MCP exposes deep analytical tools to any MCP-compatible AI assistant (Claude, Cursor, Copilot, etc.):
| Capability | Example Prompt |
|---|---|
| Smart Resource Queries | "Show me all pods with status CrashLoopBackOff in namespace staging" |
| Pod Root-Cause Analysis | "Why is this pod failing?" — correlates events, logs, resource limits, and node conditions |
| Cross-Environment Diff | "Diff the nginx deployment between staging and prod" |
| Manifest Generation | "Create a basic nginx deployment with 2 replicas and a LoadBalancer service" |
Unlike thin kubectl wrappers, K8s Lens MCP analyzes and correlates data so the AI can give you real answers, not just raw command output.
pip install k8s-lens-mcp
Or with Poetry:
poetry add k8s-lens-mcp
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"k8s-lens": {
"command": "k8s-lens-mcp",
"args": []
}
}
}
Add to Cursor Settings → MCP:
{
"mcpServers": {
"k8s-lens": {
"command": "k8s-lens-mcp",
"args": []
}
}
}
Open Claude or Cursor and ask:
"Show me all failing pods in the default namespace and tell me why they're failing."
--read-only mode. No accidental deletions.To enable read-write mode (future feature):
k8s-lens-mcp --read-only=false
git clone https://github.com/yourusername/k8s-lens-mcp.git
cd k8s-lens-mcp
poetry install
poetry run k8s-lens-mcp
npx @modelcontextprotocol/inspector poetry run k8s-lens-mcp
poetry run pytest
poetry run ruff check .
poetry run ruff format .
get_resources — filtered resource queriesanalyze_pod — multi-signal root cause analysiscompare_deployments — cross-environment diffinggenerate_manifest — best-practice manifest generationkubectl plugin wrapper (kubectl lens "...")We welcome contributions! See CONTRIBUTING.md for guidelines.
Please read our Code of Conduct.
KUBECONFIGPath to kubeconfig file (defaults to ~/.kube/config)
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry OTLP endpoint for tracing (optional)
silenceper/mcp-k8s
azure/containerization-assist
io.github.evozim/aws-builder
reza-gholizade/k8s-mcp-server
flux159/mcp-server-kubernetes