返回市场
键接MCP服务器

键接MCP服务器

作者:kubesphere13 星标更新:2025-05-07

项目介绍

KubeSphere MCP 服务器

KubeSphere MCP 服务器是一个模型上下文协议(MCP)服务器,提供与 KubeSphere API 的集成,使用户能够从 KubeSphere 获取资源。该服务器分为四个工具模块:工作区管理集群管理用户和角色扩展中心

预备条件

您必须拥有一个 KubeSphere 集群。包括:访问地址、用户名、密码。

安装

生成 KSConfig

格式类似于 kubeconfig。此配置包含 HTTP 连接器信息。KubeSphere 的默认上下文是 kubesphere,可以通过环境变量 KUBESPHERE_CONTEXT 进行修改。

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: <CA 文件>
    server: <服务器地址>
  name: kubesphere
contexts:
- context:
    cluster: kubesphere
    user: admin
  name: kubesphere
current-context: kubesphere
kind: Config
preferences: {}
users:
- name: admin
  user:
    username: <KubeSphere 用户名>
    password: <KubeSphere 密码>

<CA 文件>: 可选。当通过 HTTPS 访问 KubeSphere 时,需要填写 base64 编码格式的 CA 证书。
<服务器地址>: 必需 必须是一个 HTTPS 地址。(如果使用 HTTP,请在此处输入任意 HTTPS 地址,然后通过参数 --ks-apiserver http://xxx 进行修改)
<KubeSphere 用户名>: 必需 KubeSphere 集群的用户。
<KubeSphere 密码>: 必需 KubeSphere 集群用户的密码。

获取 ks-mcp-server 二进制文件

您可以运行命令 go build -o ks-mcp-server cmd/main.go 或从 GitHub 发布页面下载,并将其移动到 $PATH

在 AI 代理中配置 MCP 服务器

Claude Desktop

  1. 根据 Claude Desktop 应该更改 MCP 配置。例如:
{
  "mcpServers": {
    "KubeSphere": {
      "args": [
        "stdio",
        "--ksconfig", "<ksconfig 文件绝对路径>",
        "--ks-apiserver", "<KubeSphere 地址>"
      ],
      "command": "ks-mcp-server"
    }
  }
}

<ksconfig 文件绝对路径>: 必需 ksconfig 文件的绝对路径。
<KubeSphere 地址>: 可选(但 HTTP 访问时必需) KubeSphere 集群的访问地址,支持 ks-consoleks-apiserver 服务地址(例如:http://172.10.0.1:30880)。

  1. 与 mcp 服务器聊天 Claude Desktop 结果

Cursor

  1. 根据 Cursor 应该更改 MCP 配置。例如:
{
  "mcpServers": {
    "KubeSphere": {
      "args": [
        "stdio",
        "--ksconfig", "<ksconfig 文件绝对路径>",
        "--ks-apiserver", "<KubeSphere 地址>"
      ],
      "command": "ks-mcp-server"
    }
  }
}

<ksconfig 文件绝对路径>: 必需 ksconfig 文件的绝对路径。
<KubeSphere 地址>: 可选(但 HTTP 访问时必需) KubeSphere 集群的访问地址,支持 ks-consoles-apiserver 服务地址(例如:http://172.10.0.1:30880)。

  1. 与 mcp 服务器聊天 Cursor 结果