MCP server for Prometheus metrics
## Prometheus MCP Server: Metrics Monitoring The **Prometheus MCP Server** integrates Prometheus metrics monitoring into Google Antigravity. This enables collecting, querying, and alerting on time-series metrics for infrastructure and applications. ### Why Prometheus MCP? Prometheus is the monitoring standard: - **CNCF Graduated**: Industry standard - **Pull Model**: Scrape-based collection - **PromQL**: Powerful query language - **Service Discovery**: Auto-find targets - **Alertmanager**: Flexible alerting ### Key Features #### 1. Query Metrics ```python import requests # Instant query response = requests.get( "http://prometheus:9090/api/v1/query", params={"query": "up{job=\"api\"}"} ) for result in response.json()["data"]["result"]: print(f"{result['metric']}: {result['value'][1]}") # Range query response = requests.get( "http://prometheus:9090/api/v1/query_range", params={ "query": "rate(http_requests_total[5m])", "start": "2024-01-01T00:00:00Z", "end": "2024-01-02T00:00:00Z", "step": "1h" } ) ``` #### 2. Push Metrics ```python from prometheus_client import CollectorRegistry, Gauge, push_to_gateway registry = CollectorRegistry() gauge = Gauge("batch_job_duration_seconds", "Duration of batch job", registry=registry) gauge.set(120) push_to_gateway("pushgateway:9091", job="batch_job", registry=registry) ``` #### 3. Manage Alerts ```python # Query active alerts response = requests.get("http://prometheus:9090/api/v1/alerts") for alert in response.json()["data"]["alerts"]: print(f"Alert: {alert['labels']['alertname']}") print(f"State: {alert['state']}") ``` ### Configuration ```json { "mcpServers": { "prometheus": { "command": "npx", "args": ["-y", "@anthropic/mcp-prometheus"], "env": { "PROMETHEUS_URL": "http://prometheus:9090" } } } } ``` ### Use Cases **Infrastructure Monitoring**: Track servers and containers. **Application Metrics**: Custom application metrics. **Alerting**: Threshold-based alerts. The Prometheus MCP Server brings metrics monitoring to Antigravity.
{
"mcpServers": {
"prometheus": {
"mcpServers": {
"prometheus": {
"env": {
"PROMETHEUS_URL": "http://localhost:9090"
},
"args": [
"prometheus-mcp"
],
"command": "uvx"
}
}
}
}
}