简介
用 k8s-mcp-server 把支持 MCP 的助手接入 Kubernetes/Helm 操作,并通过参数明确运行模式与权限边界。
k8s-mcp-server 用 Go 构建并以 MCP 暴露 Kubernetes 工具:支持 stdio/SSE/streamable-http 多种模式,并可用只读选项降低风险,适合把集群操作标准化为工具调用。
适合谁: 想要把 Kubernetes 工具以 MCP 方式暴露,并需要明确运行模式(CLI/Web)的平台工程师
可搭配: Go、kubeconfig 或环境变量方式鉴权集群、MCP 客户端(stdio)或 Web 传输(SSE/streamable-http)
上手时间: 约 10–20 分钟(clone + go build + 首次配置)
关键事实(已验证)
- GitHub:155 stars · 37 forks · 最近更新 2026-05-11。
- 许可证:MIT(GitHub API 已验证仓库 URL / 头像等基础信息)。
- 入口命令(基于 README):
go build -o k8s-mcp-server main.go。
主要内容
- 首次运行建议加
--read-only;确认鉴权与命名空间范围后再逐步放开写能力。 - 桌面客户端用 stdio,Web 部署用 SSE/HTTP;不同环境分开配置,避免混用。
- kubeconfig 与 token 不要进 prompt;按文档用环境变量与挂载路径传递。
README 摘录(来源)
# Kubernetes MCP Server
A Kubernetes Model Context Protocol (MCP) server that provides tools for interacting with Kubernetes clusters through a standardized interface.
## Hosted deployment
A hosted deployment is available on [Fronteir AI](https://fronteir.ai/mcp/reza-gholizade-k8s-mcp-server).
## Features
- **API Resource Discovery**: Get all available API resources in your Kubernetes cluster.
- **Resource Listing**: List resources of any type with optional namespace and label filtering.
- **Resource Details**: Get detailed information about specific Kubernetes resources.
- **Resource Description**: Get comprehensive descriptions of Kubernetes resources, similar to `kubectl describe`.
- **Pod Logs**: Retrieve logs from specific pods (optionally from a specific container, or all containers if unspecified).
- **Node Metrics**: Get resource usage metrics for specific nodes.
- **Pod Metrics**: Get CPU and Memory metrics for specific pods.
- **Event Listing**: List events within a namespace or for a specific resource.
- **Resource Creation/Updating**: Create new Kubernetes resources or update existing ones from a YAML or JSON manifest.FAQ
Q: 支持哪些模式? A: README 说明了 stdio、SSE、streamable-http 三种模式及参数/环境变量。
Q: 能只读运行吗?
A: 可以;按文档使用 --read-only。
Q: 怎么做鉴权更合适? A: 优先用 kubeconfig 的环境变量/挂载方式,避免把 token 直接贴进聊天。