Prometheus MCP Server · prometheus — Claude Code MCP server: PromQL and metrics
Lets your AI agent talk to a running Prometheus over its API: run PromQL queries, inspect metrics, alerts and targets. Handy when a query is slow or you need a health check.
claude mcp add prometheus-prometheus-mcp-server -- docker run -i --rm ghcr.io/tjhop/prometheus-mcp-server:0.18.0What Prometheus MCP Server does
The server connects to a running Prometheus instance and exposes its HTTP API to the agent. Tools hand back JSON that the model reads directly: query and range_query for instant and range queries, series, label_names, label_values, metric_metadata for labels and metrics, plus list_alerts, list_rules, list_targets and tsdb_stats for an overview. Official Prometheus docs are searchable too, through docs_list, docs_read and docs_search.
When context gets tight, you can switch API responses to TOON encoding or cap how many lines and entries come back. Truncation is off by default and 0 disables it; for supported tools the agent can override that global limit per call.
Management endpoints like quit and reload work out of the box. The TSDB Admin API, which can delete data, does not. To turn it on you start the server with --dangerous.enable-tsdb-admin-tools. Leave that flag off and the destructive calls stay out of reach, which is the safer default for most setups.
What it helps with
- find out why a PromQL query is slow
- check active alerts and loaded rules
- see which targets Prometheus is scraping
- look up metrics and labels by matcher
- read TSDB cardinality and usage stats
Example prompts for the agent
- Querying my metrics is slow, help me figure out why
- List the active alerts and the rules that are loaded
- Check the TSDB stats and point out high cardinality
How to install Prometheus MCP Server
Platform CLI
claude mcp add prometheus-prometheus-mcp-server -- docker run -i --rm ghcr.io/tjhop/prometheus-mcp-server:0.18.0Platform CLI
codex mcp add prometheus-prometheus-mcp-server -- docker run -i --rm ghcr.io/tjhop/prometheus-mcp-server:0.18.0Config file
{
"mcpServers": {
"prometheus-prometheus-mcp-server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/tjhop/prometheus-mcp-server:0.18.0"
]
}
}
}Config file
{
"servers": {
"prometheus-prometheus-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/tjhop/prometheus-mcp-server:0.18.0"
]
}
}
}Platform CLI
gemini mcp add prometheus-prometheus-mcp-server docker run -i --rm ghcr.io/tjhop/prometheus-mcp-server:0.18.0Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Prometheus MCP Server
How do I install Prometheus MCP Server in Claude Code?
Run claude mcp add prometheus-prometheus-mcp-server -- docker run -i --rm ghcr.io/tjhop/prometheus-mcp-server:0.18.0. Docker needs to be available, since the server runs as a container.
What does Prometheus MCP Server do?
It connects an agent to a running Prometheus through the API. The agent runs PromQL queries and reads metrics, alerts, targets, rules and TSDB stats, and can search the official Prometheus documentation.
Can it delete data from Prometheus?
Only if you start the server with --dangerous.enable-tsdb-admin-tools. Without that flag the TSDB Admin API stays disabled and destructive operations are unavailable.
Similar MCP servers
All MCP servers for DevOps and infrastructure →Prometheus MCP Server by other authors comes first.