
MCP Server for Kubernetes Support Bundles

2025.04.15
1
PythonKubernetes诊断AI辅助运维开发效率
troubleshoot-mcp-server 是一个基于 Model Context Protocol (MCP) 的服务器,专门用于 AI 模型与 Kubernetes 支持包的交互。该服务器使 AI 模型能够通过分析由 Troubleshoot 工具生成的 Kubernetes 支持包来诊断和解决 Kubernetes 集群的问题。
View on GitHub
Overview
基本能力
产品定位
troubleshoot-mcp-server 是一个专为 Kubernetes 集群诊断和问题解决设计的 MCP 服务器,通过 AI 模型分析支持包来提供智能化的故障排查能力。
核心功能
- Bundle Management: 初始化和管理 Kubernetes 支持包
- Command Execution: 在支持包的 API 服务器上运行 kubectl 命令
- File Explorer: 浏览和搜索支持包中的文件
- Secure Authentication: 基于令牌的认证机制
- Docker Support: 支持容器化部署
适用场景
- Kubernetes 集群的自动化故障排查
- AI 辅助的集群状态分析
- 开发环境中的快速问题诊断
工具列表
- Bundle Management:
initialize_bundle
- 初始化支持包 - Kubectl Commands:
kubectl
- 执行 kubectl 命令 - File Operations:
list_files
,read_file
,grep_files
- 文件列表、读取和搜索
常见问题解答
- 安装依赖:需 Python 3.13、kubectl 和 sbctl 工具
- 认证问题:需设置
SBCTL_TOKEN
环境变量 - 容器部署:推荐使用 Docker 以避免环境配置问题
使用教程
使用依赖
- Python 3.13
- kubectl 命令行工具
- sbctl 命令行工具
安装教程
使用 Docker
docker build -t mcp-server-troubleshoot:latest .
docker run -i --rm \
-v "/path/to/bundles:/data/bundles" \
-e SBCTL_TOKEN="your-token" \
mcp-server-troubleshoot:latest
手动安装
./scripts/setup_env.sh
# 或
uv venv -p python3.13 .venv
source .venv/bin/activate
uv pip install -e ".[dev]"
export SBCTL_TOKEN=your-token
python -m mcp_server_troubleshoot
调试方式
pytest # 运行所有测试
pytest -v # 详细输出
pytest -m unit # 运行单元测试
black . # 代码格式化
ruff check . # 代码检查