使用说明
Kubernetes MCP服务器
一个后端系统,提供交互式和可扩展的接口,用于管理Kubernetes资源、检索和分析日志,以及格式化日志以通过模型上下文协议(MCP)导出。
特性
- Kubernetes资源(Pod、服务、命名空间、部署等)上的CRUD操作
- 日志检索和模式搜索
- 以多种格式(明文、JSON、CSV、NDJSON)格式化和导出日志
- 用于未来增强的可扩展架构
需求
- 转到1.24+
- Kubernetes集群访问
- kubectl已配置
安装
# Clone the repository
git clone https://github.com/mayukhsarkar/k8s-mcp-server.git
cd k8s-mcp-server
# Build the binary
go build -o k8s-mcp-server
# Run the server
./k8s-mcp-server serve
用法
# Start the MCP server
./k8s-mcp-server serve
# Get help
./k8s-mcp-server --help
API文档
MCP服务器公开HTTP端点,用于与Kubernetes资源和日志进行交互。
Kubernetes操作
POST /api/v1/resources/{resource_type}-创建资源GET /api/v1/resources/{resource_type}-列出资源GET /api/v1/resources/{resource_type}/{name}-获取资源详细信息DELETE /api/v1/resources/{resource_type}/{name}-删除资源
日志操作
GET /api/v1/logs/{namespace}/{pod}-从pod获取日志GET /api/v1/logs/search-使用模式匹配搜索日志GET /api/v1/logs/export-以各种格式导出日志
许可证
麻省理工学院