mcp-server-kubernetes (Flux159)
Popular TypeScript MCP server wrapping kubectl and Helm for cluster management.
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
- 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
{
"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
# 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
{
"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_contextswitch 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_TOOLSoverrides the read-only switch if both are set, so we set it to empty.
Related incidents
Facts
- Vendor
- Flux159 (community)
- 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
- README · checked Oct 27, 2026
- ALLOW_ONLY_READONLY_TOOLS, precedence order · checked Oct 27, 2026
- CVE-2026-46519 (fixed 3.6.0) · checked Oct 27, 2026
- 4.1.10 blocks kubectl_context set under ALLOW_ONLY_READONLY_TOOLS and restricts read-tool output formats and kubectl flags (diff of the npm 4.1.9 and 4.1.10 packages: dist/tools/kubectl-context.js, dist/security/kubectl-flags.js) · checked Nov 3, 2026
- Empty ALLOWED_TOOLS means no list (index.js: allowedToolsEnv ? … : null) · checked Nov 3, 2026
Spotted something wrong? Labels change when vendors change. Suggest a correction
Read-only alternatives in Kubernetes
MCP server for Argo CD applications: list, inspect, sync and manage apps.
MCP server shipped with the Flux Operator for GitOps reconciliation, debugging and diffs.
Kubernetes analyzer; k8sgpt serve --mcp exposes its cluster analysis over MCP.