Prometheus MCP Server
프로메테우스 MCP 서버
Prometheus를 위한 MCP( Model Context Protocol ) 서버.
이를 통해 표준화된 MCP 인터페이스를 통해 Prometheus 메트릭과 쿼리에 액세스할 수 있으므로 AI 어시스턴트가 PromQL 쿼리를 실행하고 메트릭 데이터를 분석할 수 있습니다.
특징
[x] Prometheus에 대해 PromQL 쿼리 실행
[x] 메트릭을 발견하고 탐색하세요
[x] 사용 가능한 메트릭 나열
[x] 특정 메트릭에 대한 메타데이터 가져오기
[x] 즉시 쿼리 결과 보기
[x] 다양한 단계 간격으로 범위 쿼리 결과 보기
[x] 인증 지원
[x] 환경 변수의 기본 인증
[x] 환경 변수에서 Bearer 토큰 인증
[x] Docker 컨테이너화 지원
[x] AI 어시스턴트를 위한 대화형 도구 제공
도구 목록은 구성 가능하므로 MCP 클라이언트에서 사용할 도구를 선택할 수 있습니다. 특정 기능을 사용하지 않거나 컨텍스트 창을 너무 많이 차지하고 싶지 않을 때 유용합니다.
Related MCP server: Prometheus MCP Server
용법
이 MCP 서버를 실행할 환경에서 Prometheus 서버에 액세스할 수 있는지 확인하세요.
.env파일이나 시스템 환경 변수를 통해 Prometheus 서버의 환경 변수를 구성합니다.
지엑스피1
클라이언트 설정 파일에 서버 설정을 추가하세요. 예를 들어, Claude Desktop의 경우:
{
"mcpServers": {
"prometheus": {
"command": "uv",
"args": [
"--directory",
"<full path to prometheus-mcp-server directory>",
"run",
"src/prometheus_mcp_server/main.py"
],
"env": {
"PROMETHEUS_URL": "http://your-prometheus-server:9090",
"PROMETHEUS_USERNAME": "your_username",
"PROMETHEUS_PASSWORD": "your_password"
}
}
}
}참고: Claude Desktop에서
Error: spawn uv ENOENT표시되면uv에 대한 전체 경로를 지정하거나 구성에서 환경 변수NO_UV=1설정해야 할 수 있습니다.
Docker 사용법
이 프로젝트에는 쉬운 배포와 격리를 위한 Docker 지원이 포함되어 있습니다.
미리 빌드된 Docker 이미지
이 프로젝트를 사용하는 가장 쉬운 방법은 GitHub Container Registry의 미리 빌드된 이미지를 사용하는 것입니다.
docker pull ghcr.io/pab1it0/prometheus-mcp-server:latest태그를 사용하여 특정 버전을 사용할 수도 있습니다.
docker pull ghcr.io/pab1it0/prometheus-mcp-server:1.0.0Docker 이미지를 로컬로 빌드하기
이미지를 직접 구축하고 싶다면:
docker build -t prometheus-mcp-server .Docker로 실행
Docker를 사용하여 여러 가지 방법으로 서버를 실행할 수 있습니다.
미리 빌드된 이미지로 docker run을 사용합니다.
docker run -it --rm \
-e PROMETHEUS_URL=http://your-prometheus-server:9090 \
-e PROMETHEUS_USERNAME=your_username \
-e PROMETHEUS_PASSWORD=your_password \
ghcr.io/pab1it0/prometheus-mcp-server:latest로컬로 빌드한 이미지로 docker run을 사용합니다.
docker run -it --rm \
-e PROMETHEUS_URL=http://your-prometheus-server:9090 \
-e PROMETHEUS_USERNAME=your_username \
-e PROMETHEUS_PASSWORD=your_password \
prometheus-mcp-serverdocker-compose 사용:
Prometheus 자격 증명으로 .env 파일을 만든 다음 다음을 실행합니다.
docker-compose upClaude Desktop에서 Docker로 실행
Claude Desktop과 함께 컨테이너화된 서버를 사용하려면 환경 변수와 함께 Docker를 사용하도록 구성을 업데이트하세요.
{
"mcpServers": {
"prometheus": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e", "PROMETHEUS_URL",
"-e", "PROMETHEUS_USERNAME",
"-e", "PROMETHEUS_PASSWORD",
"ghcr.io/pab1it0/prometheus-mcp-server:latest"
],
"env": {
"PROMETHEUS_URL": "http://your-prometheus-server:9090",
"PROMETHEUS_USERNAME": "your_username",
"PROMETHEUS_PASSWORD": "your_password"
}
}
}
}이 구성은 -e 플래그와 변수 이름만 사용하여 Claude Desktop에서 Docker 컨테이너로 환경 변수를 전달하고, env 객체에 실제 값을 제공합니다.
Docker 구현 관련 참고 사항 : Claude에서 정상적으로 작동하는 것으로 입증된 chess-mcp 프로젝트의 구조에 맞춰 Docker 설정이 업데이트되었습니다. 새로운 구현은 다단계 빌드 프로세스를 사용하며 중간 셸 스크립트 없이 진입점 스크립트를 직접 실행합니다. 이러한 접근 방식은 MCP 통신을 위한 stdin/stdout의 적절한 처리를 보장합니다.
개발
기여를 환영합니다! 제안이나 개선 사항이 있으시면 이슈를 개설하거나 풀 리퀘스트를 제출해 주세요.
이 프로젝트는 uv 사용하여 종속성을 관리합니다. 플랫폼에 맞는 지침에 따라 uv 설치하세요.
curl -LsSf https://astral.sh/uv/install.sh | sh그런 다음 가상 환경을 만들고 다음을 사용하여 종속성을 설치할 수 있습니다.
uv venv
source .venv/bin/activate # On Unix/macOS
.venv\Scripts\activate # On Windows
uv pip install -e .프로젝트 구조
이 프로젝트는 src 디렉토리 구조로 구성되었습니다.
prometheus-mcp-server/
├── src/
│ └── prometheus_mcp_server/
│ ├── __init__.py # Package initialization
│ ├── server.py # MCP server implementation
│ ├── main.py # Main application logic
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose configuration
├── .dockerignore # Docker ignore file
├── pyproject.toml # Project configuration
└── README.md # This file테스트
이 프로젝트에는 기능성을 보장하고 회귀를 방지하는 데 도움이 되는 포괄적인 테스트 모음이 포함되어 있습니다.
pytest로 테스트를 실행합니다.
# Install development dependencies
uv pip install -e ".[dev]"
# Run the tests
pytest
# Run with coverage report
pytest --cov=src --cov-report=term-missing테스트는 다음과 같이 구성됩니다.
구성 검증 테스트
서버 기능 테스트
오류 처리 테스트
주요 응용 프로그램 테스트
새로운 기능을 추가할 때, 해당 테스트도 추가해 주세요.
도구
도구 | 범주 | 설명 |
| 질문 | Prometheus에 대해 PromQL 인스턴트 쿼리 실행 |
| 질문 | 시작 시간, 종료 시간 및 단계 간격으로 PromQL 범위 쿼리 실행 |
| 발견 | Prometheus에서 사용 가능한 모든 메트릭 나열 |
| 발견 | 특정 메트릭에 대한 메타데이터 가져오기 |
| 발견 | 모든 스크래핑 대상에 대한 정보를 얻으세요 |
특허
MIT
Available Tools
6 toolsexecute_queryExecute PromQL QueryCRead-onlyIdempotent
Execute a PromQL instant query against Prometheus
Inputs: query (required), time. Returns: object
execute_range_queryExecute PromQL Range QueryBRead-onlyIdempotent
Execute a PromQL range query with start time, end time, and step interval
Inputs: query (required), start (required), end (required), step (required). Returns: object
get_metric_metadataGet Metric MetadataARead-onlyIdempotent
Get metadata (type, help, unit) for metrics. Returns all metric metadata when no metric name is provided. Use filter_pattern to search metric names and descriptions.
Inputs: metric, filter_pattern, limit, offset. Returns: result
get_targetsGet Scrape TargetsARead-onlyIdempotent
Get information about all scrape targets
Inputs: no named parameters. Returns: object
health_checkHealth CheckARead-onlyIdempotent
Health check endpoint for container monitoring and status verification
Inputs: no named parameters. Returns: object
list_metricsList Available MetricsARead-onlyIdempotent
List all available metrics in Prometheus with optional pagination support
Inputs: limit, offset, filter_pattern, refresh_cache. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: query types (instant vs range), metadata retrieval, target info, health check, and metric listing. No overlap.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., execute_query, get_metric_metadata). No deviations.
Six tools cover the essential Prometheus operations without being excessive or insufficient. Well-scoped for the server's purpose.
Core CRUD-like operations for queries and metadata are present. Minor gaps like alert management or rule configuration are missing but not critical for the primary use case.
Maintenance
Related MCP Connectors
Query your app's logs, metrics and incidents from your AI assistant.
Query application logs, traces, and metrics from your AI coding assistant via Foam's MCP server.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
List datasets, schemas, run APL queries, and use prompts for exploration, anomalies, and monitoring.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA tool that enables access to Prometheus metrics data through a Model Context Protocol server, allowing interaction with monitoring data using natural language.MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables AI assistants to query Prometheus metrics, discover available data, and analyze system performance through natural language interactions.5224 npmMIT
- 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 gradedqualityDmaintenanceEnables AI assistants to execute PromQL queries and discover metrics across multiple Prometheus tenants using the Model Context Protocol. It supports single and multi-tenant configurations with secure authentication for instant and range query analysis.MIT