MCP Server Kubernetes

Manage a Kubernetes cluster through kubectl and Helm from an MCP client

By Suyog Sonwalkar (individual) TypeScript Local · stdio DevOps and monitoringCloud platforms

80 popularity score ★ 1.6k ↓ 26k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add kubernetes -- npx mcp-server-kubernetes
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": [
        "mcp-server-kubernetes"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
      "args": [
        "mcp-server-kubernetes"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "kubernetes": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "mcp-server-kubernetes"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.kubernetes]
command = "npx"
args = ["mcp-server-kubernetes"]
Gemini CLITerminal
gemini mcp add --scope user kubernetes npx -- mcp-server-kubernetes
Local (container)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add kubernetes -- docker run -i --rm -v '~/.kube:/home/appuser/.kube:ro' flux159/mcp-server-kubernetes:latest
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "kubernetes": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "~/.kube:/home/appuser/.kube:ro",
        "flux159/mcp-server-kubernetes:latest"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "kubernetes": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "~/.kube:/home/appuser/.kube:ro",
        "flux159/mcp-server-kubernetes:latest"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "kubernetes": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v",
        "~/.kube:/home/appuser/.kube:ro",
        "flux159/mcp-server-kubernetes:latest"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.kubernetes]
command = "docker"
args = ["run", "-i", "--rm", "-v", "~/.kube:/home/appuser/.kube:ro", "flux159/mcp-server-kubernetes:latest"]
Gemini CLITerminal
gemini mcp add --scope user kubernetes docker -- run -i --rm -v '~/.kube:/home/appuser/.kube:ro' flux159/mcp-server-kubernetes:latest

Settings 12

ALLOW_ONLY_READONLY_TOOLS Optional: Set to true to expose only tools that cannot change the cluster.
ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS Optional: Set to true to drop delete, uninstall, drain, exec and generic kubectl tools.
ALLOWED_TOOLS Optional: Comma-separated list of the only tools to enable; an unknown name stops startup.
KUBECONFIG_PATH Optional: Path to a kubeconfig other than ~/.kube/config.
KUBECONFIG_YAML Optional: Whole kubeconfig given as a YAML string (KUBECONFIG_JSON for JSON).
K8S_SERVER Optional: API server URL for token-based config, used with K8S_TOKEN.
K8S_TOKEN Optional: Bearer token used with K8S_SERVER.
K8S_CONTEXT Optional: Kubeconfig context to use instead of the current one.
K8S_NAMESPACE Optional: Default namespace to use.
MASK_SECRETS Optional: Set to false to stop masking values in kubectl get secrets output.
ENABLE_UNSAFE_STREAMABLE_HTTP_TRANSPORT Optional: Serve over HTTP at /mcp instead of stdio (PORT, HOST, MCP_AUTH_TOKEN apply).
MCP_AUTH_TOKEN Optional: Require a matching X-MCP-AUTH header on HTTP or SSE requests.

In a container, a setting goes in with -e NAME=value after docker run.

What it does

MCP Server Kubernetes gives an MCP client the everyday operations of a Kubernetes cluster. It runs on your machine and works through the kubectl and Helm command-line programs, using whatever kubeconfig context you already have, so the assistant sees the same cluster you do in a terminal.

Its tools cover listing, describing, creating, applying, patching, scaling and deleting resources, reading pod logs, managing rollouts, switching contexts, explaining resource types, port-forwarding, running commands inside pods, cordoning and draining nodes, and installing, upgrading or removing Helm charts. A catch-all kubectl_generic tool passes any kubectl command through. It also ships a k8s-diagnose prompt that walks through troubleshooting pods matched by a keyword.

Three settings narrow what it exposes: ALLOW_ONLY_READONLY_TOOLS keeps only tools that cannot change the cluster, ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS removes delete, uninstall, node drain, exec and generic kubectl, and ALLOWED_TOOLS names an exact list. Values in kubectl get secrets output are masked by default. By default it speaks stdio; HTTP and SSE transports, a Docker image and a Helm chart for running it inside a cluster are also documented, and OpenTelemetry tracing can be switched on.

What it needs

RuntimeNode.jsorDocker

Node.js to run it with npx (or Docker for the container image). kubectl on the PATH and a kubeconfig with a working context for a reachable cluster (minikube, Rancher Desktop, GKE, EKS, AKS and so on). Helm v3 on the PATH if you want the Helm tools. Credentials can instead come from KUBECONFIG_YAML, KUBECONFIG_JSON, or K8S_SERVER plus K8S_TOKEN.

Limits

It can only do what your kubeconfig identity is allowed to do; it does not add RBAC of its own. Secret masking applies only to kubectl get secrets output, not to logs or other commands. The HTTP and SSE transports are marked unsafe in their own setting names: anyone who can reach the endpoint acts with your kubeconfig, and the SSE transport is deprecated in favour of Streamable HTTP. Adding clusters to kubectx is listed as not planned. Very large clusters may need SPAWN_MAX_BUFFER raised.

Who it suits

It suits developers and operators who already use kubectl and want an assistant to inspect and change their clusters, including Helm releases and node maintenance. Because it acts with full kubeconfig rights and can delete resources, exec into pods and run any kubectl command, anyone pointing it at a shared or production cluster should start it with ALLOW_ONLY_READONLY_TOOLS or ALLOWED_TOOLS, or give it a restricted kubeconfig. It is a community project, not published by the Kubernetes project or a cloud vendor; people who need only a hosted, managed view of one cloud's clusters may prefer that vendor's own tooling.

Tools 23

kubectl_get
List or fetch resources of any type, with selectors and output format
kubectl_describe
Show the detailed description of a resource
kubectl_apply
Apply a YAML manifest to the cluster
kubectl_create
Create a resource from a manifest or arguments
kubectl_delete
Delete resources
kubectl_logs
Read logs from pods or their containers
kubectl_scale
Change the replica count of a deployment or similar resource
kubectl_patch
Update fields of a resource with a strategic, merge or JSON patch
kubectl_rollout
Check, pause, resume, restart, undo or view history of a rollout
kubectl_context
List, show or switch kubeconfig contexts
kubectl_reconnect
Reload the cluster connection and credentials
kubectl_generic
Run any kubectl command with given arguments
explain_resource
Explain the fields of a Kubernetes resource type
list_api_resources
List the API resource types the cluster serves
install_helm_chart
Install a Helm chart, with values, repository and version options
upgrade_helm_chart
Upgrade an existing Helm release
uninstall_helm_chart
Remove a Helm release
node_management
Cordon, drain or uncordon a node
port_forward
Forward a local port to a pod or service
stop_port_forward
Stop a running port-forward
exec_in_pod
Run a command inside a pod container
cleanup
Remove resources and port-forwards the server is tracking
ping
Check that the server is responding

Similar servers