Back to MCP Servers

Kubernetes MCP Server

Community MCP server that wraps kubectl and Helm to let AI agents inspect, deploy, and troubleshoot resources in Kubernetes clusters.

Developer Tools by Flux159 (community) None (uses local kubeconfig) active
Overview

mcp-server-kubernetes is a community-maintained Model Context Protocol server that connects AI assistants to Kubernetes clusters. It shells out to the local kubectl and helm CLIs using the user's existing kubeconfig, so any context that works in your terminal (minikube, kind, EKS, GKE, AKS, Rancher Desktop, OpenShift, etc.) works through the server.

The server exposes a broad set of kubectl primitives (get, describe, create, apply, delete, logs, scale, patch, rollout, context) alongside higher-level helpers for port-forwarding, pod cleanup (Evicted, CrashLoopBackOff, ImagePullBackOff), node cordon/drain/uncordon, and full Helm 3 chart lifecycle management. A kubectl_generic escape hatch lets the agent run arbitrary kubectl subcommands when no dedicated tool exists.

It is one of the most widely adopted Kubernetes MCP implementations (1.4k+ GitHub stars) and supports a non-destructive mode that blocks deletes and other mutating operations, optional secrets masking, and OpenTelemetry traces. It is distributed as the mcp-server-kubernetes npm package and is typically launched via npx from Claude Desktop, Claude Code, Cursor, or VS Code.

Tools

Tool Description
kubectl_get Get or list Kubernetes resources of any type.
kubectl_describe Show detailed info about a specific resource.
kubectl_create Create a resource imperatively or from manifest.
kubectl_apply Apply a manifest to the cluster (create or update).
kubectl_delete Delete a resource by type/name or manifest.
kubectl_logs Fetch logs from a pod or container.
kubectl_scale Scale a Deployment, ReplicaSet, or StatefulSet.
kubectl_patch Apply a strategic, merge, or JSON patch to a resource.
kubectl_rollout Manage rollouts (status, restart, undo, pause, resume).
kubectl_context List or switch the active kubeconfig context.
kubectl_generic Run an arbitrary kubectl command for cases not covered by other tools.
explain_resource Run kubectl explain to describe a resource type's schema.
list_api_resources List API resources available on the cluster.
ping Verify connectivity to the cluster's API server.
port_forward Start a kubectl port-forward to a pod or service.
stop_port_forward Stop a running port-forward session.
install_helm_chart Install a Helm chart into the cluster.
upgrade_helm_chart Upgrade an existing Helm release.
uninstall_helm_chart Uninstall a Helm release.
helm_template_apply Render a Helm chart locally and apply the manifests.
cleanup_pods Bulk-clean pods in Evicted, CrashLoopBackOff, ImagePullBackOff, and similar failure states.
node_management Cordon, drain, or uncordon a node.
Setup Guide

Prerequisites

  • kubectl installed and on PATH
  • A valid kubeconfig at ~/.kube/config with at least one working context
  • Access to a Kubernetes cluster (minikube, kind, GKE, EKS, AKS, OpenShift, etc.)
  • Helm v3 installed (optional, only if you plan to use Helm tools)

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": ["mcp-server-kubernetes"]
    }
  }
}

Claude Code

claude mcp add kubernetes -- npx mcp-server-kubernetes

Cursor / VS Code

Use the same JSON block as Claude Desktop in your MCP-compatible extension's config.

Non-destructive (read-only) mode

Set ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS=true in the server's environment to disable kubectl_delete, uninstall_helm_chart, and other mutating operations while keeping read and create/update access.

Use Cases
  • Let an AI agent triage cluster incidents by listing pods, pulling logs from CrashLoopBackOff containers, and proposing manifest fixes
  • Apply or patch Deployment manifests during deploys and watch kubectl_rollout status until ready
  • Bulk-clean failed pods (Evicted, ImagePullBackOff) across namespaces with a single cleanup_pods call
  • Install, upgrade, and uninstall Helm releases from chat (e.g. roll out a new ingress-nginx version with custom values)
  • Cordon and drain nodes safely before maintenance, then uncordon when finished
Example Prompts
  • "List all pods in the production namespace and show logs for any that aren't Running."
  • "Scale the checkout Deployment to 5 replicas and watch the rollout until it's healthy."
  • "Install the bitnami/redis Helm chart as release cache with persistence disabled."
  • "Cordon node ip-10-0-1-23 and drain it, ignoring DaemonSets."
  • "Clean up every pod stuck in ImagePullBackOff across all namespaces."
Pros
  • Broad tool coverage spanning kubectl, Helm, port-forwarding, and node lifecycle in one server
  • Works with any cluster that already has a working kubeconfig, no extra credentials to wire up
  • Non-destructive mode and secrets masking make it safer to expose to autonomous agents
  • Active community project with 1.4k+ stars and frequent releases on npm
Limitations
  • Community-maintained, not an official Kubernetes project, so support and roadmap are best-effort
  • Wraps the local kubectl/Helm binaries, so they must be installed and on PATH (no in-cluster Go client)
  • Powerful by default; without ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS, an agent can delete resources or uninstall Helm releases
Alternatives