list_contexts
List kube-config contexts
List the contexts (clusters) available in the loaded kube-config.
无需输入参数。

io.github.dockndevai由 GitHub 账号 dockndevai 发布v0.3.3更新于 Oct 26, 2026
Kubernetes monitoring & ops for AI agents — safe-by-default access modes and guards.
本地 MCP 服务器,让 AI 助手跨多个上下文查看和操作 Kubernetes 集群,默认只读并带分层安全限制。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
参照 仓库 中的启动说明。
A Model Context Protocol server for Kubernetes. It lets an MCP-capable client (Claude Desktop, Claude Code, etc.) inspect and operate Kubernetes clusters across multiple contexts — with behaviour controlled entirely by flags.
The design goal is safe by default: it starts read-only, can be scoped to an allowlist of namespaces and contexts, protects system namespaces from mutation, and gates the dangerous operations (delete, apply, exec) behind explicit opt-ins.
context; scope which contexts are usable with an allowlist.read-only → read-write → admin, layered so a mode never exposes tools above its level.The layers are independent — e.g. admin mode with all three opt-ins false can restart and scale deployments but can neither delete resources nor exec into pods.
Read (read-only+): list_contexts, list_namespaces, list_pods, get_pod, get_pod_logs, list_deployments, list_services, list_nodes, list_events, get_resource
Write (read-write+): scale_deployment, restart_deployment, set_deployment_image, create_namespace, apply_manifest (needs K8S_ALLOW_APPLY)
Admin (admin): delete_resource (needs K8S_ALLOW_DELETE), exec_in_pod (needs K8S_ALLOW_EXEC)
Optional AI risk guard. Set K8S_GUARD_MODE=monitor|enforce to have delete_resource, exec_in_pod and apply_manifest consult a local laya-guard daemon (pipx install laya-guard && laya-guard) that classifies the operation allow/confirm/block before it runs. Runs after the delete/exec/apply gates; only tightens, never grants; fails closed.
Published on npm as @dockndevai/mcp-kubernetes. No clone or build needed — your MCP client runs it on demand with npx. Start in read-only mode; see .env.example for every variable and docs/CLIENTS.md for the full per-client guide.
Claude Code (CLI)
Claude Desktop · Cursor · Windsurf — same block in claude_desktop_config.json, .cursor/mcp.json, or ~/.codeium/windsurf/mcp_config.json:
OpenAI Codex CLI — in ~/.codex/config.toml:
VS Code (GitHub Copilot, Agent mode) — in .vscode/mcp.json:
Prefer the published package above. To run from a clone:
This server ships a server.json for the official MCP registry and an mcpName for npm ownership validation. See PUBLISHING.md for publishing to npm and listing on the MCP registry, Smithery, Glama, Cursor, and PulseMCP.
MIT
来源:README.md,提交 abda11f
List kube-config contexts
List the contexts (clusters) available in the loaded kube-config.
无需输入参数。
List namespaces
List namespaces in the cluster. Namespaces outside the allowlist are filtered out.
contextList pods
List pods in a namespace with status, readiness, restarts, and node.
contextnamespace必填Get pod
Fetch the full representation of a single pod.
name必填contextnamespace必填Get pod logs
Fetch recent logs from a pod container.
name必填contextpreviouscontainernamespace必填tailLinesList deployments
List deployments in a namespace with replica status.
contextnamespace必填List services
List services in a namespace with type and cluster IP.
contextnamespace必填List nodes
List cluster nodes with readiness and kubelet version.
contextList events
List recent events in a namespace — useful for diagnosing failures.
contextnamespace必填Get any resource
Read an arbitrary Kubernetes object by apiVersion/kind/name (e.g. apiVersion=apps/v1, kind=Deployment).
kind必填name必填contextnamespaceapiVersion必填已满足适用检查项的 90%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
claude mcp add kubernetes -e KUBECONFIG_PATH="/Users/you/.kube/config" -e K8S_MODE="read-only" -- npx -y @dockndevai/mcp-kubernetes{ "mcpServers": { "kubernetes": { "command": "npx", "args": [ "-y", "@dockndevai/mcp-kubernetes" ], "env": { "KUBECONFIG_PATH": "/Users/you/.kube/config", "K8S_MODE": "read-only" } } }}[mcp_servers.kubernetes]command = "npx"args = ["-y", "@dockndevai/mcp-kubernetes"]env = { KUBECONFIG_PATH = "/Users/you/.kube/config", K8S_MODE = "read-only" }{ "servers": { "kubernetes": { "type": "stdio", "command": "npx", "args": [ "-y", "@dockndevai/mcp-kubernetes" ], "env": { "KUBECONFIG_PATH": "/Users/you/.kube/config", "K8S_MODE": "read-only" } } }}npm installnpm run buildnode dist/index.js # with the environment variables setnpm run dev # watch modenpm test # unit tests for the security policynpm run typecheck