Metoro MCP 服务器允许您通过 Claude 桌面应用程序与您的 Kubernetes 集群交互,它基于开放的 Model Context Protocol(MCP),能让 LLM 应用程序与外部数据源和工具无缝集成。
brew install go,在 Ubuntu 上使用 sudo apt-get install golang。git clone https://github.com/metoro-io/metoro-mcp-server.git# 克隆仓库
git clone https://github.com/metoro-io/metoro-mcp-server.git
cd metoro-mcp-server
# 安装依赖
go mod tidy
# 启动服务器(默认在 :8080 端口)
go run main.go
编辑 config.yaml 文件:
# 数据源配置
data_source:
type: "kubernetes" # 支持的类型:kubernetes, demo
kubernetes_config:
endpoint: "https://your-kubernetes-api-endpoint"
token_path: "/path/to/kubernetes/token"
# 上下文处理配置
context_processor:
enabled: true
filters:
- type: "label" # 根据标签过滤数据
key: "app"
curl -X POST http://localhost:8080/api/v1/metrics/pods \
-H "Content-Type: application/json" \
-d '{"labelSelectors":{"app":"web"}}'
curl http://localhost:8080/api/v1/health/nodes
MCP 服务器支持通过插件扩展功能。将自定义插件放在 plugins/ 目录下,实现 Plugin 接口即可。
type Plugin interface {
Process(context.Context, *models.Request) (*models.Response, error)
}
配置自动化规则以响应特定上下文事件:
编辑 rules.yaml:
rules:
- name: "内存警告处理"
condition: "resource_limits.memory > 80%"
action: "scale_replicas"
parameters:
target replicas: 3
- name: "CPU 使用率优化"
condition: "average_cpu_usage > 70% and day_of_week: ['周一', '周二']"
action: "建议升级配置"
更多关于 Model Context Protocol 的信息,请访问 https://modelcontextprotocol.io
但简单来说:
Model Context Protocol (MCP) 是一个开放协议,使 LLM 应用程序能够与外部数据源和工具无缝集成。无论是构建 AI 驱动的 IDE、增强聊天界面还是创建自定义 AI 工作流程,MCP 都提供了一种标准方式来连接 LLM 与其所需上下文。
Metoro 是一个用于运行在 Kubernetes 上的微服务观测平台,并使用基于 eBPF 的仪器化生成深度 telemetry 而不进行任何代码更改。由 eBPF 代理生成的数据发送到 Metoro 后台存储,并通过 Metoro 前端 API 使用。
此 MCP 服务器通过我们的 APIs 将这些数据暴露给 LLM,因此您可以向 AI 提问关于您的 Kubernetes 集群的问题。
--bind-address 来限制服务监听地址。go run main.go --debug=true
此服务器基于我们的 Golang MCP SDK 构建。