Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

prometheus_mcp_server

MCP.Pizza Chef: CaesarYangs

The prometheus_mcp_server is a Model Context Protocol (MCP) server designed to integrate Prometheus databases with Large Language Models (LLMs). It allows LLMs to retrieve, analyze, and interact with Prometheus metric data through predefined API routes. This server supports fetching specific metrics, performing statistical analyses, searching metric usage patterns, and executing complex PromQL queries. By exposing Prometheus data in a structured, model-readable format, it empowers AI agents to perform real-time monitoring, diagnostics, and data exploration tasks with enhanced control and precision. This integration facilitates advanced observability workflows and metric-driven decision-making within AI-enhanced environments.

Use This MCP server To

Retrieve Prometheus metrics for real-time monitoring Perform statistical analysis on Prometheus metric data Search and explore metric usage patterns Execute complex PromQL queries via LLMs Enable AI-driven diagnostics using Prometheus data Integrate Prometheus metrics into AI workflows Automate metric data retrieval and analysis Support observability and alerting with LLMs

README

MCP Server for Prometheus

smithery badge

A Model Context Protocol (MCP) server for retrieving data from Prometheus databases. This MCP server enables Large Language Models (LLMs) to invoke tool functions that retrieve and analyze vast amounts of metric data, search metric usage, execute complex queries, and perform other related tasks through pre-defined routes with enhanced control over usage.

  • Data Retrieval: Fetch specific metrics or ranges of data from Prometheus.
  • Metric Analysis: Perform statistical analysis on retrieved metrics.
  • Usage Search: Find and explore metric usage patterns.
  • Complex Querying: Execute advanced PromQL queries for in-depth data exploration.

Capibilites

✅ Retrieve comprehensive metric information, including names and descriptions, from Prometheus

✅ Fetch and analyze specific metric data using metric names

✅ Analyze metric data within custom time ranges

🚧 Filter and match data using specific labels (in development)

⏳ Additional features planned...

Getting Started

MCP runing requires a python virtual environment(venv), all packages should be installed into this venv so the MCP server can be automically started.

Installing via Smithery

To install Prometheus MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @CaesarYangs/prometheus_mcp_server --client claude

Manual Installation

Prepare python env

cd ./src/prometheus_mcp_server
python3 -m venv .venv
# linux/macos:
source .venv/bin/activate

# windows:
.venv\Scripts\activate

Then it is ready to be used as a dedicated python environment.

Install required packages

Make sure pip is properly isntalled. If your venv is installed without pip, then manually install it using:

wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py

Then install all required packages:

pip install -r requirements.txt

Usage

With Cursor Env

Ready to update depend on more easy-to-use Cursor environment.

Set this in the MCP section in Cursor Settings:

uv --directory /path/to/prometheus_mcp_server run server.py

With MCP Client(include Claude Desktop)

Config your Claude Desktop app's configuration at ~/Library/Application Support/Claude/claude_desktop_config.json(macos)

{
    "mcpServers": {
        "prometheus": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/prometheus_mcp_server",
                "run",
                "server.py"
            ],
            "env": {
                "PROMETHEUS_HOST": "http://localhost:9090"
            }
        }
    }
}

Standalone MCP Server

Started this MCP server alone:

uv method

uv --directory /path/to/prometheus_mcp_server run server.py

This is also a way to make sure this MCP server can be automatically started since the Claude Desktop is using this ux script way to start when the app launches.

regular python method

python3 server.py

Contributing

Contributions are welcome! Here's a quick guide:

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

For major changes, please open an issue first to discuss what you would like to change.

Thank you for your contributions!

License

MIT License

References & Acknowledgments

This project was inspired by or uses code from the following open-source projects:

prometheus_mcp_server FAQ

How do I connect the prometheus_mcp_server to my Prometheus database?
Configure the server with your Prometheus endpoint URL and authentication details to enable secure data access.
Can the prometheus_mcp_server handle complex PromQL queries?
Yes, it supports executing advanced PromQL queries, allowing LLMs to perform in-depth data exploration and analysis.
Is authentication required to use the prometheus_mcp_server?
Yes, the server supports authentication mechanisms to ensure secure access to Prometheus data.
How does the prometheus_mcp_server improve LLM interactions with Prometheus?
It exposes structured, predefined routes that let LLMs query and analyze metrics efficiently, enhancing real-time observability and diagnostics.
Can I use the prometheus_mcp_server with different LLM providers?
Yes, it is provider-agnostic and works seamlessly with OpenAI, Anthropic Claude, and Google Gemini models.
What types of metric data can the prometheus_mcp_server retrieve?
It can fetch metric names, descriptions, specific metric data ranges, and usage patterns from Prometheus.
Does the prometheus_mcp_server support metric usage pattern searches?
Yes, it enables searching and exploring how metrics are used over time for better insights.
How do I deploy the prometheus_mcp_server?
Deploy it as a lightweight server with access to your Prometheus instance, following the provided configuration and security guidelines.