← Back to directory
K

Kubernetes MCP Server

Community
MCP server for interacting with Kubernetes clusters via kubectl
GitHub source repository ↗
★ 1.6k Stars Category · Dev Tools Very popular Source revision 1ece64e6a9a5
61FMRS · C
Reliability
10/20
Security and permissions
3/20
Maintenance
16/20
Documentation
17/20
Setup experience
15/20

The server is powerful but requires caution, especially in production. It is advised to enable non-destructive mode to reduce risk.

Read the FMRS scoring method →

mcp-server-kubernetes is an MCP server that enables AI assistants to interact with Kubernetes clusters via kubectl. It supports loading kubeconfig from multiple sources and offers a rich set of tools for managing resources, performing Helm operations, port forwarding, node management, and more. The server supports non-destructive and read-only modes, and includes secrets masking for enhanced security.

Tools

kubectl_get
Get or list Kubernetes resources (e.g., pods, deployments, services)
kubectl_describe
Describe Kubernetes resources in detail
kubectl_create
Create Kubernetes resources
kubectl_apply
Apply YAML manifests to create or update resources
kubectl_delete
Delete Kubernetes resources
kubectl_logs
Get logs from pods
kubectl_context
Manage kubectl contexts (view, switch, set current context)
explain_resource
Explain fields and structure of Kubernetes resources
list_api_resources
List API resources supported by the cluster
kubectl_scale
Scale resources (e.g., deployments)
kubectl_patch
Update fields of a resource
kubectl_rollout
Manage deployment rollouts (status, restart, rollback)
kubectl_generic
Execute any kubectl command
ping
Verify connection to the cluster
port_forward
Forward local ports to pods or services
stop_port_forward
Stop port forwarding
install_helm_chart
Install a Helm chart
upgrade_helm_chart
Upgrade a Helm chart
uninstall_helm_chart
Uninstall a Helm chart
helm_template_apply
Apply Helm chart via template rendering (bypasses auth issues)
helm_template_uninstall
Uninstall Helm chart via template rendering (bypasses auth issues)
cleanup_pods
Clean up problematic pods (e.g., Evicted, Error, CrashLoopBackOff)
node_management
Node management operations (cordon, drain, uncordon)

Setup

  1. Ensure kubectl is installed and a valid kubeconfig is configured. 2. Add the server using npx or client integration: e.g., npx mcp-server-kubernetes. 3. Configure the mcpServers entry in your client (e.g., Claude Desktop, VS Code).
claude_desktop_config.json
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": [
        "mcp-server-kubernetes"
      ]
    }
  }
}

Fit and risk

Best for

  • Developers and operators managing Kubernetes clusters via AI assistants
  • Scenarios requiring quick troubleshooting and diagnosis of K8s issues
  • Users integrating with MCP clients like Claude Desktop, Codex CLI

Not for

  • Users needing a GUI for Kubernetes management
  • Environments without kubectl or kubeconfig
  • Production environments where fine-grained RBAC control is trusted to AI assistants

Required permissions

  • Read and modify Kubernetes resources (possibly restricted by configuration)
  • Execute kubectl commands (including creating, deleting, updating resources)
  • Access kubeconfig file to connect to clusters
  • May perform port forwarding and node draining operations

Risks and side effects

  • Accidental deletion or modification of resources (mitigated by non-destructive mode)
  • Exposure of sensitive information (e.g., secrets, mitigated by secrets masking)
  • Overly broad permissions can lead to cluster misconfiguration or failures
  • Unauthorized access if kubeconfig is leaked

Troubleshooting

  1. Run kubectl get pods to verify connection
  2. Check that the kubeconfig path is correct
  3. Ensure kubectl is in PATH
  4. Check server logs for error messages
  5. Ensure environment variables (e.g., KUBECONFIG_PATH) are set correctly

Use cases

Manage Kubernetes resources through natural language
Automate cluster troubleshooting
Install, upgrade, and uninstall Helm charts
Perform node maintenance operations
Port forward to access services within the cluster

Supported clients

Claude CodeFull support
Claude DesktopFull support
Codex CLIFull support
CursorFull support
VS CodeFull support