Mcp K8s Ro

io.github.your-koPublished by GitHub account your-kov1.2.2Updated Oct 30, 2026

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

Overview

AI-generated overview

Read-only Kubernetes MCP server that lets an assistant list and describe resources, read pod logs and events, and check CPU/memory usage.

What you can do
  • List and describe cluster resources, including any resource type and its full YAML
  • Discover available resource types through the discovery API, optionally filtered by API group
  • Read pod logs with container selection, tail lines and previous-container support
  • List Kubernetes events for a namespace or the whole cluster, newest first
  • Show CPU and memory usage per pod and per node, with percentages of allocatable capacity
When to use it
Useful for on-call and troubleshooting work where an assistant should inspect a cluster without any risk of changing it: checking pod status, restarts, logs, events and resource pressure. It fits teams that want a single pinned cluster context per server instance.
Requirements
Runs locally as a stdio process, either a pre-built binary or a Docker image. Needs a kubeconfig file, read from KUBECONFIG or defaulting to ~/.kube/config, with credentials for the target cluster. The metrics tools require metrics-server in the cluster. The macOS binary is unsigned and needs a Gatekeeper override.
Before you install
The server holds cluster credentials through the kubeconfig and can read logs, events and resource YAML, so point it only at clusters you are willing to expose to the model. Secret data and stringData are masked, but other fields are returned. It is read-only by design and prints kubectl commands instead of mutating; the context is fixed at startup, so switching clusters requires a restart.

Installation

In SourceWeft

  1. Open Mcp K8s Ro in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

README

[Main] [golangci-lint] [Link validation]

mcp-k8s-ro

A read-only MCP server that gives Claude access to Kubernetes clusters. Built in Go, it communicates over stdio using the MCP protocol.

Design

  • Read-only — only get, describe, logs, and top style operations. No create, update, or delete. If a mutating operation is needed, the server prints the equivalent kubectl command for you to run manually. Safe to use while on-call at night: Claude can never accidentally mutate your cluster, even under prompt fatigue.
  • Secret-safe — secret values are masked before being sent to the model, so your secrets cannot leak due to misconfiguration or prompt injection.
  • Token-efficient — responses include only relevant fields (name, status, restarts, etc.) rather than raw Kubernetes API objects, keeping context usage low.
  • Cluster-aware — every response includes the active context and cluster name, so Claude always knows which cluster it is talking to.
  • Context-pinned — the server locks to the active kubeconfig context at startup. Switching contexts in another terminal has no effect on the running server.
  • No extra infra — runs as a local binary or Docker container, connects to whatever kubeconfig context is active at startup.

Redacted fields

Object/FieldReason
Secret.dataSecret leak prevention
Secret.stringDataSecret leak prevention
CertificateSigningRequest.spec.requestLarge base64 PEM blob, no diagnostic value, saves tokens
Certificate (cert-manager) .spec.keystoresCert chain PEM blobs, no diagnostic value, saves tokens
Certificate (cert-manager) status.conditions[].messageCert chain PEM blobs, no diagnostic value, saves tokens
*.managedFieldsNo diagnostic value, saves tokens

Tools

ToolDescription
k8s_list_resourcesList 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_resourceReturn the full YAML of a single resource. Secret data is masked.
k8s_list_resource_typesList all available resource types via the discovery API. Accepts optional API group filter.
k8s_get_logsFetch pod logs. Supports container selector, tail lines, and --previous for crashed containers.
k8s_get_eventsList Kubernetes events for a namespace or the whole cluster, sorted by most recent.
k8s_top_podsCPU and memory usage per pod, with per-container breakdown. Requires metrics-server.
k8s_top_nodesCPU and memory usage per node, with percentage of allocatable capacity. Requires metrics-server.

Configuration

Environment variableDefaultDescription
KUBECONFIG~/.kube/configPath to kubeconfig file

Usage with Claude

Docker (recommended)

bash
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

Pinning a specific version (check the latest release ) is recommended for production use:

bash
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

Binary

Download a pre-built binary from GitHub Releases:

bash
# macOS Apple Silicon — change ARCH for other platforms: darwin-amd64, linux-amd64, linux-arm64ARCH=darwin-arm64VERSION=$(curl -fsSL https://api.github.com/repos/your-ko/mcp-k8s-ro/releases/latest | grep tag_name | cut -d'"' -f4)curl -fsSL "https://github.com/your-ko/mcp-k8s-ro/releases/download/${VERSION}/mcp-k8s-ro-${VERSION}-${ARCH}" -o ~/.local/bin/mcp-k8s-rochmod +x ~/.local/bin/mcp-k8s-roxattr -d com.apple.quarantine ~/.local/bin/mcp-k8s-ro 2>/dev/null  # macOS only: remove Gatekeeper quarantineclaude mcp add --scope user --transport stdio k8s-ro ~/.local/bin/mcp-k8s-ro

macOS Gatekeeper: The binary is not code-signed, so macOS will block it. The xattr command above removes the quarantine flag. Alternatively, go to System Settings → Privacy & Security and click "Allow Anyway" after the first blocked attempt. [img.png]

Or build from source:

bash
make buildclaude mcp add --scope user --transport stdio k8s-ro ./bin/mcp-k8s-ro

Custom kubeconfig location

If your kubeconfig is not at ~/.kube/config, set the KUBECONFIG environment variable:

bash
# Binaryclaude mcp add --scope user --transport stdio -e KUBECONFIG=/path/to/kubeconfig k8s-ro ~/.local/bin/mcp-k8s-ro
# Dockerclaude mcp add --scope user --transport stdio k8s-ro \  -- docker run --rm -i -e KUBECONFIG=/config/kubeconfig -v /path/to/kubeconfig:/config/kubeconfig:ro ghcr.io/your-ko/mcp-k8s-ro:latest

Single-cluster design

The server intentionally operates on one kubeconfig context and provides no tool to switch clusters at runtime. The reasons are:

  • Prompt injection isolation — a malicious value in one cluster's resources (e.g. a pod annotation) cannot instruct Claude to pivot to a different cluster, including production.
  • Explicit audit boundary — every tool response includes the context and cluster name, so there is never ambiguity about which cluster was queried.

To point the server at a different cluster, stop the server, switch context, and restart:

bash
kubectl config use-context my-other-cluster# then restart the MCP server / reload Claude Desktop

To work with multiple clusters simultaneously, register a separate server instance per cluster in your MCP config:

json
{  "mcpServers": {    "k8s-staging": {      "type": "stdio",      "command": "/path/to/bin/mcp-k8s-ro",      "env": { "KUBECONFIG": "/path/to/.kube/config" }    },    "k8s-prod": {      "type": "stdio",      "command": "/path/to/bin/mcp-k8s-ro",      "env": { "KUBECONFIG": "/path/to/.kube/config-prod" }    }  }}

Claude will address each server by name and each instance only ever sees its own cluster.

MCP registry

This server is published on registry.modelcontextprotocol.io

Source: README.md at commit d083672

Tools

0
SourceWeft started this package once in an isolated sandbox, without credentials, to list its tools. That failed: the package type cannot run in the sandbox.

Version history

2
  1. v1.2.2LatestOct 30, 2026
  2. v1.2.1Sep 16, 2026

Score

50% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts

    Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.

  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listed15 pts

    Answer tools/list without a credential, or ship a package that starts in a sandbox without one.

  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts