MCP(模型上下文协议)服务器是一款用于管理 Kubernetes 环境中支持捆绑包的工具。它具备丰富功能,可实现捆绑包管理、文件操作以及 kubectl 命令执行,为 Kubernetes 环境管理提供了便利。
# 克隆仓库
git clone https://github.com/your-username/mcp-server-troubleshoot.git
cd mcp-server-troubleshoot
# 创建虚拟环境
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 安装依赖
pip install -r requirements.txt
# 启动服务器
python src/mcp_server_troubleshoot/__main__.py
# 克隆仓库
git clone https://github.com/your-username/mcp-server-troubleshoot.git
cd mcp-server-troubleshoot
# 创建虚拟环境
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 安装开发依赖
pip install -e ".[dev]"
from mcp_server_troubleshoot import kubectl
# 执行 Kubectl 命令
result = kubectl.execute("get pods")
print(result)
.
├── README.md # 项目概述
├── docs/ # 文档
│ ├── agentic/ # AI 代理文档
│ ├── components/ # 组件设计文档
│ └── examples/ # 示例提示和使用案例
└── src/ # 源代码
└── mcp_server_troubleshoot/
├── __init__.py
├── __main__.py # 入口点
├── bundle.py # 捆绑包管理
├── cli.py # CLI 接口
├── config.py # 配置管理
├── files.py # 文件操作
├── kubectl.py # Kubectl 命令执行
└── server.py # MCP 服务器实现
# 使用 Black 格式化代码
black .
# 使用 Ruff 检查代码规范
ruff check .
# 运行所有测试
pytest
# 运行带有详细输出的测试
pytest -v
# 运行特定类型的测试
pytest -m unit
pytest -m integration
pytest -m e2e
# 以详细警告模式运行测试
pytest -W all
# 将警告视为错误运行测试
pytest -W error
| 属性 | 详情 |
|---|---|
| 运行环境 | Python 3.13 |
| 命令行工具 | kubectl 命令行工具,sbctl 命令行工具用于捆绑包管理 |
| 认证令牌 | 环境变量:SBCTL_TOKEN 或 REPLICATED |
所有依赖项均已包含在 Podman 容器中,这是推荐的部署方法。
本项目 licensed under Apache License 2.0 - 详见LICENSE文件。
💡 使用建议
欢迎贡献代码!请参考开发者指南了解如何贡献。