kubectl-mcp
Provides read-only tools for inspecting Kubernetes clusters, including listing namespaces, pods, deployments, services, recent events, and pod logs, as well as querying for restarted pods.
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., "@kubectl-mcpwhich pods restarted in the last hour?"
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.
kubectl-mcp
An MCP (Model Context Protocol) server that lets AI agents inspect Kubernetes clusters in plain English — ask "which pods restarted in the last hour?" and get a real answer.
Built by Teresa Tran.
Why
LLM assistants are great at explaining kubectl commands and terrible at
actually running them safely. kubectl-mcp exposes read-only cluster
inspection as a set of MCP tools an agent can call — turning "check my cluster"
from copy-paste-and-hope into a real conversation.
Read-only by design. No
apply, nodelete, noexec. The server only ever inspects.Mock mode by default. Ships with a seeded fake cluster so you can try it in 30 seconds without a real cluster.
Real mode when you're ready. Point it at your
KUBECONFIGand it queries a live cluster via the official Kubernetes Python client.
Related MCP server: Kubernetes MCP Server
Install
pip install kubectl-mcp # mock mode (default)
pip install "kubectl-mcp[real]" # + real-cluster support (kubernetes client)Or from source:
git clone https://github.com/teresa-tran/kubectl-mcp.git
cd kubectl-mcp
pip install -e ".[real,dev]"Run it standalone (sanity check)
kubectl-mcp --help # show flags
kubectl-mcp --list-tools # print every MCP tool + its schema
kubectl-mcp --demo list_pods # run a tool once against the mock cluster
kubectl-mcp --demo find_restarted_pods --arg since_minutes=120Wire it into an MCP client
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (mac)
or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"kubectl": {
"command": "kubectl-mcp"
}
}
}For real-cluster mode:
{
"mcpServers": {
"kubectl": {
"command": "kubectl-mcp",
"env": {
"KUBECTL_MCP_MODE": "real",
"KUBECONFIG": "/Users/you/.kube/config"
}
}
}
}Restart Claude Desktop. You should now be able to ask "list pods in the production namespace" and get a real answer.
Other MCP-compatible clients
Any client that speaks stdio MCP (Cursor, Cline, Continue, custom agents) works
the same way — point it at the kubectl-mcp binary.
Tools exposed
Tool | What it does |
| All namespaces in the cluster |
| Pods in a namespace, with phase + restart count |
| Full detail for one pod (containers, statuses, events) |
| Deployments in a namespace, with ready/desired replicas |
| Full detail for one deployment |
| Services in a namespace, with type + endpoints |
| Events in the last N minutes, most recent first |
| Last N lines of a pod's logs (read-only, no |
| Pods that restarted in the last N minutes (high-level query) |
Every tool has a JSON Schema — LLMs get proper argument validation for free.
Configuration
Environment variables:
Var | Values | Default | What |
|
|
| Cluster backend |
| path |
| Real-mode kubeconfig path |
| path | (bundled) | Override the mock cluster JSON |
|
|
| Log verbosity to stderr |
The mock cluster
The default mock cluster ships in src/kubectl_mcp/mock_data.json and includes:
3 namespaces:
default,production,staging~15 pods spanning healthy, crashlooping, and recently-restarted states
Deployments, services, and a stream of recent events
Some pods have restart counts > 0 so
find_restarted_podsreturns real results
You can override it by setting KUBECTL_MCP_MOCK_DATA=/path/to/your.json if
you want to demo a specific scenario.
Design notes
Read-only by construction. The
KubernetesBackendprotocol only defines read methods. There's no code path that can mutate cluster state — even in real mode.Backend is swappable.
MockBackendandRealBackendimplement the same protocol. Adding a third (e.g., a cached snapshot) is one file.Errors are exceptions, not silent nulls.
ResourceNotFound,NamespaceNotFound, etc., propagate asMcpErrorwith helpful messages so the agent can course-correct.stdio transport. All MCP tool calls are JSON-RPC over stdio, matching the MCP spec exactly.
Development
pip install -e ".[real,dev]"
pytest # run tests
ruff check src tests # lint
kubectl-mcp --demo list_pods --arg namespace=production # smoke testRoadmap
Mock backend with seeded data
Real backend via
kubernetespython clientRead-only tool surface
Standalone
--demomode for CI/smoke testsMulti-cluster support (
--contextflag)Metrics tools (CPU/memory via
metrics.k8s.io)Optional caching layer for high-frequency queries
License
MIT © 2026 Teresa Tran
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceProvides read-only access to Kubernetes clusters for AI assistants.23MIT
- FlicenseBqualityDmaintenanceEnables managing Kubernetes clusters through natural language by providing tools to list resources, view logs, port-forward services, scale deployments, and execute kubectl operations via AI assistants.81
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with and manage Kubernetes clusters, supporting operations on pods, deployments, services, configmaps, secrets, namespaces, metrics, and events with built-in safety features for destructive actions.9141MIT
- FlicenseNot gradedqualityCmaintenanceExposes Kubernetes cluster management tools to LLMs, enabling querying pods, deployments, logs, metrics, and managing port forwards via natural language.1
Related MCP Connectors
Git-backed platform for skills, tools, and context for AI agents
See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.
SaaS intelligence for AI agents. 5 unified tools cover 1,000+ services with 91-96% token savings.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/teresa-tran/kubectl-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server