apply-k8s-resource
Create or modify a Kubernetes resource from a YAML manifest
Read any Kubernetes resource as JSON or through a Go template you supply, pull pod logs with a time window, and exec into a pod — naming the kubeconfig context on each individual call.
LABSCO SUMMARY
Because context is an argument rather than global state, an agent can compare events in one cluster against logs in another inside a single conversation, and a mistake shows up as a wrong argument instead of a wrong session. That is also the reason to set the two flags: an allowed-context list and read-only mode decide how far a wrong argument can go.
A Kubernetes client exposed as tools, working across the contexts in your kubeconfig, where context is a parameter on the call rather than session state. A single Go binary, also published to npm and Docker Hub.
A kubeconfig holding the contexts you intend to name — KUBECONFIG points at it, defaulting to ~/.kube/config, and the Docker image needs it mounted in. Every tool takes context as an argument, so the cluster a call lands on is chosen per call; --allowed-contexts is what stops that being every cluster you have credentials for. Prebuilt binaries need nothing else, the npm package needs Node.js, and building from source needs Go.
One command — npx @strowk/mcp-k8s
USE CASES
List the contexts, then read events in one and pod logs in the other without re-pointing anything between calls.
Take the whole object as JSON, or render just the fields you care about through a Go template.
Run the command in the container — with stdin when it needs input — rather than guessing from the outside.
Create or modify the resource from YAML, against the context you name on the call.
Start with --readonly — the apply and exec tools never appear, and secrets stay masked in what does.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
apply-k8s-resourceCreate or modify a Kubernetes resource from a YAML manifest
get-k8s-pod-logsGet logs for a Kubernetes pod using specific context in a specified namespace
get-k8s-resourceGet details of any Kubernetes resource like pod, node or service - completely as JSON or rendered using template
k8s-pod-execExecute command in Kubernetes pod
list-k8s-contextsList Kubernetes contexts from configuration files such as kubeconfig
list-k8s-eventsList Kubernetes events using specific context in a specified namespace
list-k8s-namespacesList Kubernetes namespaces using specific context
list-k8s-nodesList Kubernetes nodes using specific context
list-k8s-resourcesList arbitrary Kubernetes resources
BEFORE YOU INSTALL
9 tools when we connected.
npx on PATH
CONTEXT COST
Rated by the size of the 9 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
Add the block to your client, or run the command directly.
{
"mcpServers": {
"mcp-k8s": {
"command": "npx",
"args": [
"@strowk/mcp-k8s"
]
}
}
}npx @strowk/mcp-k8s