mcp-server-kubernetes (Flux159)

Popular TypeScript MCP server wrapping kubectl and Helm for cluster management.

By defaultCan delete
With our presetRead-only
Flagssecretsexec

Labels are provisional (from the project README/docs, checked Nov 3, 2026). Not yet tested in our sandbox.

Read-only switch

ALLOW_ONLY_READONLY_TOOLS=true (documented in ADVANCED_README.md). ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS=true still allows create/apply. Requires 4.1.10+: before 3.6.0 the mode only hid tools from the list (CVE-2026-46519), and up to 4.1.9 it still allowed switching the kubeconfig context and reading local files through read tools.

Preset

Read-onlyRead-only switch from the project's docs. Not sandbox-tested yet.
What the preset changes
  • Pins @4.2.1: CVE-2026-46519 is fixed in 3.6.0, and later read-only fixes need 4.1.10 or later.
  • Set ALLOW_ONLY_READONLY_TOOLS=true
  • Set ALLOWED_TOOLS=
  • We set ALLOWED_TOOLS to empty: a list takes priority over the read-only switch, and some clients pass your shell's variables to the server, so a list with kubectl_delete or kubectl_apply in it would turn writes back on. Empty means no list.

Claude Code

.mcp.json
{
  "mcpServers": {
    "kubernetes": {
      "command": "npx",
Removed:       "args": ["-y", "mcp-server-kubernetes"]
      "args": ["-y", "mcp-server-kubernetes@4.2.1"],
      "env": {
        "ALLOW_ONLY_READONLY_TOOLS": "true",
        "ALLOWED_TOOLS": ""
      }
    }
  }
}

Optional third layer: add "deny": ["mcp__kubernetes__<write tool>"] under permissions in .claude/settings.json.

Codex

~/.codex/config.toml
# Generated by redpresets.dev on 2026-11-03. Unverified preset. Also use a read-only credential. Not a security guarantee.

[mcp_servers.kubernetes]
command = "npx"
Removed: args = ["-y", "mcp-server-kubernetes"]
args = ["-y", "mcp-server-kubernetes@4.2.1"]
default_tools_approval_mode = "writes"

[mcp_servers.kubernetes.env]
ALLOW_ONLY_READONLY_TOOLS = "true"
ALLOWED_TOOLS = ""

default_tools_approval_mode = "writes" asks before any tool the server does not mark read-only.

Cursor

.cursor/mcp.json
{
  "mcpServers": {
    "kubernetes": {
      "type": "stdio",
      "command": "npx",
Removed:       "args": ["-y", "mcp-server-kubernetes"]
      "args": ["-y", "mcp-server-kubernetes@4.2.1"],
      "env": {
        "ALLOW_ONLY_READONLY_TOOLS": "true",
        "ALLOWED_TOOLS": ""
      }
    }
  }
}

Don't add write tools to mcpAllowlist in .cursor/permissions.json. Leave them on approval. Cursor's docs say the allowlist is not a security boundary.

Lines marked + are what we added to the vendor's install command. Struck-through lines marked − are what they replaced; Copy leaves those out.

Credential layer

Bind the kubeconfig/service account the agent uses to a read-only ClusterRole (e.g. the built-in view role). view excludes Secrets; do not grant get secrets to agents.

Gotchas

  • Main README now documents only non-destructive mode; read-only mode is in ADVANCED_README.md.
  • Before 3.6.0, read-only/non-destructive modes could be bypassed by calling hidden tools directly (CVE-2026-46519).
  • 3.6.0 to 4.1.9: read-only mode still let kubectl_context switch the current context (it rewrites your kubeconfig), and read tools accepted file-reading output formats and extra kubectl flags such as --server. 4.1.10 blocks these. There is no advisory for this; we checked the published 4.1.9 and 4.1.10 packages.
  • ALLOWED_TOOLS overrides the read-only switch if both are set, so we set it to empty.

Related incidents

Facts

Vendor
Flux159 (community)
Source
Flux159/mcp-server-kubernetes
License
MIT
GitHub stars
1.6k
Latest release
v4.2.1 (Oct 26, 2026)
Last push
Oct 26, 2026
Status
Active
Last checked
Nov 3, 2026

Sources

Spotted something wrong? Labels change when vendors change. Suggest a correction

Read-only alternatives in Kubernetes