A Model Context Protocol (MCP) server that provides seamless integration with Prometheus, enabling AI assistants to query metrics, discover available data, and analyze system performance through natural language interactions.
- Real-time Metrics Access - Query current and historical metrics data
- Metrics Discovery - Find available metrics and monitoring targets
- Multiple Auth Methods - Basic auth, bearer tokens, and TLS support
- Type-safe - Full TypeScript implementation
Add to your MCP client settings:
{
"mcpServers": {
"prometheus": {
"command": "npx",
"args": ["prometheus-mcp-server"],
"env": {
"PROMETHEUS_URL": "http://localhost:9090"
}
}
}
}
First install the package globally:
npm install -g prometheus-mcp-server
Then configure your MCP client:
{
"mcpServers": {
"prometheus": {
"command": "prometheus-mcp-server",
"env": {
"PROMETHEUS_URL": "http://localhost:9090"
}
}
}
}
# Required
PROMETHEUS_URL=http://localhost:9090
# Optional Authentication
PROMETHEUS_USERNAME=admin
PROMETHEUS_PASSWORD=password
PROMETHEUS_TOKEN=bearer-token
# Optional Connection
PROMETHEUS_TIMEOUT=10000
PROMETHEUS_INSECURE=false
Tool | Description | Use Case |
---|---|---|
prom_query |
Execute PromQL instant query | Get current metric values, alerts status |
prom_range |
Execute PromQL range query | Analyze trends, create graphs, historical data |
prom_discover |
Discover available metrics | Explore what metrics are available in your system |
prom_metadata |
Get metric metadata | Understand metric types, descriptions, and units |
prom_targets |
Get scrape targets info | Monitor scraping health and service discovery |
Ask your AI assistant natural language questions:
- "What's the current CPU usage across all servers?"
- "Show me HTTP request rates for the last 6 hours"
- "Which services have the highest memory consumption?"
- "Are there any failing health checks?"
- "What metrics are available for monitoring my database?"
# Run with inspector
npm run inspector
# Run directly
npm run dev
export PROMETHEUS_URL=http://localhost:9090
export PROMETHEUS_URL=http://localhost:9090
export PROMETHEUS_USERNAME=admin
export PROMETHEUS_PASSWORD=secret
export PROMETHEUS_URL=https://prometheus.example.com:9090
export PROMETHEUS_TOKEN=your-bearer-token
For self-signed certificates or development:
export PROMETHEUS_INSECURE=true
MIT