KubeSphere MCP服务器
KubeSphere MCP服务器是 模型上下文协议(MCP) 提供与KubeSphere API集成的服务器,能够从KubeSphere获取资源。分为四个工具模块: Workspace Management, Cluster Management, User and Roles, Extensions Center.
先决条件
您必须拥有一个KubeSphere集群。包含:访问地址、用户名、密码。
安装
生成KSConfig
格式类似于kubeconfig。此配置包含HTTP连接器信息。KubeSphere的默认上下文为 kubesphere,可以通过环境变量进行修改 KUBESPHERE_CONTEXT.```yaml
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:
server:
name: kubesphere
contexts:
- context:
cluster: kubesphere
user: admin
name: kubesphere
current-context: kubesphere
kind: Config
preferences: {}
users:
- name: admin
user:
username:
password:
``: **可选的**通过HTTPS访问KubeSphere时,请以base64编码格式填写CA证书。\
``: **必需** 必须是HTTPS地址。(如果使用HTTP,请在此处输入任何HTTPS地址,然后通过参数进行修改 `--ks-apiserver http://xxx`)\
``: **必需** KubeSphere集群的用户。\
``: **必需** KubeSphere集群用户的密码。
### 获取ks mcp服务器二进制文件
您可以运行命令 `go build -o ks-mcp-server cmd/main.go` 或从(github发布)下载\[https://github.com/kubesphere/ks-mcp-server/releases\]
然后将其移动到 `$PATH`.
### 在AI代理中配置MCP服务器
#### 克劳德桌面
1. 根据 克劳德桌面
应更改MCP配置。比如:```json
{
"mcpServers": {
"KubeSphere": {
"args": [
"stdio",
"--ksconfig", "",
"--ks-apiserver", ""
],
"command": "ks-mcp-server"
}
}
}
: **必需** ksconfig文件的绝对路径。\: 可选(但HTTP访问需要) KubeSphere集群的访问地址,支持 ks-console 或 ks-apiserver 服务地址(例如。, http://172.10.0.1:30880).
- 与mcp服务器聊天
光标
- 根据 卷曲
应更改MCP配置。比如:json { "mcpServers": { "KubeSphere": { "args": [ "stdio", "--ksconfig", "", "--ks-apiserver", "" ], "command": "ks-mcp-server" } } }
: **必需** ksconfig文件的绝对路径。\: 可选(但HTTP访问需要) KubeSphere集群的访问地址,支持 ks-console 或 ks-apiserver 服务地址(例如。, http://172.10.0.1:30880).
- 与mcp服务器聊天
