K8s Lens MCP
Provides tools for querying, analyzing, and generating Kubernetes resources, enabling natural-language-powered operations such as pod root-cause analysis, cross-environment deployment diffing, and manifest generation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@K8s Lens MCPWhy is my nginx pod crashing?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🔭 K8s Lens MCP
A Model Context Protocol (MCP) server for intelligent, natural-language-powered Kubernetes operations.
Stop memorizing kubectl flags. Ask your cluster questions in plain English.
✨ What It Does
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 |
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 |
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.
🚀 Quick Start
1. Install
pip install k8s-lens-mcpOr with Poetry:
poetry add k8s-lens-mcp2. Configure Your AI Client
Claude Desktop
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": []
}
}
}Cursor
Add to Cursor Settings → MCP:
{
"mcpServers": {
"k8s-lens": {
"command": "k8s-lens-mcp",
"args": []
}
}
}3. Start Talking to Your Cluster
Open Claude or Cursor and ask:
"Show me all failing pods in the default namespace and tell me why they're failing."
🛡️ Safety First
Read-only by default — the server starts in
--read-onlymode. No accidental deletions.RBAC-respecting — we use your kubeconfig / ServiceAccount. We don't bypass Kubernetes permissions.
Secret masking — Kubernetes Secret data is never returned in tool output.
To enable read-write mode (future feature):
k8s-lens-mcp --read-only=false🏗️ Development
Prerequisites
Python 3.11+
Poetry
A Kubernetes cluster (e.g. kind, minikube, or a remote cluster)
Setup
git clone https://github.com/yourusername/k8s-lens-mcp.git
cd k8s-lens-mcp
poetry installRun Locally
poetry run k8s-lens-mcpTest with MCP Inspector
npx @modelcontextprotocol/inspector poetry run k8s-lens-mcpRun Tests
poetry run pytestLint & Format
poetry run ruff check .
poetry run ruff format .📋 Roadmap
Core MCP server scaffold
get_resources— filtered resource queriesanalyze_pod— multi-signal root cause analysiscompare_deployments— cross-environment diffinggenerate_manifest— best-practice manifest generationCost / resource optimization advisor
Multi-cluster context aggregation
Helm release values diffing
In-cluster deployment (Helm chart)
kubectlplugin wrapper (kubectl lens "...")
🤝 Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
Please read our Code of Conduct.
📄 License
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/firas-mcp-servers/k8s-lens-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server