Gigapipe 的机器控制协议(MCP)服务器,提供统一接口来查询 Prometheus 指标、Loki 日志和 Tempo 追踪数据。
# 克隆仓库
git clone https://github.com/lmangani/gigapipe-mcp.git
cd gigapipe-mcp
# 构建服务器
go build -o gigapipe-mcp
服务器可以使用环境变量进行配置:
# 必需:Gigapipe 服务器地址(默认:http://localhost:3100)
# 必须包含协议(http:// 或 https://)
export GIGAPIPE_HOST="https://your-host:3100"
# 可选:HTTP 基本认证
export GIGAPIPE_USERNAME="your-username"
export GIGAPIPE_PASSWORD="your-password"
注意:如果 GIGAPIPE_HOST 中未指定协议,将默认使用 http://。
# 使用 PromQL 查询指标
prometheus_query --query="rate(http_requests_total[5m])" --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z" --step="1m"
# 列出所有可用标签
prometheus_labels --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
# 获取特定标签的值
prometheus_label_values --label="instance" --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
# 使用 LogQL 查询日志
loki_query --query='{job="varlogs"}' --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z" --limit="100"
# 列出所有可用标签
loki_labels --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
# 获取特定标签的值
loki_label_values --label="job" --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
# 按 ID 查询追踪数据
tempo_query --trace_id="1234567890abcdef"
# 列出所有可用的追踪标签
tempo_tags
# 获取特定追踪标签的值
tempo_tag_values --tag="service.name"
服务器通过以下端点与 Gigapipe 进行通信:
/api/v1/query_range/api/v1/query/api/v1/labels/api/v1/label/:name/values/loki/api/v1/query_range/loki/api/v1/query/loki/api/v1/label/loki/api/v1/label/:name/values/api/traces/:traceId/api/traces/:traceId/json/api/search/tags/api/search/tag/{name}/values# 克隆仓库
git clone https://github.com/lmangani/gigapipe-mcp.git
cd gigapipe-mcp
# 安装依赖
go mod download
# 构建服务器
go build -o gigapipe-mcp
# 运行测试
go test ./...
本项目采用 MIT 许可证。