Labsco
pab1it0 logo

Prometheus MCP Server

β˜… 490

from pab1it0

An MCP server for integrating with Prometheus to query metrics.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

Prometheus MCP Server

Give AI assistants the power to query your Prometheus metrics.

A Model Context Protocol (MCP) server that provides access to your Prometheus metrics and queries through standardized MCP interfaces, allowing AI assistants to execute PromQL queries and analyze your metrics data.

Available Tools

Tool Category Description health_check System Health check endpoint for container monitoring and status verification execute_query Query Execute a PromQL instant query against Prometheus execute_range_query Query Execute a PromQL range query with start time, end time, and step interval list_metrics Discovery List all available metrics in Prometheus with pagination and filtering support get_metric_metadata Discovery Get metadata for one metric or bulk metadata with optional filtering get_targets Discovery Get information about all scrape targets

The list of tools is configurable, so you can choose which tools you want to make available to the MCP client. This is useful if you don't use certain functionality or if you don't want to take up too much of the context window.

Features

  • Execute PromQL queries against Prometheus

  • Discover and explore metrics

  • List available metrics

  • Get metadata for specific metrics

  • Search metric metadata by name or description in a single call

  • View instant query results

  • View range query results with different step intervals

  • Authentication support

  • Basic auth from environment variables

  • Bearer token auth from environment variables

  • Docker containerization support

  • Provide interactive tools for AI assistants

Development

Contributions are welcome! Please see our Contributing Guide for detailed information on how to get started, coding standards, and the pull request process.

This project uses uv to manage dependencies. Install uv following the instructions for your platform:

Copy & paste β€” that's it
curl -LsSf https://astral.sh/uv/install.sh | sh

You can then create a virtual environment and install the dependencies with:

Copy & paste β€” that's it
uv venv
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
uv pip install -e .

Testing

The project includes a comprehensive test suite that ensures functionality and helps prevent regressions.

Run the tests with pytest:

Copy & paste β€” that's it
# Install development dependencies
uv pip install -e ".[dev]"

# Run the tests
pytest

# Run with coverage report
pytest --cov=src --cov-report=term-missing

When adding new features, please also add corresponding tests.

License

MIT