mcpField
P
prometheus-mcp-server

prometheus-mcp-server

Local
github.com/weetimeDeveloper Tools6Updated 68w ago

About prometheus-mcp-server

prometheus-mcp-server is a TypeScript MCP server that connects Prometheus APIs to Claude and other MCP clients. It supports metric queries and discovery, along with access to targets, alerts, rules, and server status.

Key features

  1. 01Run instant PromQL queries
  2. 02Run range PromQL queries
  3. 03Discover series by label matchers
  4. 04Explore label values and metric metadata
  5. 05Inspect targets, alerts, and rules
  6. 06Retrieve Prometheus status

Use cases

  1. 01Query metrics at a specific time
  2. 02Analyze metric changes over a period
  3. 03Inspect scrape targets and alerting rules
  4. 04Check Prometheus server status

MCP support

The MCP server exposes Prometheus API tools to MCP clients for queries, series and label discovery, metadata, targets, alerts, rules, and status.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"prometheus-mcp-server-weetime": {
"command": "npx",
"args": [
"-y",
"prometheus-mcp-server"
]
}
}
}
Run commandnpx -y prometheus-mcp-server

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmprometheus-mcp-server

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

prometheus-mcp-server

Prometheus MCP Server

A Model Context Protocol (MCP) server for interacting with Prometheus metrics and data.

This is a TypeScript-based MCP server that implements a Prometheus API interface. It provides a bridge between Claude and your Prometheus server through the Model Context Protocol (MCP).

Features

  • Instant Queries: Execute PromQL queries at a specific time
  • Range Queries: Execute PromQL queries over a time period
  • Series Discovery: Find series by label matchers
  • Label Exploration: Get label names and values
  • Metadata Access: Get metadata for metrics
  • Target Information: Get information about scrape targets
  • Alerts & Rules: Get information about alerts and recording rules
  • Status Information: Get Prometheus server status information

Installation

# Install globally
npm install -g prometheus-mcp-server

# Or install locally
npm install prometheus-mcp-server

# Or use npx to run without installation
npx prometheus-mcp-server

Usage with Claude

To use with Claude Desktop, add the server config:

On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "prometheus-mcp-server": {
      "command": "/path/to/prometheus-mcp-server/build/index.js",
      "env": {
        "PROMETHEUS_BASE_URL": "http://your-prometheus-instance:9090"
      }
    }
  }
}
Using with npx

You can also use npx in your Claude Desktop configuration:

{
  "mcpServers": {
    "prometheus-mcp-server": {
      "command": "npx prometheus-mcp-server",
      "env": {
        "PROMETHEUS_BASE_URL": "http://your-prometheus-instance:9090"
      }
    }
  }
}

Configuration

By default, the client connects to a Prometheus server running at http://localhost:9090. You can configure the Prometheus server URL by setting the PROMETHEUS_BASE_URL environment variable:

# Example: Connect to a different Prometheus server
PROMETHEUS_BASE_URL=http://my-prometheus-server:9090 prometheus-mcp-server

This allows you to point the client to any Prometheus instance without modifying the source code.

Available Functions

The server provides the following functions:

  • mcp__instant_query: Execute an instant PromQL query
  • mcp__range_query: Execute a range PromQL query over a time period
  • mcp__get_series: Find series by label matchers
  • mcp__get_label_values: Get values for a specific label
  • mcp__get_metadata: Get metadata for metrics
  • mcp__get_targets: Get information about scrape targets
  • mcp__get_alerts: Get information about alerts
  • mcp__get_rules: Get information about recording and alerting rules
  • mcp__get_status: Get status information about the Prometheus server

Development

# Install dependencies
npm install

# Build the project
npm run build

# Start the server
npm start

# Debug
npm run dev:debug

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. You can use the following npm scripts for debugging:

# Inspect mode
npm run inspect

# Inspect with breakpoints
npm run inspect-debug

License

ISC

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.