# Kubernetes MCP Server: read_only, Toolsets, Denied Resources

> Lock down the Kubernetes MCP server so an agent cannot helm uninstall: a view ServiceAccount, read_only, toolsets and denied_resources, tested on v0.0.67.

URL: https://www.matthewswong.com/en/blog/kubernetes-mcp-server-go-read-only-toolsets/

- Author: Matthews Wong (https://www.matthewswong.com/en/about/)
- Published: 2026-10-17
- Updated: 2026-10-17
- Category: DevOps

> **Key takeaway:** To stop an AI agent running helm uninstall through the Kubernetes MCP server, enforce read-only at the cluster with a view-role ServiceAccount, then set read_only, a minimal toolsets list and denied_resources in TOML. Verify with tools/list: on v0.0.67, read_only exposed 14 of 22 tools, while a mistyped key silently exposed 20.

I wanted an agent to answer why a pod was crash-looping, and I noticed that the same server answering that question also advertised helm_uninstall. The server is containers/kubernetes-mcp-server, a Go program that talks to the API server directly instead of shelling out to kubectl or helm. Its default install is a credential plus a list of tools, and the list is longer than the job.

This post is the safe configuration, built only from the project's own documentation and from a tools/list audit I ran against v0.0.67, released on 18 September 2026. I did not call any tool or touch a real cluster: the audit used a stub kubeconfig, so what I measured is what the server offers an agent, not how any filter behaves under load.

## The tool list is the blast radius

With the core and helm toolsets enabled, v0.0.67 advertised 22 tools over stdio. Fourteen carry readOnlyHint=true. The other eight can change the cluster, and they are the whole risk surface of the server. The annotations below are the ones the server itself reported, and the notes paraphrase the upstream README.

Two rows deserve a second look. helm_install and pods_run are write tools that are not flagged destructive, so anything keyed on destructiveHint lets them through. And resources_create_or_update takes a complete manifest for any kind, which makes it a general-purpose write tool rather than a pod helper. The README says the manifest is the complete desired state, so fields it omits are removed.

## Seven layers, and only one is the real boundary

The server offers several ways to say no. They are not equal. One is enforced by Kubernetes itself, five are enforced by the MCP server in front of your credential, and one depends on a human being reachable.

The Model Context Protocol specification is blunt about the middle layers: clients must treat tool annotations as untrusted unless they come from a trusted server, and there should always be a human in the loop able to deny a call. Here the server is yours, so the annotations are trustworthy in practice, but read_only is only as correct as each tool's label. pods_run being unflagged is the proof that labels are a policy someone wrote, not a physical limit.

The project's own tool RBAC metadata document says the same from the other direction: the metadata is a planning aid, it does not grant access, and the Kubernetes API server remains authoritative. It publishes per-tool requirements under the key io.kubernetes-mcp-server/rbac, and its example of an unbounded declaration is a Helm tool whose permissions depend on the resources inside the chart. That is the honest summary of helm_install: no filter can bound what an arbitrary chart creates, so the credential must.

## Start with a ServiceAccount that cannot write

The upstream getting-started guide recommends a dedicated read-only identity, and it is the one layer I would not skip. It binds the built-in view ClusterRole to a ServiceAccount and mints a time-bound token with the TokenRequest API. Run the can-i checks before the agent ever sees the kubeconfig.

The Kubernetes RBAC documentation describes view as read-only access to most objects in a namespace that does not allow viewing roles or role bindings, and it states that the role does not allow viewing Secrets, because reading them would give access as any ServiceAccount in the namespace. One consequence I expect but did not test on a live cluster: the helm toolset documents secret as its default storage driver, and Helm release state is stored in Secrets, so helm_list may need an extra grant or storage_driver set to configmap. Test it before you promise the agent a helm view.

## The config file I would ship

Runtime settings live in TOML, and the documentation recommends drop-in files via --config-dir so a base policy and an override stay separate. The base file below is deliberately boring: read-only, two toolsets, two denied kinds, and instructions that tell the model what the server is for.

denied_resources is a defence for the day someone binds a broader role to the agent by mistake. With the view role it is redundant for Secrets, which is exactly why it is worth having: it fails safe when the credential drifts. server_instructions is advice, not enforcement, so it never replaces the layers above it.

> Use numbered drop-ins and SIGHUP. The documentation lists read_only, disable_destructive, denied_resources, toolsets, tool filters and confirmation rules as reloadable, so granting or revoking write access needs no restart. Port, bind address and kubeconfig still need one, and a reload that fails validation exits the process.

## disable_destructive is not read-only

When an incident needs writes, the tempting setting is disable_destructive, since it sounds like the safe subset. I measured the subset. On v0.0.67 it left 16 tools: the 14 read-only ones plus helm_install and pods_run. Neither is flagged destructive, and between them an agent can run any image or install any chart the credential permits. The drop-in below closes both gaps and makes an unanswered confirmation a refusal.

The documentation defaults confirmation_fallback to allow, meaning a client that cannot show a prompt proceeds silently with only a warning in the log. For a production cluster that default is backwards, so set deny. The allowed_registries list is a prefix match on URL-based chart references. When it is set, repo-style names and local paths are rejected, and file and plain http references are always blocked.

> Install options in the README are npx -y kubernetes-mcp-server@latest, uvx, a native binary, or the quay.io/containers/kubernetes_mcp_server image. Replace latest with an exact version such as 0.0.67 in anything that guards a cluster, then read the release notes before bumping.

## The failure: a typo that fails open

I tested the cheapest mistake deliberately: a config file containing readonly = true instead of read_only = true. v0.0.67 started without complaint and advertised 20 tools under the default core and config toolsets, including pods_delete, pods_exec and resources_delete. With the key spelt correctly and core plus helm enabled, the same server advertised 14, all read-only. Nothing in the process output told me the first file had done nothing.

> Do not treat a config file as the test. A misspelt key was not an error on the version I ran, so the only proof that read_only is on is the tool list a client actually receives. Audit tools/list in CI and on every upgrade.

The documentation on the main branch says the opposite behaviour is now intended: unknown TOML keys fail the load, and runtime flags such as --read-only, --toolsets and --port are dropped in favour of TOML, with leftover flags failing as unknown. On v0.0.67 I found the old --read-only flag still worked, and it exposed 14 tools. So tutorials copied from either era break in a different direction, and the version you pinned decides which. The same page records that the 0.0.66 sts settings were replaced by a token_exchange table, and the 0.0.67 release notes list removal of the SSE transport as a breaking change.

## Prove it: ask the server what it exposes

The audit that caught the typo is thirty lines of Node. It starts the server over stdio, sends initialize and tools/list, and prints each tool with its annotations. Point it at the exact config you deploy.

My three runs against the stub kubeconfig, all with toolsets core and helm: no restriction gave 22 tools with 8 not read-only, read_only gave 14, and disable_destructive gave 16. I did not exercise denied_resources, confirmation_rules or allowed_registries, so for those I am relying on the documentation, and you should test them against a scratch cluster before trusting them. Turn the script into a gate by failing when any listed tool has readOnlyHint other than true.

## What to do on Monday

In order, and each step is checkable on its own:

1. Pin the version. Replace @latest with an exact release and read its notes when you bump: 0.0.67 removed the SSE transport and changed token exchange configuration.
2. Create the mcp-viewer ServiceAccount with the view role and run the four can-i checks, expecting yes for list pods and no for delete pods, get secrets and exec.
3. Ship the base drop-in: read_only, the smallest toolsets list that does the job, and denied_resources for Secret and ClusterRoleBinding.
4. Run the tools/list audit in CI against that file and fail on any tool that is not readOnlyHint true.
5. Treat write access as a time-boxed drop-in: disable_destructive, disabled_tools for pods_run, allowed_registries, confirmation_fallback deny. Remove it and send SIGHUP when the incident ends.
6. If the server runs in a pod, set port in TOML for HTTP mode and remember the default bind address is 0.0.0.0, which the server warns about without TLS or OAuth. Bind to 127.0.0.1 behind a proxy, or enable require_oauth. configuration_view is off by default in HTTP mode because it exposes kubeconfig contents.

None of this makes the agent smart. It makes the worst case boring: a model that decides to uninstall a release meets a credential that cannot, and a tool list that does not offer the option.

The rule I would carry to any MCP server that holds a credential: let the credential be the boundary, use the server's filters as a second wall, and prove the wall by listing what a client actually receives. read_only, toolsets and denied_resources are good settings, but a typo can switch them off without a sound, and only a tools/list audit notices.

## Sources and further reading

- containers/kubernetes-mcp-server on GitHub: README, tool list and features
- Kubernetes MCP Server docs: configuration reference (read_only, toolsets, denied_resources, confirmation rules, Helm)
- Kubernetes MCP Server docs: configuration changes, dropped CLI flags and unknown keys
- Kubernetes MCP Server docs: deploying with a read-only ServiceAccount
- Kubernetes MCP Server docs: tool RBAC metadata
- GitHub release notes: kubernetes-mcp-server v0.0.67
- Kubernetes docs: RBAC authorization and the view ClusterRole
- Model Context Protocol specification: tools, annotations and security considerations

helm_install

false

false

> Installs a chart. Any oci or https reference is accepted unless allowed_registries is set.

helm_uninstall

false

true

> Removes a Helm release.

pods_delete

false

true

> Deletes a Pod by name.

pods_exec

false

true

> Runs a command inside a container.

pods_run

false

false

> Starts a Pod from any container image.

resources_create_or_update

false

true

> Server-Side Apply of a complete manifest, any kind.

resources_delete

false

true

> Deletes any resource by apiVersion, kind and name.

resources_scale

false

true

> Reads or sets the replica count.

ServiceAccount RBAC

view ClusterRole plus a short-lived token

Any verb the identity lacks, whatever the agent asks for

The Kubernetes API server

Read-only mode

read_only

Every tool not annotated readOnlyHint=true

The MCP server, from tool annotations

No destructive tools

disable_destructive

Tools annotated destructiveHint=true

The MCP server, from tool annotations

Tool allowlist or denylist

enabled_tools, disabled_tools

Named tools, flagged or not

The MCP server

Resource denylist

denied_resources

Named group, version and kind such as Secret

The MCP server

Human confirmation

confirmation_rules

Calls matching a tool or a Kubernetes verb and kind, until a person agrees

The MCP client; confirmation_fallback decides when it cannot ask

Chart sources

toolset_configs.helm allowed_registries

helm_install pulling from an unlisted registry

The helm toolset

## Source links

- https://github.com/containers/kubernetes-mcp-server
- https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration.md
- https://github.com/containers/kubernetes-mcp-server/blob/main/docs/configuration-changes.md
- https://github.com/containers/kubernetes-mcp-server/blob/main/docs/getting-started-kubernetes.md
- https://github.com/containers/kubernetes-mcp-server/blob/main/docs/tool-rbac-metadata.md
- https://github.com/containers/kubernetes-mcp-server/releases/tag/v0.0.67
- https://kubernetes.io/docs/reference/access-authn-authz/rbac/
- https://modelcontextprotocol.io/specification/2025-06-18/server/tools

## FAQ

### How do I make the Kubernetes MCP server read-only?

Set read_only = true in the TOML file you pass with --config or --config-dir. The documentation says it exposes only tools annotated readOnlyHint=true, and on v0.0.67 with the core and helm toolsets that left 14 of 22 tools. Pair it with a ServiceAccount bound to the view ClusterRole so the cluster refuses writes even if a filter fails.

### Can the Kubernetes MCP server run helm uninstall?

Yes, if the helm toolset is enabled and the credential allows it, because helm_uninstall is one of its tools. The helm toolset is not in the default set, which is core and config, so it only appears when you add it to toolsets. read_only removes helm_uninstall, and disabled_tools can remove it by name.

### What is the difference between read_only and disable_destructive?

read_only keeps only tools annotated readOnlyHint=true, while disable_destructive hides only tools annotated destructiveHint=true. On v0.0.67 the second setting still left helm_install and pods_run, because neither carries the destructive label. If you need a safe write mode, add disabled_tools and an allowed_registries list.

### How do I stop the agent reading Kubernetes Secrets?

Use a ServiceAccount bound to the built-in view ClusterRole, which the Kubernetes documentation says does not allow viewing Secrets. Then add a denied_resources entry with group empty, version v1 and kind Secret as a second layer. You can also add a confirmation rule for the get verb on kind Secret.

### Which toolsets does the Kubernetes MCP server enable by default?

Only config and core are enabled by default. The helm, kcp, kiali, kubevirt, netobserv, tekton and observability toolsets must be added to the toolsets list. Enabling fewer toolsets also shrinks the tool list the model has to choose from.

---

- HTML version: https://www.matthewswong.com/en/blog/kubernetes-mcp-server-go-read-only-toolsets/
- Bahasa Indonesia: https://www.matthewswong.com/id/blog/kubernetes-mcp-server-go-read-only-toolsets/
- Site index for agents: https://www.matthewswong.com/llms.txt
- Sitemap: https://www.matthewswong.com/sitemap.xml
- API description (OpenAPI): https://www.matthewswong.com/openapi.json
