Prometheus MCP Server

Prometheus MCP Server

By CaesarYangs GitHub

-

prometheus mcp-server
Overview

What is Prometheus MCP Server?

Prometheus MCP Server is a Model Context Protocol (MCP) server designed for retrieving and analyzing data from Prometheus databases, enabling Large Language Models (LLMs) to perform various data-related tasks.

How to use Prometheus MCP Server?

To use the Prometheus MCP Server, set up a Python virtual environment, install the required packages, and run the server using the provided commands. You can also integrate it with the Claude Desktop app for easier access.

Key features of Prometheus MCP Server?

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

Use cases of Prometheus MCP Server?

  1. Retrieving and analyzing performance metrics from applications.
  2. Executing complex queries to gain insights from large datasets.
  3. Integrating with AI models for enhanced data processing capabilities.

FAQ from Prometheus MCP Server?

  • What is the purpose of the MCP server?

The MCP server allows for efficient data retrieval and analysis from Prometheus databases, facilitating advanced data operations.

  • How do I install the server?

You can install it via Smithery or manually by setting up a Python virtual environment and installing the required packages.

  • Can I contribute to the project?

Yes! Contributions are welcome, and you can follow the guidelines provided in the repository.

Content

# MCP Server for Prometheus [![smithery badge](https://smithery.ai/badge/@CaesarYangs/prometheus\_mcp\_server)\](https://smithery.ai/server/@CaesarYangs/prometheus\_mcp\_server)

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](https://smithery.ai/server/@CaesarYangs/prometheus\_mcp\_server):

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

Manual Installation

**Prepare python env**

```sh cd ./src/prometheus_mcp_server python3 -m venv .venv ```

```sh

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: ```sh wget https://bootstrap.pypa.io/get-pip.py python3 get-pip.py ```

Then install all required packages: ```sh 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 ```

![](./docs/imgs/cursor_screenshot.png)

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**

```sh 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**

```sh 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:

No tools information available.

Mirror of

image-generation mcp-server
View Details

Secure MCP server for analyzing Excel files with oletools

oletools mcp-server
View Details

Mirror of

bigquery mcp-server
View Details

MCPHubs is a website that showcases projects related to Anthropic's Model Context Protocol (MCP)

mcp mcp-server
View Details

A Model Context Protocol (MCP) server enabling LLMs to query, analyze, and interact with Prometheus databases through predefined routes.

prometheus model-context-protocol
View Details
Dealx
Dealx by DealExpress

-

dealx mcp-server
View Details

Google Analytics MCP server for accessing analytics data through tools and resources

google-analytics mcp-server
View Details