Kubernetes MCP Server: The Complete Guide
A Kubernetes MCP server lets an AI agent inspect and operate your cluster — list pods, read logs, scale a deployment, triage a crash loop — through Model Context Protocol tool calls instead of you typing kubectl by hand. This guide covers what that actually means, compares the main open-source implementations, walks the install, and is blunt about the security cost: an agent with cluster access is only as safe as the RBAC you give it.

On this page · 17 sections▾
One-sentence definition
A Kubernetes MCP server is a program that exposes cluster operations — listing pods, reading logs, scaling deployments, applying manifests — as Model Context Protocol tools, so any MCP client (Claude Desktop, Claude Code, Cursor, VS Code) can drive your cluster through structured tool calls instead of a human at a terminal.
The agent asks a question in English — “why is the checkout pod restarting?” — and the server translates that into real API reads: get the pod, fetch its events, pull the last 200 log lines, describe the deployment. You read the answer; the agent did the typing.
Why it exists
Cluster debugging is a context-gathering grind. A pod is crash-looping, so you kubectl describe pod, then kubectl logs --previous, then kubectl get events, then kubectl describe deployment, mentally stitching the output into a story. Each command is trivial; the cost is the stitching and the back-and-forth.
Before MCP, wiring an LLM into that loop meant writing a bespoke function-calling shim per tool, per client. MCP standardizes the wire format, so one server speaks to every compliant client. The Kubernetes MCP server is that loop, automated: the agent runs the gather steps in one turn and hands you a correlated answer. That is the entire value proposition — and also, exactly, where the danger lives, because the same channel that reads can also write.
The named pieces
Four parts show up in every Kubernetes MCP setup. Get these straight and the rest of the post lands.
MCP client
Claude Code, Cursor, VS Code — the agent that decides which tools to call.
MCP server
The K8s server itself — exposes pod/log/deploy tools over a transport.
kubeconfig / service account
The credential the server uses. This is the whole blast radius.
Kubernetes API server
The real control plane. RBAC here is the only hard boundary you have.
client → MCP server → (kubeconfig/SA) → API server → cluster
Read that chain left to right and the security story writes itself: nothing in the client or the server is a real boundary. The API server’s RBAC, scoped to that one credential, is the only thing standing between “the agent read a log” and “the agent deleted a namespace.”
The main implementations (they are not the same)
“Kubernetes MCP server” is a category, not a product. Several mature, open-source servers exist, and they differ in real ways. Here are the three most cited, plus the cloud-vendor entries you’ll bump into.
containers/kubernetes-mcp-server
Maintained under the containers GitHub org (the same community behind Podman), this is the most feature-broad of the open implementations. Its README is explicit that it is not a kubectl wrapper: “a Go-based native implementation that interacts directly with the Kubernetes API server.” Red Hat Developer describes it as a “single binary with no external dependencies, such as kubectl, Helm, Node.js, or Python.” It targets both Kubernetes and OpenShift, ships toolsets for Helm and Tekton, supports multi-cluster by default, and is Apache-2.0 licensed. Opinionated takeaway: if you want one server that covers the widest surface, this is the default pick.
feiskyer/mcp-kubernetes-server
Maintained by feiskyer, this one openly does lean on the CLIs — its README says it “translates natural language requests into kubectl commands or direct Kubernetes API calls.” That means you need kubectl and (optionally) helm on the host or in its Docker image. The upside is granular kill switches: --disable-kubectl, --disable-helm, --disable-write, and --disable-delete. Apache-2.0. Takeaway: pick it if you want CLI-faithful behavior and fine-grained command gating.
strowk/mcp-k8s-go
Maintained by strowk, a lighter native-Go server focused on the core loop: list contexts and namespaces, list/get/create/modify resources, read pod logs, fetch events and node info. It is the easiest to install casually — npx @strowk/mcp-k8s, Homebrew, Docker, or go install — and ships a --readonly flag that “disables any tool which can write changes to the cluster.” Takeaway: the right starting point if you want a small footprint and read-only by default.
Cloud-vendor servers (AKS, and others)
The managed-Kubernetes vendors ship their own. Azure’s aks-mcp is open-source and notable for one thing this guide cares about: it defaults to read-only access and only does writes if you pass --access-level readwrite or admin. Microsoft’s docs are blunt that “all actions performed through the AKS MCP server are constrained by Kubernetes Role-Based Access Control (RBAC) and Azure RBAC.” If you’re on a managed platform, check whether your provider has a first-party server before reaching for a generic one.
| Server | API vs kubectl | Read-only flag | Multi-cluster |
|---|---|---|---|
| containers/kubernetes-mcp-server | Native Go API | --read-only | Default on |
| feiskyer/mcp-kubernetes-server | kubectl + API | --disable-write | Via context |
| strowk/mcp-k8s-go | Native Go API | --readonly | Via context |
Sourced from each project’s README, June 2026. Flags and feature sets change — confirm against the current README before you rely on a kill switch.
Smallest end-to-end example
The fastest way to feel what this does, using the containers implementation, run locally and read-only. First, register it with Claude Code against your current kubeconfig:
# native Go binary, read-only, your current kube context
npx -y kubernetes-mcp-server@latest --read-onlyFor Claude Desktop, the README’s config block is the canonical shape (add --read-only to the args for safety):
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["-y", "kubernetes-mcp-server@latest", "--read-only"]
}
}
}Restart the client, then ask the agent a real question:
You: Which pods in the "payments" namespace are not Running, and why?
Agent → pods_list(namespace: "payments")
Agent → events_list(namespace: "payments")
Agent → pods_log(name: "checkout-7d9f", namespace: "payments")
Agent: checkout-7d9f is in CrashLoopBackOff. Its last log line is
"FATAL: DATABASE_URL is empty". The deployment references a secret
key "db-url" that doesn't exist in the "payments" namespace.Three reads, one correlated answer, no terminal juggling. Note that with --read-only the agent cannot fix it — it can only tell you what’s wrong. That’s the trade you want for a first run.
Install the catalog server
The MCP.Directory catalog lists a Kubernetes server that bridges kubectl for real-time resource management inside a conversation. Use the panel below for the exact one-click button, copy command, or JSON snippet per client — it pulls configs straight from our catalog, so it stays in sync.
One-line install · Kubernetes
Open server pageInstall
This is one option, not the only one. If you want the native-Go breadth of the containers implementation, the multi-toolset feiskyer server, or the small-footprint strowk server, install those directly from their repos (links in Sources). Whichever you pick, the first install should be read-only against a non-production cluster. Browse the full cloud infrastructure category for related servers, or the whole server directory.
What the tools actually cover
Tool names vary per server, but the coverage clusters into four buckets. Using the containers implementation’s tool set as the reference:
- Inspect (read):
pods_list,pods_get,pods_log,events_list,resources_list,resources_get,nodes_top,configuration_view. This is the bucket you can hand an agent with low anxiety. - Operate (write):
resources_create_or_update,resources_scale,pods_run,resources_delete,pods_delete. Every entry here is a mutation. Gate them. - Execute (escalation):
pods_execruns commands inside a container. This is the most powerful and most dangerous tool in the set — a shell in your workload is a shell in your workload. - Extensions: Helm (
helm_install,helm_list), Tekton pipeline triggers, and KubeVirt/Kiali toolsets in the containers server. Useful, and each one widens the blast radius another notch.
The takeaway senior engineers internalize fast: the read bucket is a productivity win with little downside; the operate and execute buckets are where you decide how much trust the agent earns.
Transports and how it reads your cluster
Two questions decide your setup: how the client talks to the server (transport), and how the server talks to the cluster (credential).
Transport. stdio is the default — the client launches the server as a subprocess on your laptop. The containers and feiskyer servers also offer Streamable HTTP (path /mcp) and SSE (path /sse) via a --port flag, which is how you run the server centrally for a team instead of on every developer’s machine.
Credential. Locally, the server reads your kubeconfig — the containers server takes a --kubeconfig flag or auto-detects the default path; feiskyer’s reads the KUBECONFIG environment variable. In a cluster, it uses the in-cluster service account. This is the single most important line in the whole setup, so it gets its own section next.
The RBAC problem nobody can opt out of
The hard truth: an AI agent with a Kubernetes MCP server inherits the exact permissions of the credential you give it. If you point it at your personal admin kubeconfig, a hallucinated or prompt-injected tool call can delete a namespace in production. The model is not the boundary. RBAC is.
Microsoft states the principle cleanly for its AKS server: “all actions performed through the AKS MCP server are constrained by Kubernetes Role-Based Access Control (RBAC) and Azure RBAC” and “by default, the AKS MCP server inherits the user’s permissions.” Red Hat’s guidance for the containers server is equally explicit: “run the MCP server with a dedicated service account” and “optionally, start the server using the --read-only configuration option (as a safeguard if RBAC isn’t already tightly scoped).”
Translate that into a checklist you can actually run:
- Never use your admin context. Create a dedicated service account (a
cluster-readerClusterRole binding is a sane start) and point the server at that. - Default to read-only. Turn on
--read-only(or--readonly, or--disable-write— the flag name differs per server). Earn write access later, per cluster, deliberately. - RBAC is the real wall, the flag is a seatbelt. A
--read-onlyflag is a config toggle in the server; RBAC is enforced by the API server. Use both, but trust RBAC. - Keep prod off the agent until you’ve watched it. Run against staging, read the tool traces, and only then decide whether prod gets read access — and whether write ever does.
- Mind prompt injection. If the agent reads logs or events that contain attacker-controlled text, that text can try to steer the next tool call. Read-only limits the damage of a steered call to “it read something it shouldn’t,” not “it deleted something.”
What we got wrong
Two assumptions burned us when we first wired one of these up.
We assumed “read-only mode” meant “safe.” It doesn’t — it means “no writes.” A read-only agent pointed at a kubeconfig with broad read scope can still pull every secret in the cluster through resources_get on Secret objects. Read access to Secrets is sensitive. The fix was RBAC that scopes reads too, not just writes.
We assumed all “Kubernetes MCP servers” were the same project. They’re not. We followed a blog’s install steps for one server while reading the README of a different one, and spent twenty minutes confused about why a flag didn’t exist. The containers, feiskyer, and strowk servers have different names, different flags, and different tool names. Pick one, bookmark its README, and ignore the rest.
Common mistakes
Pointing it at your admin kubeconfig “just to try it”
Root cause: the path of least resistance is your existing context, which is usually cluster-admin. The try-it run becomes the permanent setup. Make a scoped service account before the first run, not after the first scare.
Following install steps for the wrong implementation
Root cause: “Kubernetes MCP server” ambiguity. A flag or tool name from one repo won’t exist in another. Confirm the exact repo (containers vs feiskyer vs strowk) before copying any command.
Expecting a kubectl-wrapper to work without kubectl
Root cause: mismatched architecture. feiskyer’s server shells out to kubectl and helm, so the host (or Docker image) needs them installed. The native-Go servers (containers, strowk) don’t. Read the README’s prerequisites first.
Leaving pods_exec enabled on a prod credential
Root cause: under-appreciating that exec is a shell inside the workload. Even with writes to the cluster blocked, an exec into a running container can read its env, files, and mounted secrets. Disable exec on anything touching prod.
Who this is for (and who it’s not)
Use a Kubernetes MCP server if you:
- Spend real time on
kubectl describe / logs / get eventsdebugging loops and want them correlated in one turn. - Can scope a dedicated read-only service account and are disciplined about RBAC.
- Work mostly in staging/dev clusters where a wrong tool call is recoverable.
Skip it (for now) if you:
- Would only ever point it at a production admin context — the risk outweighs the convenience.
- Have a compliance posture that forbids automated agents touching the control plane.
- Want write automation but haven’t yet built the RBAC, audit logging, and review process to make it accountable.
Community signal
Interest is real and the framing is consistently cautious. On Hacker News, the “Show HN: I made an open source Kubernetes MCP Server to talk with K8s in English” thread (March 2025) is one of several Show HN launches in this space, and a recurring theme across the K8s MCP discussions is the “when does an MCP server beat a plain CLI?” question — the consensus leans toward read/debug being the safe sweet spot, with write operations treated warily.
The vendor docs reinforce the same posture. Microsoft ships its AKS MCP server read-only by default, requiring an explicit --access-level readwrite to mutate anything. Red Hat’s walkthrough for the containers server leads with the dedicated service account and the --read-only safeguard rather than with capability flexing. When the cloud vendors and the platform maintainers all default to read-only, that is the community signal: the tech is useful, and the careful default is the endorsed one.
We looked for a first-party maintainer launch tweet to embed here and could not verify one we were confident attributing, so we’re citing the primary docs and the HN thread directly instead of paraphrasing a tweet we can’t stand behind.
The verdict
Our take
A Kubernetes MCP server is a genuine productivity win for the inspect-and-debug loop, and you should set one up. Use it if you can commit to a dedicated read-only service account and treat write access as a deliberate, audited upgrade. Skip it if your only plan is to hand an agent your prod admin context — the convenience is not worth a hallucinated resources_delete. For breadth, start with the native-Go containers/kubernetes-mcp-server; for a minimal footprint, strowk/mcp-k8s-go. Read-only, non-prod, watch the traces — then decide.
Frequently asked questions
What is a Kubernetes MCP server?
A Kubernetes MCP server is a program that exposes cluster operations (list pods, read logs, scale deployments, run kubectl-style queries) as Model Context Protocol tools, so an AI agent in Claude, Cursor, or VS Code can inspect and manage a cluster through structured tool calls instead of you typing kubectl by hand.
Is it safe to give an AI kubectl access to a cluster?
Only if you scope it. The agent inherits whatever the kubeconfig or service account allows. For production, run the server with a read-only flag and a least-privilege service account (a cluster-reader role), never your full admin context. Treat write access to prod as a deliberate, audited decision — not the default.
kubernetes-mcp-server vs mcp-k8s-go: what's the difference?
containers/kubernetes-mcp-server is a native Go implementation that talks to the Kubernetes API directly with no kubectl or Helm binary required, plus toolsets for Helm, Tekton, and OpenShift. strowk/mcp-k8s-go is a lighter Go server focused on core resource inspection and logs, installable via npx or Homebrew, with a --readonly flag. Pick the first for breadth, the second for a smaller footprint.
Does a Kubernetes MCP server support multi-cluster?
Some do. containers/kubernetes-mcp-server enables multi-cluster by default and adds a context argument to its tools; you disable it with --disable-multi-cluster. Others operate on whatever context your kubeconfig points at, so you switch clusters by switching context. Check the specific server's README before assuming.
Does it run kubectl or talk to the API directly?
It depends on the implementation. containers/kubernetes-mcp-server is a native Go client that calls the Kubernetes API server directly — no kubectl binary. feiskyer/mcp-kubernetes-server shells out to kubectl and helm for many operations. strowk/mcp-k8s-go is native Go. The native ones have fewer moving parts; the kubectl-wrapping ones inherit kubectl's exact behavior.
Which transports do Kubernetes MCP servers support?
Most support stdio for local clients plus a network transport for remote use. containers/kubernetes-mcp-server and feiskyer/mcp-kubernetes-server both offer Streamable HTTP and SSE in addition to stdio. stdio is the default and the simplest for a single developer's laptop.
Can I limit a Kubernetes MCP server to read-only?
Yes, and you should for anything touching production. containers/kubernetes-mcp-server has --read-only (blocks create/update/delete) and --disable-destructive (blocks delete/update but allows create). strowk/mcp-k8s-go has --readonly. feiskyer's server has granular flags like --disable-write and --disable-delete. Combine the flag with RBAC; don't rely on either alone.
Glossary
- MCP (Model Context Protocol): the JSON-RPC wire format that lets any LLM client call any tool server. See our MCP primer.
- MCP server: a program exposing tools over MCP — here, Kubernetes operations.
- kubeconfig: the file holding cluster endpoints and credentials; defines what the server can reach.
- Service account: a non-human cluster identity; the recommended credential for an MCP server.
- RBAC: Role-Based Access Control — the API server’s permission system; your only hard boundary.
- ClusterRole / binding: RBAC objects that grant a set of verbs on resources to an identity.
- stdio transport: client runs the server as a local subprocess over standard in/out — the default.
- Streamable HTTP / SSE: network transports for running the server centrally for a team.
- Read-only mode: a server flag that blocks write tools; a seatbelt, not the wall.
- pods_exec: a tool that runs commands inside a container — the highest-risk capability.
- Multi-cluster: the server can target more than one cluster, usually via a context argument.
- Prompt injection: attacker text in data the agent reads (logs, events) that tries to steer its next action.
Sources & links
Primary sources
- containers/kubernetes-mcp-server (native Go, Apache-2.0): github.com/containers/kubernetes-mcp-server
- feiskyer/mcp-kubernetes-server (kubectl + API, Apache-2.0): github.com/feiskyer/mcp-kubernetes-server
- strowk/mcp-k8s-go (native Go, --readonly flag): github.com/strowk/mcp-k8s-go
Documentation
- Red Hat Developer — “Kubernetes MCP server: AI-powered cluster management”: developers.redhat.com
- Microsoft Learn — “Connect your AKS cluster to AI agents using the MCP server” (RBAC & read-only default): learn.microsoft.com
Community
- Hacker News — Show HN: open source Kubernetes MCP server: news.ycombinator.com/item?id=43486174
Internal
Protocol
What is the Model Context Protocol?
ReadCategory
Cloud Infrastructure MCP Servers
BrowseServer
Kubernetes Server on MCP.Directory
ViewFound an issue?
If a flag changed, a server renamed a tool, or a new Kubernetes MCP implementation deserves a mention, email [email protected] or read more on our about page. We keep these guides current.