Prometheus MCP Server

Prometheus MCP Server

一个用于从普罗米修斯数据库检索数据的模型上下文协议(MCP)服务器。

smithery 徽章

这是一个 MCP 服务器,使大型语言模型能够直接从 Prometheus 数据库检索和分析指标数据。

主要功能

  • ✅ 获取完整的指标信息(名称和描述)
  • ✅ 分析特定指标数据
  • ✅ 自定义时间范围分析
  • 🚧 标签过滤和匹配(开发中)

安装方法

自动安装(推荐)

通过 Smithery 为 Claude Desktop 安装:

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

手动安装

  1. 创建 Python 环境
cd ./src/prometheus_mcp_server
python3 -m venv .venv

# Linux/MacOS:
source .venv/bin/activate
# Windows:
.venv\Scripts\activate
  1. 安装依赖
pip install -r requirements.txt

配置与使用

在 Claude Desktop 中使用

编辑 Claude Desktop 配置文件 (~/Library/Application Support/Claude/claude_desktop_config.json):

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

在 Cursor 中使用

在 Cursor 设置的 MCP 部分配置:

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

独立启动服务器

uv --directory /path/to/prometheus_mcp_server run server.py
# 或
python3 server.py

许可证

MIT 许可证


详细文档: Smithery