# mcp-k8s-ro [Health: Active]

**Category:** ☁️ Cloud Platforms  
**Repository:** https://github.com/your-ko/mcp-k8s-ro  
**GitHub Stars:** 1  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-k8s-ro

## Description
Read-only Kubernetes MCP server: inspect resources, logs, events, and metrics. Secrets are masked.

## Tools
Capabilities this server exposes over MCP:

- **k8s_list_resources** — List any resource type by name — pods, deployments, CRDs, etc. Accepts optional namespace filter. Returns name, status, readiness, restarts, node, IP, and more depending on resource kind.
- **k8s_describe_resource** — Return the full YAML of a single resource. Secret data is masked.
- **k8s_list_resource_types** — List all available resource types via the discovery API. Accepts optional API group filter.
- **k8s_get_logs** — Fetch pod logs. Supports container selector, tail lines, and `--previous` for crashed containers.
- **k8s_get_events** — List Kubernetes events for a namespace or the whole cluster, sorted by most recent.
- **k8s_top_pods** — CPU and memory usage per pod, with per-container breakdown. Requires metrics-server.
- **k8s_top_nodes** — CPU and memory usage per node, with percentage of allocatable capacity. Requires metrics-server.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/your-ko/mcp-k8s-ro), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Add to Claude Code:

```sh
claude mcp add --scope user --transport stdio k8s-ro \
  -- docker run --rm -i -v ~/.kube:/home/nonroot/.kube:ro ghcr.io/your-ko/mcp-k8s-ro:latest
```

2. Add to Claude Code:

```sh
claude mcp add --scope user --transport stdio k8s-ro \
  -- docker run --rm -i -v ~/.kube:/home/nonroot/.kube:ro ghcr.io/your-ko/mcp-k8s-ro:1.1.0
```

3. Install:

```sh
curl -fsSL "https://github.com/your-ko/mcp-k8s-ro/releases/download/${VERSION}/mcp-k8s-ro-${VERSION}-${ARCH}" -o ~/.local/bin/mcp-k8s-ro
```

4. Install:

```sh
chmod +x ~/.local/bin/mcp-k8s-ro
```

5. Run:

```sh
xattr -d com.apple.quarantine ~/.local/bin/mcp-k8s-ro 2>/dev/null  # macOS only: remove Gatekeeper quarantine
```

6. Add to Claude Code:

```sh
claude mcp add --scope user --transport stdio k8s-ro ~/.local/bin/mcp-k8s-ro
```

## Documentation

## What mcp-k8s-ro does

mcp-k8s-ro gives an MCP client a read-only view of one Kubernetes cluster. It supports resource discovery, workload inspection, pod log retrieval, event review, and resource-usage queries without exposing create, update, or delete operations. When an operation would require a mutation, the server can print an equivalent `kubectl` command for a person to run separately.

The server is designed for operational investigation. Lists return compact, resource-specific details such as names, status, readiness, restart counts, nodes, and IP addresses instead of always returning complete Kubernetes objects. Descriptions provide the full YAML for an individual resource, with sensitive and low-value fields removed or masked before they reach the model.

## How it works

The implementation is written in Go and communicates over MCP through standard input and output. It uses the kubeconfig context active when the process starts. Each response includes the active context and cluster name, providing an explicit indication of where the query was executed.

The process does not follow context changes made in another terminal. To use another cluster, stop or reload the server after selecting the desired kubeconfig context. Separate server registrations can point to different kubeconfig files when multiple clusters need to be available at the same time.

## Setup and configuration

The server can run as a downloaded binary, a locally built executable, or a Docker container. Docker usage mounts the kubeconfig directory or file read-only and runs the container with standard input attached. Prebuilt binaries are available from the project's GitHub Releases, and the source can be built with `make build`.

`KUBECONFIG` selects the kubeconfig file. If it is not set, the server uses `~/.kube/config`. Start the server through an MCP client using the stdio transport. Claude integrations can register either the binary or a Docker command with `claude mcp add`; other stdio-capable MCP clients can use their normal server configuration.

On macOS, downloaded binaries are not code-signed. Gatekeeper may require the quarantine attribute to be removed with `xattr`, or the application may need to be explicitly allowed in Privacy & Security settings.

## Tools and capabilities

- `k8s_list_resources` lists named resources of a selected type, optionally limited to a namespace. It supports common objects such as pods, deployments, and CRDs, with returned fields varying by kind.
- `k8s_describe_resource` returns one resource as YAML while masking secret data.
- `k8s_list_resource_types` queries Kubernetes discovery and can filter by API group.
- `k8s_get_logs` retrieves pod logs, including a selected container, a requested tail length, or logs from a previously crashed container.
- `k8s_get_events` lists namespace-scoped or cluster-wide events in newest-first order.
- `k8s_top_pods` reports pod and per-container CPU and memory usage.
- `k8s_top_nodes` reports node CPU and memory usage, including the percentage of allocatable capacity.

## Limitations and notes

The server is intentionally limited to one kubeconfig context per running instance and has no runtime cluster-switching tool. Register separate instances when simultaneous cluster access is required. The pod and node metrics tools depend on Kubernetes metrics-server.

Secret `data` and `stringData` are masked. Managed fields, certificate-signing request payloads, and selected cert-manager certificate fields are also redacted to avoid sending secret material, large PEM values, or low-value metadata to the model. The read-only boundary protects against MCP-triggered mutations, but users still need appropriate Kubernetes permissions for the resources they query.

_Full upstream README: https://allmcps.com/mcp/mcp-k8s-ro/readme_

