Kubernetes

Run the Kubernetes MCP server in your cluster, read-only, so the agent can read pods, logs, events and resources.

The Kubernetes MCP server talks to the Kubernetes API directly. With it, the agent can list pods, read their logs, follow events and inspect any resource, in any Kubernetes cluster (EKS, GKE, AKS, OpenShift, on-prem). For AWS-specific views (CloudWatch, EKS insights), see also Amazon EKS.

SettingValue
RunsIn your cluster (Helm chart or a Deployment)
Endpoint URLhttps://<your hostname>/mcp
TransportStreamable HTTP
AuthenticationBearer token, through Supergateway (the server has no static key of its own)

Give it a read-only identity

Create a ServiceAccount bound to the built-in view ClusterRole. view reads most resources, pod logs and events, but not Secrets.

kubectl create namespace mcp
kubectl create serviceaccount mcp-viewer -n mcp
kubectl create clusterrolebinding mcp-viewer --clusterrole=view --serviceaccount=mcp:mcp-viewer

Configure the server read-only

The server reads its settings from a TOML file:

config.toml
port = "8080"          # Streamable HTTP at /mcp
read_only = true       # only tools marked read-only
stateless = true       # suits containers and several replicas
toolsets = ["core"]    # pods, generic resources, events

Deploy it with the Helm chart (oci://ghcr.io/containers/charts/kubernetes-mcp-server; see its values for the configuration and ServiceAccount), or as a Deployment that runs kubernetes-mcp-server --config /etc/kubernetes-mcp-server/config.toml as mcp-viewer. In a pod, it uses that ServiceAccount's in-cluster credentials.

Put a key and https in front

The server has no static API key, so run Supergateway next to it with --apiKey, and expose that over https:

supergateway --streamableHttp "http://kubernetes-mcp-server.mcp.svc:8080/mcp" \
  --outputTransport streamableHttp --stateful --port 8000 --apiKey "$MCP_API_KEY"

See Expose a self-hosted server for the Ingress. On a self-hosted sremcp in the same cluster, you can skip this step and use http://kubernetes-mcp-server.mcp.svc:8080/mcp directly.

Onboard in sremcp

FieldValue
Display name / SlugKubernetes (prod) / k8s-prod
Endpoint URLhttps://mcp-k8s.example.com/mcp
TransportStreamable HTTP
AuthenticationBearer token, Secret = MCP_API_KEY

Approve tools

With read_only = true, only read tools appear. A good start:

  • pods_list, pods_list_in_namespace, pods_get, pods_log, pods_top
  • events_list, namespaces_list, resources_list, resources_get
  • nodes_top, nodes_stats_summary

Try it

  • Which pods in payments restarted in the last hour, and what do their last logs say?
  • Show warning events in the checkout namespace since 13:00 UTC.
  • Which nodes are under memory pressure right now?

Troubleshooting

  • 403 when the server sits behind a proxy on 127.0.0.1: its DNS-rebinding check rejects the proxy's Host header. Set disable_localhost_protection = true, and bind_address = "127.0.0.1" so only the proxy reaches it.
  • Forbidden in tool results: the ServiceAccount's role doesn't allow that read. view deliberately excludes Secrets.

On this page