Query Prometheus Metrics with Natural Language
Query Prometheus metrics via natural language - instant/range queries, discovery, metadata, and target health, TypeScript-based.
Why it matters
Integrate AI assistants with Prometheus to query system metrics, discover available data, and analyze performance using natural language prompts.
Outcomes
What it gets done
Execute PromQL queries for real-time and historical data analysis.
Discover available metrics and their metadata within your Prometheus instance.
Monitor scrape target health and service discovery status.
Analyze system performance trends and identify potential issues.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-prometheus-typescript | bash Capabilities
Tools your agent gets
Execute an instant PromQL query to get current metric values and alert status
Execute a range PromQL query to analyze trends, create graphs, and access historical data
Discover available metrics and explore what metrics are available in your system
Get metric metadata including types, descriptions, and units of measurement
Get scrape target information to monitor scraping health and service discovery
Overview
Prometheus (TypeScript) MCP Server
prometheus-mcp-server is a TypeScript MCP server that lets an AI assistant query Prometheus metrics via instant/range PromQL, discover available data, get metric metadata, and check scrape target health, supporting basic auth, bearer tokens, and TLS. Use it for conversational Prometheus metric querying and discovery. Only use PROMETHEUS_INSECURE=true for local development with self-signed certificates, not production.
What it does
prometheus-mcp-server is a TypeScript MCP server that connects AI assistants to Prometheus, letting them query current and historical metrics, discover available data, and analyze system performance through natural language, with support for basic auth, bearer tokens, and TLS.
When to use - and when NOT to
Use it when you want to ask questions like "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?", or "Are there any failing health checks?" and have the AI translate that into the right PromQL query or discovery call. Do not use PROMETHEUS_INSECURE=true outside development/testing with self-signed certificates - it's meant for local dev convenience, not production TLS bypass.
Capabilities
prom_query: execute an instant PromQL query (current metric values, alert status).prom_range: execute a range PromQL query (trends, graphs, historical data).prom_discover: discover available metrics in the system.prom_metadata: get metric metadata (types, descriptions, units).prom_targets: get scrape target info (scraping health, service discovery).
How to install
Via npx (recommended):
{
"mcpServers": {
"prometheus": {
"command": "npx",
"args": ["prometheus-mcp-server"],
"env": { "PROMETHEUS_URL": "http://localhost:9090" }
}
}
}
Or install globally (npm install -g prometheus-mcp-server) and reference the binary directly. Required: PROMETHEUS_URL. Optional authentication: PROMETHEUS_USERNAME/PROMETHEUS_PASSWORD (basic auth) or PROMETHEUS_TOKEN (bearer token). Optional connection tuning: PROMETHEUS_TIMEOUT, PROMETHEUS_INSECURE (for self-signed certs in dev).
Who it's for
SRE and DevOps engineers who want to query Prometheus metrics and check target health conversationally instead of writing PromQL by hand.
Source README
Prometheus MCP Server
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.
Features
- 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
MCP Configuration
Using npx (Recommended)
Add to your MCP client settings:
{
"mcpServers": {
"prometheus": {
"command": "npx",
"args": ["prometheus-mcp-server"],
"env": {
"PROMETHEUS_URL": "http://localhost:9090"
}
}
}
}
Using global installation
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"
}
}
}
}
Environment Variables
# 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
Available Tools
| 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 |
Example Usage
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?"
Development
# Run with inspector
npm run inspector
# Run directly
npm run dev
Connection Methods
1. No Authentication
export PROMETHEUS_URL=http://localhost:9090
2. Basic Authentication
export PROMETHEUS_URL=http://localhost:9090
export PROMETHEUS_USERNAME=admin
export PROMETHEUS_PASSWORD=secret
3. Bearer Token
export PROMETHEUS_URL=https://prometheus.example.com:9090
export PROMETHEUS_TOKEN=your-bearer-token
Additional Options
For self-signed certificates or development:
export PROMETHEUS_INSECURE=true
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.