KubeSphere MCP Server

KubeSphere MCP Server

site icon
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 资源。

核心功能

  1. 工作区管理:管理和操作 KubeSphere 的工作区资源。
  2. 集群管理:管理和操作 KubeSphere 的集群资源。
  3. 用户和角色:管理和操作 KubeSphere 的用户和角色资源。
  4. 扩展中心:管理和操作 KubeSphere 的扩展资源。

适用场景

  1. 需要从 KubeSphere 获取资源并进行管理的场景。
  2. 需要与 KubeSphere API 集成的场景。
  3. 需要在 MCP 客户端(如 Claude Desktop、Cursor)中使用 KubeSphere 资源的场景。

工具列表

  1. ks-mcp-server:主服务二进制文件,用于启动 MCP 服务器。

常见问题解答

  1. 如何生成 KSConfig:KSConfig 的格式类似于 kubeconfig,包含 HTTP 连接器信息。
  2. 如何获取 ks-mcp-server 二进制文件:可以通过 go build 命令构建或从 GitHub releases 下载。
  3. 如何配置 MCP 服务器:需要在 MCP 客户端(如 Claude Desktop、Cursor)中配置 MCP 服务器的命令和参数。

使用教程

使用依赖

  1. 必须有一个 KubeSphere 集群,包含访问地址、用户名和密码。
  2. 需要获取 ks-mcp-server 二进制文件并将其放入 $PATH
  3. 需要一个 MCP 客户端,如 Claude Desktop 或 Cursor。

安装教程

  1. 生成 KSConfig: ```yaml apiVersion: v1 clusters:
  2. cluster: certificate-authority-data: xxxx server: https://kubesphere.com name: kubesphere contexts:
  3. context: cluster: kubesphere user: admin name: admin@kubesphere current-context: admin@kubesphere kind: Config preferences: {} users:
  4. name: admin user: username: xxxx password: xxxx ```
  5. 获取 ks-mcp-server 二进制文件bash go build -o ks-mcp-server cmd/main.go 或从 GitHub releases 下载。
  6. 配置 MCP 服务器
  7. Claude Desktopjson { "mcpServers": { "KS-MCP-Server": { "args": [ "stdio", "--ksconfig", "[to-be-replace]/kubeconfig", "--ks-apiserver", "http://[to-be-replace]:30880" ], "command": "ks-mcp-server" } } }
  8. Cursorjson { "mcpServers": { "KS-MCP-Server": { "command": "ks-mcp-server", "args": [ "stdio", "--ksconfig","[to-be-replace]/kubeconfig", "--ks-apiserver","http://[to-be-replace]:30880" ] } } }

调试方式

  1. 启动 MCP 服务器后,可以在 MCP 客户端中与服务器进行交互。
  2. 检查日志和输出以确认服务器是否正常运行。

许可证

该项目遵循 Apache-2.0 开源许可条款,请参阅 Apache-2.0 了解完整条款。