mcpField
P
Prometheus MCP Server

Prometheus MCP Server

Local
github.com/shaxiaozzDeveloper Tools3Updated 77w ago

About Prometheus MCP Server

Prometheus MCP Server is a Go server that lets MCP clients inspect metrics and run Prometheus queries. It supports SSE transport, authentication, and Docker deployment.

Key features

  1. 01List available metrics
  2. 02Discover Prometheus targets
  3. 03Retrieve metric metadata
  4. 04Run instant and range queries
  5. 05Basic and bearer-token authentication
  6. 06Docker container support

Use cases

  1. 01Explore metrics and targets
  2. 02Inspect metric metadata
  3. 03Run instant or range queries
  4. 04Connect to an authenticated Prometheus

MCP support

It exposes Prometheus metric and query tools to MCP clients. SSE is the documented transport; the README also notes an optional stdio setting.

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-shaxiaozz": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"PROMETHEUS_URL",
"shaxiaozz/prometheus-mcp-server:latest"
],
"env": {
"PROMETHEUS_URL": "<PROMETHEUS_URL>"
}
}
}
}
Run commanddocker run -i --rm -e PROMETHEUS_URL shaxiaozz/prometheus-mcp-server:latest
Environment variables to set
PROMETHEUS_URL

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
ocishaxiaozz/prometheus-mcp-server:latest

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

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

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.