
一个模型上下文协议(MCP)服务器,使AI助手能够与Kubernetes集互。
概览
mcp-kubernetes-server 是一个实现模型上下文协议(MCP)的服务器,使 AI 助手(如 Claude、Cursor 和 GitHub Copilot)能够与 Kubernetes 集互。它充当桥梁,将这些助手的自然语言请求翻译成 Kubernetes 操作并返回结果。 - 查询 Kubernetes 资源 - 执行 kubectl 命令 - 通过自然语言交互管理 Kubernetes 集群 - 诊断并解释 Kubernetes 资源状态 mcp-kubernetes-server 作为支持 Model Context 协议的 AI 助手与 Kubernetes 集群之间的中介。它接收这些助手的自然语言请求,将其翻译成 kubectl 命令或直接的 Kubernetes API 调用,并对目标集群执行。服务器随后处理结果并返回结构化响应,使 AI 助手能够无缝与你的 Kubernetes 环境交互。
概述(AI 翻译)
mcp-kubernetes-server 是一个服务器,实现了模型上下文协议(MCP),使 AI 助手(如 Claude、Cursor 和 GitHub Copilot)能够与 Kubernetes 集互。它作为桥梁,将这些助手的自然语言请求转换为 Kubernetes 操作并返回结果。
它允许人工智能助理:
- 查询 Kubernetes 资源
- 执行 kubectl 命令
- 通过自然语言交互管理Kubernetes集群
- 诊断和解释Kubernetes资源的状态
工作原理
mcp-kubernetes-server 作为支持 Model Context 协议的 AI 助手与你的 Kubernetes 集群之间的中介。它接收这些助手的自然语言请求,将其翻译成 kubectl 命令或直接调用 Kubernetes API,并对目标集群执行。服务器随后处理结果并返回结构化响应,使通过 AI 助手实现与 Kubernetes 环境的无缝交互。
如何安装
先决条件
在安装mcp-kubernetes-server之前,请确保您具备以下条件:
- 一个可运行的Kubernetes集群。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
mcp-kubernetes-server
The mcp-kubernetes-server is a server implementing the Model Context Protocol (MCP) to enable AI assistants (such as Claude, Cursor, and GitHub Copilot) to interact with Kubernetes clusters. It acts as a bridge, translating natural language requests from these assistants into Kubernetes operations and returning the results.
It allows AI assistants to:
- Query Kubernetes resources
- Execute kubectl commands
- Manage Kubernetes clusters through natural language interactions
- Diagnose and interpret the states of Kubernetes resources
How It Works
The mcp-kubernetes-server acts as an intermediary between AI assistants (that support the Model Context Protocol) and your Kubernetes cluster. It receives natural language requests from these assistants, translates them into kubectl commands or direct Kubernetes API calls, and executes them against the target cluster. The server then processes the results and returns a structured response, enabling seamless interaction with your Kubernetes environment via the AI assistant.

How To Install
Prerequisites
Before installing mcp-kubernetes-server, ensure you have the following:
- A working Kubernetes cluster.
- A
kubeconfigfile correctly configured to access your Kubernetes cluster (the server requires this file for interaction). - The
kubectlcommand-line tool installed and in your system’s PATH (used by the server to execute many Kubernetes commands). - The
helmcommand-line tool installed and in your system’s PATH (used by the server for Helm chart operations). - Python >= 3.11, if you plan to install and run the server directly using
uvx(without Docker).
Docker
Get your kubeconfig file for your Kubernetes cluster and setup in the mcpServers (replace src path with your kubeconfig path):
{
"mcpServers": {
"kubernetes": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/home/username/.kube/config,dst=/home/mcp/.kube/config",
"ghcr.io/feiskyer/mcp-kubernetes-server"
]
}
}
}
UVX
To run the server using uvx (a tool included with uv, the Python packager), first ensure uv is installed:
Install uv if it’s not installed yet and add it to your PATH, e.g. using curl:
# For Linux and MacOS
安装
docker run -i --rm --mount type=bind src=/home/username/.kube/config dst=/home/mcp/.kube/config ghcr.io/feiskyer/mcp-kubernetes-server配置
{
"mcpServers": {
"kubernetes": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"--mount", "type=bind,src=/home/username/.kube/config,dst=/home/mcp/.kube/config",
"ghcr.io/feiskyer/mcp-kubernetes-server"
]
}
}
}