Use existing Kubernetes identity
Local mode uses the current kubeconfig context. In-cluster mode uses the Pod ServiceAccount. No hidden admin channel is introduced.
Kubernetes diagnostics over MCP
kubectl.Generic Kubernetes MCP Server is a read-only Go server for AI clients that need structured access to pods, deployments, events, logs, metrics, and ownership context without bypassing Kubernetes RBAC.
Why it exists
Local mode uses the current kubeconfig context. In-cluster mode uses the Pod ServiceAccount. No hidden admin channel is introduced.
Every Kubernetes read is checked with SelfSubjectAccessReview before
the API call runs.
Pod inspection includes restart evidence, warnings, and owning workload context
such as Pod -> ReplicaSet -> Deployment.
Architecture
Local or in-cluster read-only access with policy and RBAC enforcement.
Natural language
-> MCP client
-> generic-k8s-mcp
-> MCP readonly policy
-> Kubernetes RBAC check
-> Kubernetes API read
-> structured result back
Any MCP client
-> HTTPS MCP gateway
-> authentication
-> tenant / cluster resolution
-> policy + rate limits
-> Kubernetes API
Tool surface
cluster_infocan_ilist_namespaceslist_nodesdescribe_nodelist_podsdescribe_podget_pod_logslist_deploymentsdescribe_deploymentlist_eventsget_resource_usagefind_unhealthy_workloadsexplain_resourceBy default there are no write operations, no secret reads, no pod exec, no port-forward, and no apply or patch actions.
Quickstart
git clone https://github.com/vk7416/generic-k8s-mcp.git
cd generic-k8s-mcp
go mod tidy
make build
kubectl config current-context
kubectl get ns
kubectl auth can-i list pods -A
kubectl auth can-i get pods/log -n default
./bin/k8s-mcp-server \
--mode=local \
--kubeconfig="$HOME/.kube/config" \
--namespace=default \
--readonly=true \
--allow-secret-read=false \
--allow-pod-command=false
{
"mcpServers": {
"generic-k8s": {
"command": "/absolute/path/bin/k8s-mcp-server",
"args": [
"--mode=local",
"--kubeconfig=/Users/YOU/.kube/config",
"--context=YOUR_CONTEXT",
"--namespace=default",
"--readonly=true"
]
}
}
}
Container and release
docker build -t ghcr.io/vk7416/generic-k8s-mcp:dev .
# or
make docker-build
git checkout main
git pull
git tag v0.2.0
git push origin v0.2.0
Tags publish multi-arch images to
ghcr.io/vk7416/generic-k8s-mcp and
docker.io/bullraju/generic-k8s-mcp, and create a GitHub Release.
Gateway plan
Implement Streamable HTTP while keeping stdio for local developer workflows.
Bearer token or OIDC auth, request logging, response caps, and rate limiting.
Deploy in-cluster with a scoped ServiceAccount before attempting multi-cluster brokering.
Publish URL, auth method, timeouts, and example configs for multiple MCP clients.
Recommended first production target: one cluster, one gateway deployment, read-only only, token auth, and internal or VPN-only exposure.