Command Palette

Search for a command to run...

UnylyUnyly
Весь каталог

K8s Readonly

БесплатноНе проверен

A read-only MCP server for inspecting Kubernetes clusters, allowing LLMs to list resources, describe pods, and read logs without mutation.

GitHubEmbed

Описание

A read-only MCP server for inspecting Kubernetes clusters, allowing LLMs to list resources, describe pods, and read logs without mutation.

README

A read-only Model Context Protocol (MCP) server that lets an LLM inspect a Kubernetes cluster — list pods, read logs, describe resources — but never mutate it.

Why I built it

I spend a lot of time embedded in customer Kubernetes environments. The most common thing I want from an LLM is "help me understand what's happening in this cluster" — without ever giving it the ability to change anything. So I built the safety in structurally rather than trusting the model to behave.

Every tool call routes through a single function that checks the kubectl verb against an allow-list of read-only verbs (get, describe, logs, top, …). There is no code path that can apply, delete, scale, or exec. If the model asks for a mutation, the server refuses. This is the same least-privilege, human-in-the-loop instinct that any production agent needs.

What it does

Tool Description
list_namespaces List all namespaces
list_pods List pods in a namespace (or all namespaces)
describe_pod Full status, events, and config for one pod
get_pod_logs Last N lines of a pod's logs
list_deployments Deployments and their ready/up-to-date status

Quick start

# 1. Install (using uv — https://docs.astral.sh/uv/)
uv sync

# 2. Make sure kubectl points at a cluster.
#    A local cluster is perfect for trying this safely:
#    kind create cluster   (or: minikube start)
kubectl get nodes

# 3. Run the server
uv run k8s-readonly-mcp

Connect it to Claude Desktop

Add this to your Claude Desktop MCP config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "k8s-readonly": {
      "command": "uv",
      "args": ["--directory", "/absolute/path/to/k8s-readonly-mcp", "run", "k8s-readonly-mcp"]
    }
  }
}

Then ask Claude things like "What pods are failing in the default namespace, and why?" — it will call list_pods and describe_pod, reason over the output, and explain — but it physically cannot change your cluster.

Design decisions

  • Allow-list, not block-list. I enumerate what's permitted rather than trying to block bad verbs. A block-list is one forgotten verb away from a mutation; an allow-list fails closed.
  • One chokepoint. All kubectl execution goes through _run_kubectl. The security boundary is one function you can audit in 30 seconds.
  • Timeouts and clear errors. Calls time out and surface kubectl's stderr instead of hanging or failing silently — the model gets actionable feedback.

What I'd do next

  • Add resource-level scoping (restrict to specific namespaces per connection).
  • Stream large log outputs instead of buffering.
  • Add a small eval that checks the server refuses every mutating verb.

License

MIT — see LICENSE.

from github.com/ziyuyu23/k8s-readonly-mcp

Установка K8s Readonly

У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.

▸ github.com/ziyuyu23/k8s-readonly-mcp

FAQ

K8s Readonly MCP бесплатный?

Да, K8s Readonly MCP бесплатный — установка в пару кликов через Unyly без оплаты.

Нужен ли API-ключ для K8s Readonly?

Нет, K8s Readonly работает без API-ключей и переменных окружения.

K8s Readonly — hosted или self-hosted?

Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.

Как установить K8s Readonly в Claude Desktop, Claude Code или Cursor?

Открой K8s Readonly на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.

Похожие MCP

Compare K8s Readonly with

Не уверен что выбрать?

Найди свой стек за 60 секунд

Автор?

Embed-бейдж для README

Похожее

Все в категории development