Can an AI agent read alerts from Prometheus through Tares and explain them?
Yes, an AI agent connected to Tares over MCP can read Prometheus alerts and explain them from one correlated timeline. Tares polls the alerts your Prometheus rules have fired, and the agent asks Tares, not Prometheus. The agent needs no connector of its own for the alert vendor.
How it works
Two pieces work together: the prometheus_alerts connector brings alerts in, and the MCP server lets your agent read them back.
- Ingest. The Prometheus alerts connector polls the alerts endpoint of your Prometheus server every 30 seconds by default. It reads the alerts your alerting rules have already fired. Prometheus decides what counts as an alert. No Alertmanager and no PromQL are needed.
- State tracking. Tares tracks state across polls. Each alert fires once, and it re-emits only when its state changes. When an alert disappears, Tares emits a
resolvedevent instead of repeating a copy on every tick. - What an alert looks like. Each alert becomes one event. The
event_typeis the alert name, thetextis its summary, and the alert’s labels become Tares labels. Tares adds a syntheticstatelabel with the valuefiring,pendingorresolved. - Read-back. Your agent connects to Tares as an MCP client. Its
readtool returns a correlated, time-ordered timeline across all sources that match a label selector, so an alert appears next to the logs, metrics and findings for the same entity. Thecatalog_describetool shows one object’s schema, entities, freshness and sample events.
The agent talks to Tares only. Tares holds the connection to Prometheus, with its URL and any bearer token or basic-auth credentials. So the agent client needs no Prometheus connector, no alert-vendor SDK and no credentials for Prometheus. See Connecting agents (MCP) for the full tool list and client setup.
Set it up
-
Install and start Tares locally.
uv tool install tares tares up -
Add the alerts source. Use Sources, Add source, Prometheus alerts in the console, or ask a connected agent to ingest the firing alerts from your Prometheus. The YAML form looks like this:
- name: alerts connector: prometheus_alerts poll: 30s config: url: http://localhost:9090 severities: critical,warning # blank = all labels: - { name: severity, field: labels.severity, primary: true } - { name: state, field: state }Set
include_pendingto also ingest alerts that are still waiting out theirfor:duration. Addbearer_token, orusernameandpassword, if your Prometheus needs authentication. -
Start the MCP server. Locally, the daemon alone does not serve
/mcp, so run this as a second process:tares mcp --transport streamable-http --port 8788 --taresd http://localhost:8787 -
Connect your client. For Claude Code:
claude mcp add --transport http tares http://localhost:8788/mcpOn a secured instance, pass an API key with the
readscope as anAuthorization: Bearerheader. Codex, Cursor and other MCP clients connect with the same endpoint. -
Verify. Ask your client: “Use tares: what are you ingesting right now?” It calls
catalog_listand lists your sources, includingalerts. Then ask it to explain the firing alerts. In the console, Reads lists each read as it happens, taggedclient = mcp. -
Promote more labels. Discover proposes only the labels guaranteed to be present,
severityandstate. Once real alerts have been ingested, open the Fields tab and add labels such asnamespaceorservice. Your agent can then correlate on them.
What you get
- An agent that explains an alert in context. It reads the alert name, the summary text, the severity, the state and your own labels, and it sees the surrounding logs, metrics and findings in the same time-ordered timeline.
- One event per active alert, plus a
resolvedevent when it clears, so the agent can tell what is still firing from what has recovered. - No repeated copies of the same alert on every poll, because Tares emits again only on a state change.
- A single connection for the client. Whether the agent is Claude Code, Codex, Cursor or your own MCP client, it speaks to Tares, and Tares handles Prometheus.
- Control over what the agent sees. You can limit ingestion by severity, and use a scoped
readAPI key on a secured instance. - An optional next step: the agent can call
create_triggerto be woken when an alert fires again, andrememberto write back what it found.
When something else fits
- You want a metric value, not an alert. The alerts connector reads only what your rules have fired. To bring in metrics you pick by name or label, with no PromQL, use the Prometheus metrics connector instead.
- Alertmanager already routes your alerts. If you want the alerts Alertmanager sends, point a webhook receiver at a Tares ingest URL and use the Alertmanager connector. That path is push, not poll.
- You need to ask in a chat, not in an external client. The console includes Ask, an in-app agent with the same read tools, so you can explore alerts without wiring up a client.
- Prometheus is unreachable from Tares. The connector polls your server, so Tares needs a reachable Prometheus URL with alerting rules configured.