
K8s MCP Server (Go)
io.github.kaneg由 GitHub 账号 kaneg 发布v0.4.6更新于 Oct 24, 2026
Safe Kubernetes access for AI agents via MCP. Read-only by default, with explicit permission modes.
概览
本地运行的 Kubernetes MCP 服务器,默认只读,让 AI 助手安全查看集群,并可选择 readwrite 或 dangerous 权限模式。
- 可以做什么
- 查看 Pod、Deployment、StatefulSet、Service、ConfigMap、Secret、PVC、Ingress、Job、节点与命名空间,含详情与日志
- 读取事件、集群概览,以及节点和 Pod 的实时 CPU/内存用量
- 将应用或工作负载名称解析为对应资源并建议后续工具
- readwrite 模式下:扩缩容、重启、打补丁、更新镜像、创建命名空间、查看发布状态
- dangerous 模式下:删除 Pod、Deployment、StatefulSet、DaemonSet、命名空间或其他资源,并应用任意 YAML
- 适用场景
- 适合让助手协助排查 Kubernetes 问题,例如异常 Pod、内存占用过高、告警事件、发布失败,而不必交出不受限制的 kubectl。仅在需要受控运维操作时使用 readwrite,只有确实需要完全控制集群时才用 dangerous。
- 运行要求
- 作为本地进程在用户机器上运行(仅桌面端),通过对应平台的 MCPB 安装包或原生二进制安装,无需 Docker 或 Go。需要能访问 Kubernetes 集群:kubeconfig 文件、KUBECONFIG 环境变量或集群内 ServiceAccount 凭据。权限模式在启动时指定。
安装
在 SourceWeft 中
- 打开 控制台中的 K8s MCP Server (Go),将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
k8s-mcp-go
Safe, read-only-by-default Kubernetes access for AI agents.
A Kubernetes MCP server that lets AI assistants inspect your cluster safely — without giving them unrestricted kubectl.
[GitHub release] [License] [Go] [MCP]
What makes it different
- Read-only by default: useful for diagnosis without giving AI permission to mutate the cluster.
- Explicit permission modes: choose
readonly,readwrite, ordangerousbefore the assistant starts. - No Docker required: install via MCPB bundles or a single native binary.
- Kubernetes-native visibility: inspect pods, deployments, services, logs, events, nodes, and live CPU/memory usage.
- Registry-ready distribution: published as
io.github.kaneg/k8s-mcp-gofor MCP Registry consumers and packaged clients.
Distribution
- MCP Registry: published as
io.github.kaneg/k8s-mcp-go. - PulseMCP: indexed from the MCP ecosystem with the official
server.json. - Claude Code Marketplaces: listed with MCPB installation metadata.
Why
Most AI agents can use Kubernetes tools. The real problem is how to stop them from changing the wrong thing.
Giving an AI raw kubectl access is risky. Even a capable model can:
- delete the wrong resource
- restart the wrong workload
- apply a dangerous change
- turn a debugging session into a production incident
k8s-mcp-go gives AI agents a guardrailed interface to Kubernetes instead of unrestricted shell access.
It is built for the real-world question:
How can I let AI help with Kubernetes, without letting it break my cluster?
Permission Modes
You choose the boundary up front:
readonly (default)
For diagnosis, inspection, and safe exploration.
AI can do things like:
- list pods, deployments, services, nodes, and namespaces
- read logs and events
- inspect cluster state
- check resource usage
It cannot modify workloads or delete resources.
readwrite
For controlled operational workflows.
AI can do things like:
- scale deployments
- restart deployments
- restart statefulsets
- update images
- patch deployments
- create namespaces
It still cannot perform the most destructive operations.
dangerous
Full access.
Use this only when you explicitly want AI to be able to:
- delete resources
- delete namespaces
- apply arbitrary YAML
If you are unsure, use readonly.
Quick Start
Option 1: MCPB Install (Recommended)
Download the .mcpb bundle for your platform from Releases. MCPB-compatible clients (Claude Desktop, Cursor, etc.) can install it directly — no Docker, no Go, no manual setup.
Option 2: Manual Binary Install
Grab the binary archive from Releases and extract it:
Then add it to your MCP client.
Claude Desktop (claude_desktop_config.json):
Cursor (.cursor/mcp.json):
Restart your client and start asking questions about your cluster.
Example prompts
Once installed, ask your AI assistant things like:
- "Show me unhealthy pods in all namespaces."
- "Which pods are using the most memory?"
- "Summarize recent warning events."
- "Inspect this deployment and explain why it is not ready."
- "Check rollout status for this deployment."
In readonly mode, the assistant can investigate but cannot change the cluster.
Why not just use kubectl?
Because the problem is not whether AI can talk to Kubernetes. The problem is whether it can do so safely.
kubectl is powerful, but it does not give you a product-level permission mode for AI behavior.
With k8s-mcp-go, you decide whether the assistant can:
- inspect only
- perform limited operational actions
- or get full control
The permission boundary is the product.
Available Tools (35 total)
Tools are grouped by permission level.
Names start with an action verb such as get, list, or delete; top_nodes
and top_pods retain Kubernetes' established kubectl top terminology.
Readonly (24)
Readwrite (7)
Dangerous (7)
Prefer the dedicated delete tools above when one exists. Use delete_resource
as the fallback for other kinds. It resolves namespaced versus cluster-scoped
resources through Kubernetes discovery.
Kubernetes Configuration
Configuration is selected in this order:
- The file specified by
KUBECONFIG, when set. - The Pod's in-cluster ServiceAccount configuration.
~/.kube/configwhen running outside a cluster.
An explicit KUBECONFIG is authoritative. If it cannot be loaded, the server
returns an error instead of silently switching to the Pod's ServiceAccount.
In-cluster configuration uses Kubernetes' mounted token file so projected
ServiceAccount token rotation continues to work without copying tokens into a
kubeconfig.
Environment Variables
Build from Source
License
MIT
来源:README.md,提交 889ed38
工具
0版本历史
1- v0.4.6最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分

