Mcp Prometheus

io.github.jeanlopezxyz由 GitHub 帳號 jeanlopezxyz 發布v2.1.1更新於 Oct 24, 2026

A Model Context Protocol (MCP) server for Prometheus monitoring

發布方自己的服務:Prometheus MCP

概覽

AI 產生的概覽

一個本機 MCP 伺服器,將助理連接到 Prometheus,使其能執行 PromQL 查詢並診斷 Kubernetes/OpenShift 叢集健康狀態。

可以做什麼
對 Prometheus 執行 PromQL 即時查詢與範圍查詢,並比較兩個時間區段之間的指標。檢視抓取目標、告警與記錄規則,以及伺服器版本和執行階段狀態。取得叢集健康總覽,並診斷特定節點或命名空間。找出 CPU、記憶體和網路用量最高的對象,並深入調查單一 Pod。
適用情境
當你希望助理在 Kubernetes 或 OpenShift 環境中回答關於 Prometheus 指標、叢集健康、資源用量或 Pod 問題,而不必自行執行 kubectl 或連接埠轉送時,適合使用。
執行需求
透過 npx(Node.js)或 Go 二進位檔在本機執行。需要一個可連線的 Prometheus 端點,透過 PROMETHEUS_URL 環境變數或 --url 參數設定;或透過 kubeconfig 或叢集內設定取得 Kubernetes 存取權,以便經由 K8s API 服務代理自動連線。命名空間、服務和連接埠可用命令列參數設定。
安裝前請注意
Kubernetes 自動連線會使用你的 kubeconfig 或叢集內憑證,助理因此能以你的身分存取叢集監控資料。README 提到部署時可使用 cluster-reader RBAC 角色。請僅指向你有權查詢的 Prometheus 執行個體。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Mcp Prometheus,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Prometheus MCP Server (Go)

[License: MIT] [npm version] [Go] [GitHub release]

A Model Context Protocol (MCP) server for Prometheus integration. Native Go binary with built-in Kubernetes connectivity via client-go.

Installation

npx

bash
npx -y mcp-prometheus@latest

MCP Client Configuration

Add to your MCP client configuration (VS Code, Cursor, Windsurf, etc.):

json
{  "mcpServers": {    "prometheus": {      "command": "npx",      "args": ["-y", "mcp-prometheus@latest"],      "env": {        "PROMETHEUS_URL": "http://localhost:9090"      }    }  }}

VS Code

shell
code --add-mcp '{"name":"prometheus","command":"npx","args":["-y","mcp-prometheus@latest"],"env":{"PROMETHEUS_URL":"http://localhost:9090"}}'

Kubernetes Auto-Connect

Automatically connects to Prometheus running in OpenShift/Kubernetes via the K8S API service proxy. Uses native kubeconfig/in-cluster config via client-go. No kubectl or port-forwarding required.

Default: openshift-monitoring/prometheus-operated:9090

json
{  "mcpServers": {    "prometheus": {      "command": "npx",      "args": ["-y", "mcp-prometheus@latest"]    }  }}

Binary

Download from GitHub Releases or build from source:

bash
make build./mcp-prometheus

Configuration

Environment Variables

VariableDescription
PROMETHEUS_URLDirect Prometheus API URL (overrides K8S auto-connect)

CLI Flags

FlagDescriptionDefault
--urlDirect Prometheus URL-
--namespaceKubernetes namespaceopenshift-monitoring
--serviceKubernetes service nameprometheus-operated
--service-portKubernetes service port9090
--service-schemeService scheme (http/https)https
--kubeconfigPath to kubeconfig fileauto-detect

Precedence: --url / PROMETHEUS_URL > K8S auto-connect

Connection strategy:

  1. Direct URL (if --url or PROMETHEUS_URL is set)
  2. K8S API proxy (auto-detect kubeconfig or in-cluster config)

Tools (11)

Basic Queries

ToolDescription
queryExecute a PromQL instant query
queryRangeExecute a PromQL range query over time
getTargetsGet scrape targets status
getRulesGet alerting and recording rules
getPrometheusStatusGet server version and runtime info

Cluster Diagnostics

ToolDescription
getClusterHealthOverviewComprehensive cluster health overview
diagnoseNodeDiagnose a specific node's health
diagnoseNamespaceDiagnose a namespace's health

Resource Analysis

ToolDescription
getTopResourceConsumersTop CPU/memory/network consumers
investigatePodDeep investigation of a specific pod
compareTimeRangesCompare metrics between two time periods

Example Prompts

"What's the current CPU usage across all nodes?""Show me the cluster health overview""Which pods are using the most memory?""Diagnose node worker-1""Are all scrape targets healthy?""Compare CPU usage now vs 24 hours ago""Investigate pod my-app in namespace production""What alerting rules are defined?"

Development

Build

bash
make build              # Build for current platformmake build-all-platforms # Cross-compile for all platforms

Container

bash
podman build -f Containerfile -t mcp-prometheus .

Kubernetes / OpenShift Deployment

Container Image

The container image is available on GitHub Container Registry:

ghcr.io/jeanlopezxyz/mcp-prometheus:latest

Helm Chart

Deploy using the included Helm chart:

bash
# Add the chart repository (or use local chart)helm upgrade --install mcp-prometheus ./charts/mcp-prometheus \  --namespace mcp-servers \  --create-namespace \  --set openshift=true
Helm Values
ParameterDescriptionDefault
image.registryContainer registryghcr.io
image.repositoryImage repositoryjeanlopezxyz/mcp-prometheus
image.versionImage taglatest
openshiftEnable OpenShift Routesfalse
service.portService port8080
prometheus.namespacePrometheus namespaceopenshift-monitoring
prometheus.servicePrometheus service nameprometheus-operated
rbac.useClusterReaderUse cluster-reader roletrue
Example with custom Prometheus
bash
helm upgrade --install mcp-prometheus ./charts/mcp-prometheus \  --namespace mcp-servers \  --set openshift=true \  --set prometheus.url=http://prometheus.monitoring:9090

License

MIT

來源:README.md,提交 4b7c47b

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v2.1.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Prometheus 整合