How to set up the Kubernetes MCP Server in Claude
- Follow the publisher’s Kubernetes setup guide to create a viewer ServiceAccount and a dedicated kubeconfig for the cluster you administer.
- Save the TOML setting in a local server config and replace the example paths in the Claude Code configuration. Open /mcp to verify the server loads.
read_only = true{
"mcpServers": {
"kubernetes-mcp-server": {
"command": "npx",
"args": [
"-y",
"kubernetes-mcp-server@latest",
"--config",
"/path/to/kubernetes-mcp-server.toml"
],
"env": {
"KUBECONFIG": "/path/to/mcp-viewer.kubeconfig"
}
}
}
}Read workload status from your own cluster
Use Kubernetes MCP to check a workload against the cluster’s current state. For diagnostics, start with a dedicated viewer ServiceAccount and a known kubeconfig. The publisher’s read-only setting hides tools not marked read-only. Kubernetes RBAC determines what the identity may read or change.
Check why staging is still rolling out
Give Claude the cluster context, staging namespace, and Deployment name. Ask for desired, updated, and available replicas and any recent warnings for that Deployment. Compare the output with the same namespace in your Kubernetes dashboard or your usual kubectl readback. If replica counts differ, verify the namespace and timestamp first.
Make the read-only setup explicit
The current release uses a TOML file for runtime settings. The older --read-only flag is no longer accepted by the standalone server. Keep read_only = true in the config and use an RBAC viewer role separately.