Gigapipe MCP Server
A Machine Control Protocol (MCP) server for Gigapipe, providing a unified interface to query Prometheus metrics, Loki logs, and Tempo traces.
Features
Prometheus Integration
- Query metrics using PromQL
- List all available labels
- Get values for specific labels
- Support for time range queries
Loki Integration
- Query logs using LogQL
- List all available labels
- Get values for specific labels
- Support for time range queries
Tempo Integration
- Query traces by trace ID
- List all available trace tags
- Get values for a specific trace tag
- Support for JSON trace format
Installation
# Clone the repository
git clone https://github.com/lmangani/gigapipe-mcp.git
cd gigapipe-mcp
# Build the server
go build -o gigapipe-mcp
Configuration
The server can be configured using environment variables:
# Required: Gigapipe server address (default: http://localhost:3100)
# Must include protocol (http:// or https://)
export GIGAPIPE_HOST="https://your-host:3100"
# Optional: HTTP Basic Authentication
export GIGAPIPE_USERNAME="your-username"
export GIGAPIPE_PASSWORD="your-password"
Note: If no protocol is specified in GIGAPIPE_HOST, http:// will be used as the default.
Usage
Prometheus Tools
- Query Metrics
# Query metrics with PromQL
prometheus_query --query="rate(http_requests_total[5m])" --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z" --step="1m"
- List Labels
# List all available labels
prometheus_labels --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
- Get Label Values
# Get values for a specific label
prometheus_label_values --label="instance" --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
Loki Tools
- Query Logs
# Query logs with LogQL
loki_query --query='{job="varlogs"}' --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z" --limit="100"
- List Labels
# List all available labels
loki_labels --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
- Get Label Values
# Get values for a specific label
loki_label_values --label="job" --start="2024-01-01T00:00:00Z" --end="2024-01-01T01:00:00Z"
Tempo Tools
- Query Traces
# Query a trace by ID
tempo_query --trace_id="1234567890abcdef"
- List Tags
# List all available trace tags
tempo_tags
- Get Tag Values
# Get values for a specific trace tag
tempo_tag_values --tag="service.name"
API Endpoints
The server communicates with Gigapipe using the following endpoints:
Prometheus
- Query Range:
/api/v1/query_range
- Query:
/api/v1/query
- Labels:
/api/v1/labels
- Label Values:
/api/v1/label/:name/values
Loki
- Query Range:
/loki/api/v1/query_range
- Query:
/loki/api/v1/query
- Labels:
/loki/api/v1/label
- Label Values:
/loki/api/v1/label/:name/values
Tempo
- Query Traces:
/api/traces/:traceId
- Query Traces (JSON):
/api/traces/:traceId/json
- Tags:
/api/search/tags
- Tag Values:
/api/search/tag/{name}/values
Development
Prerequisites
- Go 1.16 or later
- Git
Building from Source
# Clone the repository
git clone https://github.com/lmangani/gigapipe-mcp.git
cd gigapipe-mcp
# Install dependencies
go mod download
# Build the server
go build -o gigapipe-mcp
# Run tests
go test ./...
License
MIT License