mcp-server-prometheus

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Allows to interact with Prometheus metrics and data, including listing and accessing metric schema, metadata, and statistical information (count, min, max values)

mcp-服务器-prometheus

MCP 服务器用于与 Prometheus 指标和数据交互。

这是一个基于 TypeScript 的 MCP 服务器,实现了 Prometheus API 接口。它通过模型上下文协议 (MCP) 在 Claude 和你的 Prometheus 服务器之间架起了一座桥梁。

演示

特征

资源

  • 列出并访问 Prometheus 指标架构
  • 每个指标资源提供:
    • 指标名称和描述
    • Prometheus 的详细元数据
    • 统计信息(计数、最小值、最大值)
  • 用于结构化数据访问的 JSON MIME 类型

当前能力

  • 列出所有可用的 Prometheus 指标及其描述
  • 阅读详细的指标信息,包括:
    • 元数据和帮助文本
    • 当前统计数据(计数、最小值、最大值)
  • 对安全 Prometheus 实例的基本身份验证支持

配置

服务器需要以下环境变量:

  • PROMETHEUS_URL :您的 Prometheus 实例的基本 URL

可选的身份验证配置:

  • PROMETHEUS_USERNAME :基本身份验证的用户名(如果需要)
  • PROMETHEUS_PASSWORD :基本身份验证的密码(如果需要)

发展

安装依赖项:

npm install

构建服务器:

npm run build

对于使用自动重建的开发:

npm run watch

安装

要与 Claude Desktop 一起使用,请添加服务器配置:

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

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

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们建议使用MCP Inspector

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

API结构

服务器通过以下 URI 结构公开 Prometheus 指标:

  • 基本 URI: http://your-prometheus-instance:9090
  • 指标 URI: http://your-prometheus-instance:9090/metrics/{metric_name}

每个指标资源返回包含以下内容的 JSON 数据:

  • 指标名称
  • 元数据(帮助文本、类型)
  • 当前统计数据(计数、最小值、最大值)
-
security - not tested
A
license - permissive license
-
quality - not tested

MCP 服务器用于与 Prometheus 指标和数据交互。

  1. Demo
    1. Features
      1. Resources
      2. Current Capabilities
    2. Configuration
      1. Development
        1. Installation
          1. Debugging
        2. API Structure
          ID: y7b3qba8jy