Kubectl — Claude Code MCP server: what it does, how to install
Kubectl — an MCP server that lets AI assistants interact with Kubernetes clusters. It diagnoses failing pods, inspects RBAC rights, and tunes workloads.
no license updated 2026-10-29
Open on GitHubWhat Kubectl does
This server exposes Kubernetes and Helm controls to AI models through MCP. The baseline setup provides 26 tools, expanding to 209 tools with 14 workflow prompts across full toolsets. An agent can read container logs, trace network reachability from ingresses to endpoints, check resource usage, and generate cluster manifests.
Security controls include secret masking, a read-only flag, and OAuth 2.1 authorization with granular tool scopes. Network listeners follow a fail-closed policy against unintended external exposure.
Running the server requires Python 3.10+ or Node.js alongside an active kubectl configuration pointing to your target cluster.
What it helps with
- diagnose crashlooping pods using logs and cluster events
- generate deployment manifests for multi-replica services
- detect containers that reserve excess CPU or memory
- verify DNS resolution and service networking across pods
Example prompts for the agent
- Check recent events and explain why pod
payment-servicecrashed - List pods in the
productionnamespace that waste memory limits - Audit RBAC permissions across all namespaces for excessive privileges
How to install Kubectl
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Kubectl
How do I install Kubectl for Claude Code?
You can launch it directly without manual setup using npx -y kubectl-mcp-server, or install it globally with npm install -g kubectl-mcp-server or pip install kubectl-mcp-server.
What does the Kubectl MCP server do?
It gives AI assistants tools to inspect pod logs, audit cluster RBAC configurations, deploy workloads, and troubleshoot network paths.
What prerequisites are required to run this server?
It needs Python 3.10+ when installed via pip, or Node.js for npx, along with valid kubectl credentials for the target cluster.