prometheus-mcp-server

prometheus-mcp-server

3

The Prometheus MCP Server allows large language models to interface with a Prometheus instance using APIs to execute queries and analyze data. It provides tools for metrics management and alert handling.

Prometheus MCP Server

About

This is an MCP server to allow LLMs to interact with a running Prometheus instance via the API to do things like generate and execute promql queries, list and analyze metrics, etc.

Tools

Tool NameDescription
alertmanagersGet overview of Prometheus Alertmanager discovery
build_infoGet Prometheus build information
execute_queryExecute an instant query against the Prometheus datasource
flagsGet runtime flags
list_alertsList all active alerts
list_rulesList all alerting and recording rules that are loaded
list_targetsGet overview of Prometheus target discovery
runtime_infoGet Prometheus runtime information
tsdb_statsGet usage and cardinality statistics from the TSDB
wal_replay_statusGet current WAL replay status

Resources

Not implemented yet

Prompts

Not implemented yet

Usage

Local LLM with Ollama

See for an example MCP config for use with tooling. Requires ollama to be installed.

Using MCP Inspector and a local ollama instance:

Requires MCP Inpsector to be installed:

make inspector
Using mcphost and a local ollama instance:

Requires mcphost to be installed:

make mcphost

Development

Required software:

~/go/src/github.com/tjhop/prometheus-mcp-server (main [ ]) -> make
# autogenerate help messages for comment lines with 2 `#`
 help:                  print this help message
 tidy:                  tidy modules
 fmt:                   apply go code style formatter
 lint:                  run linters
 binary:                build a binary
 build:                 alias for `binary`
 test:                  run tests
 container:             build container image with binary
 image:                 alias for `container`
 podman:                alias for `container`
 docker:                alias for `container`
 mcphost:               use mcphost to run the prometheus-mcp-server against a local ollama model
 inspector:             use inspector to run the prometheus-mcp-server