
用于 Kubernetes 管理命令的 MCP 服务器
概览
MCP 服务器可以连接到 Kubernetes 集群并加以管理。支持优先级顺序从多个源加载 kubeconfig。 https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed 在使用该MCP服务器使用任何工具之前,请确保您具备: 1. kubectl 已安装并集成在你的 PATH 中 2.一个有效的 kubeconfig 文件,上下文配置 3.访问为 Kubernetes 配置的 Kubernetes 集群(例如 minikube、Rancher Desktop、GKE 等)4. Helm v3 已安装并集成在你的 PATH(无需 Tiller)。如果你不打算使用 Helm 也可以选择。 你可以通过在终端里运行kubectl get pods来验证连接,确保你能无凭证问题地连接到集群。 默认情况下,服务器从 ~/.kube/config 加载 kubeconfig。关于更多认证选项(环境变量、自定义路径等),请参见 ADVANCED_README.md。
概述(AI 翻译)
MCP 服务器可以连接到 Kubernetes 集群并加以管理。支持优先级顺序从多个源加载 kubeconfig。
https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed
安装与使用
先决条件
在使用该MCP服务器使用任何工具之前,请确保您具备:
- kubectl已安装并纳入你的PATH
- 一个有效的kubeconfig文件,并配置了上下文
- 访问为 kubectl 配置的 Kubernetes 集群(例如 minikube、Rancher Desktop、GKE 等)
- Helm v3已安装并安装在你的PATH中(无需耕耘机)。如果你不打算使用Helm,这是可选的。
你可以通过在终端中运行kubectl get pods来验证连接,确保你能无凭证问题地连接到集群。
默认情况下,服务器从 ~/.kube/config 加载 kubeconfig。关于更多认证选项(环境变量、自定义路径等),请参见 ADVANCED_README.md。
克劳德·科德
使用内置命令将MCP服务器添加到Claude代码中:
这会自动在你的Claude Code MCP设置中配置服务器。
法典
使用内置命令将MCP服务器添加到Codex CLI:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Server Kubernetes
MCP Server that can connect to a Kubernetes cluster and manage it. Supports loading kubeconfig from multiple sources in priority order.
https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed
Installation & Usage
Prerequisites
Before using this MCP server with any tool, make sure you have:
- kubectl installed and in your PATH
- A valid kubeconfig file with contexts configured
- Access to a Kubernetes cluster configured for kubectl (e.g. minikube, Rancher Desktop, GKE, etc.)
- Helm v3 installed and in your PATH (no Tiller required). Optional if you don’t plan to use Helm.
You can verify your connection by running kubectl get pods in a terminal to ensure you can connect to your cluster without credential issues.
By default, the server loads kubeconfig from ~/.kube/config. For additional authentication options (environment variables, custom paths, etc.), see ADVANCED_README.md.
Claude Code
Add the MCP server to Claude Code using the built-in command:
claude mcp add kubernetes -- npx mcp-server-kubernetes
This will automatically configure the server in your Claude Code MCP settings.
Codex
Add the MCP server to Codex CLI using the built-in command:
codex mcp add kubernetes -- npx mcp-server-kubernetes
This registers the server globally in ~/.codex/config.toml and makes its tools available in all Codex sessions.
Claude Desktop
Add the following configuration to your Claude Desktop config file:
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["mcp-server-kubernetes"]
}
安装
npx mcp-server-kubernetes配置
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["mcp-server-kubernetes"]
}
}
}