mcpField
M
mcp-prometheus

mcp-prometheus

ローカル
github.com/jeanlopezxyzデータ・分析038 週間前に更新

mcp-prometheus について

mcp-prometheusは、Prometheusのクエリ、ステータス、ルール、ターゲット、Kubernetes診断機能をクライアントに提供するGo製MCPサーバーです。設定したPrometheus URLへの直接接続、またはKubernetes APIプロキシ経由で接続します。

主な機能

  1. 01PromQLの瞬時・期間クエリ
  2. 02ターゲット、ルール、サーバー状態の確認
  3. 03クラスター、ノード、名前空間の診断
  4. 04CPU、メモリ、ネットワーク分析
  5. 05Kubernetes APIプロキシ接続

活用シーン

  1. 01Prometheusのメトリクスとスクレイプ対象の確認
  2. 02クラスターやノードの状態確認
  3. 03Podのリソース使用状況の調査
  4. 04期間別メトリクスの比較

MCP 対応

MCPサーバーは、Prometheusのクエリ、状態確認、診断を行う11種類のツールをMCPクライアントに公開します。Prometheus URLへの直接接続またはKubernetes APIプロキシ経由で接続します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

mcp.json · 共通設定
{
"mcpServers": {
"jeanlopezxyz-mcp-prometheus": {
"command": "npx",
"args": [
"-y",
"mcp-prometheus"
]
}
}
}
起動コマンドnpx -y mcp-prometheus

ローカルサーバーにはマシン上の実行環境(Node.js 18 以上など)が必要です。設定ファイルの場所はクライアントごとに異なります。

パッケージ
npmmcp-prometheus2.1.1

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

Prometheus MCP Server(Go)

License: MIT npm version Go GitHub release

Prometheus と連携するための Model Context Protocol (MCP) サーバーです。client-go による Kubernetes 接続機能を内蔵したネイティブ Go バイナリです。

インストール

npx
npx -y mcp-prometheus@latest
MCP クライアントの設定

MCP クライアント(VS Code、Cursor、Windsurf など)の設定に追加します。

{
  "mcpServers": {
    "prometheus": {
      "command": "npx",
      "args": ["-y", "mcp-prometheus@latest"],
      "env": {
        "PROMETHEUS_URL": "http://localhost:9090"
      }
    }
  }
}
VS Code
code --add-mcp '{"name":"prometheus","command":"npx","args":["-y","mcp-prometheus@latest"],"env":{"PROMETHEUS_URL":"http://localhost:9090"}}'
Kubernetes への自動接続

K8S API サービスプロキシを介して、OpenShift/Kubernetes 上で稼働している Prometheus に自動接続します。client-go を介して、ネイティブの kubeconfig/クラスター内設定を使用します。kubectl やポートフォワーディングは必要ありません。

デフォルト:openshift-monitoring/prometheus-operated:9090

{
  "mcpServers": {
    "prometheus": {
      "command": "npx",
      "args": ["-y", "mcp-prometheus@latest"]
    }
  }
}
バイナリ

GitHub Releases からダウンロードするか、ソースからビルドします。

make build
./mcp-prometheus

設定

環境変数
変数説明
PROMETHEUS_URLPrometheus API の直接 URL(K8S 自動接続より優先)
CLI フラグ
フラグ説明デフォルト
--urlPrometheus の直接 URL-
--namespaceKubernetes の名前空間openshift-monitoring
--serviceKubernetes のサービス名prometheus-operated
--service-portKubernetes のサービスポート9090
--service-schemeサービスのスキーム(http/https)https
--kubeconfigkubeconfig ファイルのパス自動検出

優先順位: --url / PROMETHEUS_URL > K8S 自動接続

接続方法:

  1. 直接 URL(--url または PROMETHEUS_URL が設定されている場合)
  2. K8S API プロキシ(kubeconfig またはクラスター内設定を自動検出)

ツール(11)

基本クエリ
ツール説明
queryPromQL の瞬時クエリを実行
queryRangePromQL の範囲クエリを時間経過に沿って実行
getTargetsスクレイプ対象のステータスを取得
getRulesアラートルールと記録ルールを取得
getPrometheusStatusサーバーのバージョンとランタイム情報を取得
クラスター診断
ツール説明
getClusterHealthOverviewクラスターの健全性を包括的に確認
diagnoseNode特定のノードの健全性を診断
diagnoseNamespace名前空間の健全性を診断
リソース分析
ツール説明
getTopResourceConsumersCPU/メモリ/ネットワークの主な使用量を確認
investigatePod特定の Pod を詳細に調査
compareTimeRanges2 つの期間のメトリクスを比較

プロンプトの例

"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?"

開発

ビルド
make build              # Build for current platform
make build-all-platforms # Cross-compile for all platforms
コンテナ
podman build -f Containerfile -t mcp-prometheus .

Kubernetes/OpenShift へのデプロイ

コンテナイメージ

コンテナイメージは GitHub Container Registry で入手できます。

ghcr.io/jeanlopezxyz/mcp-prometheus:latest
Helm チャート

付属の Helm チャートを使用してデプロイします。

# 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 の値
パラメーター説明デフォルト
image.registryコンテナレジストリghcr.io
image.repositoryイメージリポジトリjeanlopezxyz/mcp-prometheus
image.versionイメージタグlatest
openshiftOpenShift Routes を有効化false
service.portサービスポート8080
prometheus.namespacePrometheus の名前空間openshift-monitoring
prometheus.servicePrometheus のサービス名prometheus-operated
rbac.useClusterReadercluster-reader ロールを使用true
カスタム Prometheus を使用する例
helm upgrade --install mcp-prometheus ./charts/mcp-prometheus \
  --namespace mcp-servers \
  --set openshift=true \
  --set prometheus.url=http://prometheus.monitoring:9090

ライセンス

MIT

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。