prometheus-mcp-server

command module
v0.0.0-...-dc28015 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2025 License: GPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Prometheus MCP Server

Model Context Protocol 这是一个基于Golang开发的Prometheus-MCP-Server,目前只支持sse运行模式 img.png

功能

  • Prometheus MCP Tools
    • 列出可用指标 (prometheus_list_metrics)
    • 发现并探索指标 (prometheus_get_targets)
    • 获取特定指标的元数据 (prometheus_get_metric_metadata)
    • 查看即时查询结果 (prometheus_execute_query)
    • 查看不同步长间隔的范围查询结果 (prometheus_execute_range_query)
    • 查看最近时长查询结果 (prometheus_execute_last_query)
  • 支持身份验证
    • 通过环境变量进行基本身份验证
    • 通过环境变量进行 Bearer Token 身份验证
  • 支持 Docker 容器化

使用方法

  1. 确保你的prometheus-mcp-server容器可以与prometheus-server通信.

  2. 使用以下命令运行prometheus-mcp-server容器

# 默认以sse方式运行mcp-server (prometheus无认证)
# 如需stdio模式,请自行将 MCP_SERVER_TRANSPORT=sse 修改为 MCP_SERVER_TRANSPORT=stdio
docker run -d --name prometheus-mcp-server \
  -e PROMETHEUS_URL=http://your-prometheus-server:9090 \
  -e MCP_SERVER_TRANSPORT=sse \
  shaxiaozz/prometheus-mcp-server:latest
# 默认以sse方式运行mcp-server (prometheus basic auth)
# 如需stdio模式,请自行将 MCP_SERVER_TRANSPORT=sse 修改为 MCP_SERVER_TRANSPORT=stdio
docker run -d --name prometheus-mcp-server \
  -e PROMETHEUS_URL=http://your-prometheus-server:9090 \
  -e PROMETHEUS_USERNAME=your_username \
  -e PROMETHEUS_PASSWORD=your_password \
  -e MCP_SERVER_TRANSPORT=sse \
  shaxiaozz/prometheus-mcp-server:latest
# 默认以sse方式运行mcp-server (prometheus token auth)
# 如需stdio模式,请自行将 MCP_SERVER_TRANSPORT=sse 修改为 MCP_SERVER_TRANSPORT=stdio
docker run -d --name prometheus-mcp-server \
  -e PROMETHEUS_URL=http://your-prometheus-server:9090 \
  -e PROMETHEUS_TOKEN=your_token \
  -e MCP_SERVER_TRANSPORT=sse \
  shaxiaozz/prometheus-mcp-server:latest
  1. 将服务器配置添加到客户端配置文件中。例如,Cursor Desktop:

url可直接通过命令: docker logs prometheus-mcp-server 查看

{
  "mcpServers": {
    "prometheus-mcp-server": {
      "url": "http://10.0.0.1:8000/sse"
    }
  }
}

img.png

构建镜像

git clonse https://github.com/shaxiaozz/prometheus-mcp-server.git && cd prometheus-mcp-server
docker build -t prometheus-mcp-server .

致谢

License

GNU v3.0

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址