
KubeSphere MCP Server

2025.04.30
2
GoKubeSphere 集成资源管理开发效率
KubeSphere MCP Server 是一个基于 Model Context Protocol (MCP) 的服务器,提供与 KubeSphere API 的集成,能够从 KubeSphere 获取资源。它分为四个工具模块:工作区管理、集群管理、用户和角色、扩展中心。
View on GitHub
Overview
基本能力
产品定位
KubeSphere MCP Server 是一个用于与 KubeSphere API 集成的 MCP 服务器,主要用于管理和操作 KubeSphere 资源。
核心功能
- 工作区管理:管理和操作 KubeSphere 的工作区资源。
- 集群管理:管理和操作 KubeSphere 的集群资源。
- 用户和角色:管理和操作 KubeSphere 的用户和角色资源。
- 扩展中心:管理和操作 KubeSphere 的扩展资源。
适用场景
- 需要从 KubeSphere 获取资源并进行管理的场景。
- 需要与 KubeSphere API 集成的场景。
- 需要在 MCP 客户端(如 Claude Desktop、Cursor)中使用 KubeSphere 资源的场景。
工具列表
- ks-mcp-server:主服务二进制文件,用于启动 MCP 服务器。
常见问题解答
- 如何生成 KSConfig:KSConfig 的格式类似于 kubeconfig,包含 HTTP 连接器信息。
- 如何获取 ks-mcp-server 二进制文件:可以通过
go build
命令构建或从 GitHub releases 下载。 - 如何配置 MCP 服务器:需要在 MCP 客户端(如 Claude Desktop、Cursor)中配置 MCP 服务器的命令和参数。
使用教程
使用依赖
- 必须有一个 KubeSphere 集群,包含访问地址、用户名和密码。
- 需要获取 ks-mcp-server 二进制文件并将其放入
$PATH
。 - 需要一个 MCP 客户端,如 Claude Desktop 或 Cursor。
安装教程
- 生成 KSConfig: ```yaml apiVersion: v1 clusters:
- cluster: certificate-authority-data: xxxx server: https://kubesphere.com name: kubesphere contexts:
- context: cluster: kubesphere user: admin name: admin@kubesphere current-context: admin@kubesphere kind: Config preferences: {} users:
- name: admin user: username: xxxx password: xxxx ```
- 获取 ks-mcp-server 二进制文件:
bash go build -o ks-mcp-server cmd/main.go
或从 GitHub releases 下载。 - 配置 MCP 服务器:
- Claude Desktop:
json { "mcpServers": { "KS-MCP-Server": { "args": [ "stdio", "--ksconfig", "[to-be-replace]/kubeconfig", "--ks-apiserver", "http://[to-be-replace]:30880" ], "command": "ks-mcp-server" } } }
- Cursor:
json { "mcpServers": { "KS-MCP-Server": { "command": "ks-mcp-server", "args": [ "stdio", "--ksconfig","[to-be-replace]/kubeconfig", "--ks-apiserver","http://[to-be-replace]:30880" ] } } }
调试方式
- 启动 MCP 服务器后,可以在 MCP 客户端中与服务器进行交互。
- 检查日志和输出以确认服务器是否正常运行。