mshegolev/prometheus-mcp
prometheus-mcp
Prometheusメトリクスおよび可観測性のためのMCPサーバー。 Claude(またはMCP対応エージェント)にPrometheusインスタンスへの読み取りアクセス権を付与します。会話を離れることなく、PromQLでメトリクスをクエリしたり、アクティブなアラートを調査したり、スクレイプターゲットを確認したりできます。
なぜ別のPrometheus MCPが必要なのか?
既存のPrometheus統合には、カスタムスクリプトやAPIの直接的な知識が必要です。このサーバーは以下の特徴があります:
stdio経由で標準のModel Context Protocolを使用 — Claude Desktop、Claude Code、Cursor、およびあらゆるMCPクライアントで動作します。
読み取り専用: 5つのツールすべてに
readOnlyHint: trueが設定されており、Prometheusデータを変更するリスクはゼロです。デュアルチャネル出力: プログラム利用向けの構造化JSON(
structuredContent)と、人間が読みやすいMarkdown(content)の両方を返します。実用的なエラーメッセージ: 修正すべき環境変数を正確に示し、次のステップを提案します。
認証サポート: Bearerトークン、HTTP Basic認証、または認証なし(内部デプロイで一般的)をサポートしています。
Related MCP server: Prometheus MCP Server
ツール
ツール | エンドポイント | 説明 |
|
| 部分一致フィルター(上限500)を使用してすべてのメトリクス名を一覧表示 |
|
| インスタントPromQLクエリを実行 |
|
| 時系列データを返すPromQL範囲クエリを実行 |
|
| アクティブおよび保留中のアラートを一覧表示 |
|
| ヘルス状態とジョブごとにスクレイプターゲットを一覧表示 |
インストール
pip install prometheus-mcpまたはインストールせずに直接実行:
uvx prometheus-mcp設定
すべての設定は環境変数を通じて行います:
変数 | 必須 | デフォルト | 説明 |
| はい | — | PrometheusサーバーのURL(例: |
| いいえ | — | Bearerトークン(Basic認証より優先) |
| いいえ | — | HTTP Basic認証のユーザー名 |
| いいえ | — | HTTP Basic認証のパスワード |
| いいえ |
| 自己署名証明書の場合は |
.env.exampleを.envにコピーし、値を入力してください。
Claude Desktop / Claude Codeの設定
MCP設定(claude_desktop_config.jsonまたは.claude/mcp.json)に追加します:
{
"mcpServers": {
"prometheus": {
"command": "prometheus-mcp",
"env": {
"PROMETHEUS_URL": "https://prometheus.example.com",
"PROMETHEUS_TOKEN": "your-token-here"
}
}
}
}またはuvxを使用(インストール不要):
{
"mcpServers": {
"prometheus": {
"command": "uvx",
"args": ["prometheus-mcp"],
"env": {
"PROMETHEUS_URL": "https://prometheus.example.com"
}
}
}
}Docker
docker run --rm -e PROMETHEUS_URL=https://prometheus.example.com prometheus-mcpクエリの例
設定後、Claudeに以下のように尋ねてみてください:
"PrometheusにはHTTPリクエストに関するどのようなメトリクスがありますか?"
"決済サービスの現在のリクエストレートは?"
"過去1時間のCPU使用率を5分間隔で表示して"
"発火しているアラートはありますか?重大度は?"
"現在ダウンしているスクレイプターゲットはどれで、その理由は?"
"node-exporterのインスタンスはいくつ稼働していますか?"
ツール使用ガイド
prometheus_list_metrics
Prometheusが認識しているすべてのメトリクス名を返します。patternを使用して部分一致(大文字小文字を区別しない)でフィルタリングします。利用可能なメトリクスが不明な場合は、ここから始めてください。出力は500メトリクスに制限され、切り捨てのヒントが表示されます。
prometheus_query
インスタントPromQL式を実行し、現在の値を取得します。結果の型(ベクトル/スカラー/行列/文字列)、サンプル数、サンプルごとのラベルと値を返します。
パラメータ:
query(必須) — PromQL式(例:up,rate(http_requests_total[5m]))time(任意) — RFC3339またはUnixタイムスタンプ。デフォルトは現在時刻
prometheus_query_range
時間枠を指定してPromQL式を実行します。一致する時系列ごとに、タイムスタンプ付きの値を含む系列を返します。すべての系列を合わせた合計データポイントは5000に制限されています。
パラメータ:
query(必須) — PromQL式start/end(必須) — RFC3339またはUnixタイムスタンプstep(必須) —15s,1m,5mのような解像度
Prometheusは、系列ごとに11,000ポイントを超えるステップを拒否します(HTTP 422)。この場合は、ステップを増やすか、範囲を狭めてください。
注意: Prometheusの範囲APIはブランチやコミットによるフィルタリングをサポートしていません。フィルターは純粋にPromQLのラベルマッチャーで表現されます。
prometheus_list_alerts
ラベル(alertname、severityを含む)、状態、アクティベーション時間、現在の値を含む、すべてのアクティブ/保留中のアラートを返します。状態の概要(発火中 vs 保留中の数)が含まれます。
prometheus_list_targets
ジョブ名、インスタンスアドレス、ヘルス状態(up/down/unknown)、前回のスクレイプ時間(ミリ秒)、およびエラーメッセージを含むスクレイプターゲットを返します。ジョブごとの概要が含まれます。stateでフィルタリング可能: active(デフォルト)、dropped、またはany。
パフォーマンス特性
すべてのツールは、接続プーリングを備えた単一の永続的な
requests.Sessionを使用します。セッションには
trust_env = Falseが設定されており、環境プロキシをバイパスします(Prometheusは通常、内部サービスであるため)。リクエストは30秒後にタイムアウトします。
prometheus_query_rangeは、すべての系列で合計5000ポイントまでに出力を制限します。長い期間の場合は、より大きなステップを使用してください。prometheus_list_metricsは、フィルタリング後に最大500メトリクスを返します。
開発
git clone https://github.com/mshegolev/prometheus-mcp
cd prometheus-mcp
pip install -e '.[dev]'
pytest tests/ -v
ruff check src tests
ruff format src testsライセンス
MIT — LICENSEを参照してください。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query Prometheus metrics, monitor alerts, and analyze system health through read-only access to your Prometheus server with built-in query safety and optional AI-powered metric analysis.MIT
- AlicenseNot gradedqualityDmaintenanceProvides access to Prometheus metrics and queries, allowing AI assistants to execute PromQL queries and analyze metrics data through standardized MCP interfaces.MIT
- AlicenseNot gradedqualityDmaintenanceA lean MCP server that provides LLM agents with transparent access to multiple Prometheus instances for metrics analysis and SRE operations.4GPL 2.0
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that enables AI agents to interact directly with Prometheus metrics data through natural language queries.MIT
Related MCP Connectors
Uptime, SSL, DNS and domain monitoring you can talk to from Claude or any MCP client.
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
Hosted MCP endpoint with realistic fake data for prototyping agents. 12 tools, no setup.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mshegolev/prometheus-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server