Kubernetes MCP Server
Published · Updated
At a glance
- Category
- Cloud & DevOps
- GitHub repository
- strowk/mcp-k8s-go
- Watch out for
- Without --allowed-contexts it can reach every context in your kubeconfig, production included.
mcp-k8s-go is a community Kubernetes MCP server written in Go by the GitHub user strowk. It talks to your clusters through your existing kubeconfig, so whatever contexts kubectl can reach, this server can reach too, which is exactly why its safety flags deserve attention.
The tool set covers what you usually do with kubectl while debugging. It can list contexts, namespaces and nodes, list and get any resource (with friendlier output for pods, services and deployments). It also reads events and pod logs, run a command inside a pod, and create or modify resources. A natural use is to ask why a deployment is not becoming ready and let the agent look at the pods, their events and their logs in one pass.
Three options make it safer to use against real clusters. --allowed-contexts limits which kubeconfig contexts it may touch, for example only dev and staging. --readonly removes every tool that can write to the cluster. And secrets are masked in output by default, so a get on a Secret does not put credentials into the model's context unless you explicitly pass --mask-secrets=false. The server is distributed as an npm package with prebuilt binaries, as a Go install and as a multi-arch Docker image.
How it connects
Your AI app
An assistant or agent that supports MCP
Kubernetes MCP Server
Runs as
- npx (Node.js)
- Docker
Gives the agent
- Cluster overview
- Any resource
- Debugging
- Context allowlist
- Read-only and secret masking
Kubernetes
The data or system the tools act on
What it can do
- Cluster overview
- Tools list contexts, namespaces and nodes, and contexts are also exposed as MCP resources a client can attach.
- Any resource
- List, get, create and modify any Kubernetes resource type, with custom mappings that make pods, services and deployments easier to read.
- Debugging
- Get events and pod logs, and run a command inside a pod, which covers most of a typical troubleshooting session.
- Context allowlist
- --allowed-contexts=dev,staging keeps the agent away from any context you did not list, including production.
- Read-only and secret masking
- --readonly disables all write tools, and --mask-secrets (on by default) hides Secret values in responses.
Setting it up
Install with npm install -g @strowk/mcp-k8s, which downloads a prebuilt binary called mcp-k8s, or run it directly with npx @strowk/mcp-k8s. Go users can go install github.com/strowk/mcp-k8s-go, and there is a Docker image, mcpk8s/server, which needs your kubeconfig mounted, for example -v ~/.kube/config:/home/nonroot/.kube/config. The server uses KUBECONFIG or ~/.kube/config. In your client config, set the command to mcp-k8s and pass flags as arguments. A sensible default is --allowed-contexts listing only non-production contexts, plus --readonly until you trust the setup.
claude mcp add kubernetes -- npx -y @strowk/mcp-k8sRuns the @strowk/mcp-k8s package from npm. Add any API keys, environment variables or extra arguments the setup notes above list. Combine several servers in the MCP config generator
Where each client keeps its MCP config file, and the JSON it expects (cheat sheet)
Where it helps
- Asking why a deployment is stuck and having the agent check pods, events and logs together
- Getting a quick summary of what is running in a namespace
- Reading logs from a crashing pod and correlating them with recent events
- Applying a small change to a development cluster under supervision
Limitations and things to watch
- Without --allowed-contexts it can reach every context in your kubeconfig, production included.
- Running commands inside pods is powerful and risky; use --readonly when you only need to look.
- It is a community project maintained by one developer, not by the Kubernetes project. It is still active, with release v0.6.7 published in November 2026.
- Permissions are whatever your kubeconfig user has. A dedicated, limited service account is safer than your admin credentials.
Sources
Written from the project's own documentation, checked November 2026.
- github.com /strowk/mcp-k8s-go
- github.com /strowk/mcp-k8s-go/releases
- hub.docker.com /r/mcpk8s/server
- npmjs.com /package/@strowk/mcp-k8s
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.