Kubernetes MCP Server
Manage pods, services, deployments, and logs from your AI assistant
The Kubernetes MCP Server connects Claude and other MCP-compatible agents to your Kubernetes cluster using your local kubectl configuration. List and describe pods and services, tail container logs, create deployments, and delete resources — all from a natural-language conversation. The server reads your current kubectl context from ~/.kube/config, so it targets whichever cluster you're already pointed at.
Installation & Configuration
Requires kubectl to be installed and configured with at least one cluster context. Add this block to your claude_desktop_config.json:
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["-y", "mcp-server-kubernetes"]
}
}
}
No environment variables are required. The server automatically reads ~/.kube/config and uses the current context. To switch clusters, run kubectl config use-context <context-name> before starting Claude Desktop.
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
Available Tools (7)
list_podsget_poddescribe_podlist_servicescreate_deploymentdelete_podget_logs
Use Cases
- Incident investigation — ask Claude to pull logs from a crashing pod and explain the error
- Cluster health checks — list all pods across namespaces and surface any not-running ones
- Quick deployments — describe a workload in plain English and have Claude write and apply the manifest
- Service discovery — list all services and their selectors to understand how traffic routes
Gotchas
- Context is set at startup: The server reads
~/.kube/configwhen it launches. If you switch contexts withkubectl config use-contextafter Claude Desktop is running, you need to restart it for the change to take effect. - Namespace scoping: Most tools default to the
defaultnamespace. Specify the namespace explicitly in your prompt (e.g. "list pods in namespace kube-system") or set a default namespace in your context. - Node.js version: The package requires Node.js 18+. Older Node versions will silently fail to run the server — check
node --versionif you see MCP connection errors. - Cluster access from the MCP host machine: The kubeconfig must be reachable from the machine running Claude Desktop. If your kubeconfig uses exec-based auth (e.g., aws eks, gke-gcloud-auth-plugin), that binary must also be on the PATH.
Security Note
This server runs with the full permissions of your current kubectl context. If your context has cluster-admin rights, Claude can delete any resource in any namespace. Use a dedicated kubeconfig with a limited-scope ServiceAccount for production clusters. For read-only access, bind the ServiceAccount to the built-in view ClusterRole.
Source & Documentation
GitHub Repository: https://github.com/Flux159/mcp-server-kubernetes
Protocol: Model Context Protocol (MCP) — modelcontextprotocol.io
20 ready-to-paste server configs + installer + doctor script