Grafana MCP 서버는 모델 컨텍스트 프로토콜 (Model Context Protocol, MCP) 기반 서버로, Grafana 인스턴스 및 주변 생태계와 통합되도록 설계되었습니다. 이 프로젝트는 AI 에이전트(예: Claude Desktop)가 Grafana의 다양한 기능에 액세스하고 조작할 수 있는 기능을 제공합니다.
이 프로젝트는 유연한 도구 구성 옵션을 제공하며, 특정 기능 범주를 활성화하거나 비활성화할 수 있습니다.
도구 이름 | 분류 | 설명 |
---|---|---|
search_dashboards |
Search | 대시보드 검색 |
get_dashboard_by_uid |
Dashboard | UID를 통해 대시보드 가져오기 |
update_dashboard |
Dashboard | 대시보드 업데이트 또는 생성 |
list_datasources |
Datasources | 데이터 소스 나열 |
query_prometheus |
Prometheus | Prometheus 쿼리 실행 |
query_loki_logs |
Loki | 로그 쿼리 및 검색 |
list_incidents |
Incident | 이벤트 나열 |
list_alert_rules |
Alerting | 경고 규칙 나열 |
list_oncall_schedules |
OnCall | OnCall 근무 계획 나열 |
find_error_pattern_logs |
Sift | 오류 패턴 찾기 |
--disable-<category>
플래그를 사용하여 특정 도구 범주를 비활성화할 수 있습니다. 예를 들어, --disable-oncall
을 사용하면 OnCall 관련 도구를 비활성화할 수 있습니다.
docker pull mcp/grafana
docker run -p 8000:8000 -e GRAFANA_URL=http://localhost:3000 -e GRAFANA_API_KEY=<your_token> mcp/grafana
릴리스 페이지에서 최신 버전을 다운로드하여 $PATH
디렉토리에 배치합니다.
GOBIN="$HOME/go/bin" go install github.com/grafana/mcp-grafana/cmd/mcp-grafana@latest
바이너리 파일 사용:
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": [],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_API_KEY": "<your service account token>"
}
}
}
}
Docker 사용:
{
"mcpServers": {
"grafana": {
"command": "docker",
"args": [
"run", "--rm", "-p", "8000:8000",
"-e", "GRAFANA_URL", "-e", "GRAFANA_API_KEY",
"mcp/grafana"
],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_API_KEY": "<your service account token>"
}
}
}
}
-debug
플래그를 추가하여 디버깅 모드를 활성화하면 자세한 HTTP 요청 및 응답 로그를 제공할 수 있습니다.
{
"mcpServers": {
"grafana": {
"command": "mcp-grafana",
"args": ["-debug"],
"env": {
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_API_KEY": "<your service account token>"
}
}
}
}
# 서버 실행
make run
# Docker 이미지 빌드
make build-image
# Docker 컨테이너 실행
docker run -it --rm -p 8000:8000 mcp-grafana:latest
make test-unit
# 또는
make test
# Docker 컨테이너 시작 필요
make test-integration
# 클라우드 Grafana 인스턴스 및 자격 증명 필요
make test-cloud
# 로컬 Grafana 인스턴스 시작
docker-compose up -d
# 모든 테스트 실행
make test-all
make lint
이 프로젝트에는 jsonschema
구조체 태그에서 이스케이프되지 않은 쉼표를 검사하는 사용자 정의 린터가 포함되어 있습니다.
make lint-jsonschema
이 프로젝트는 AI와 기존 모니터링 도구의 통합이라는 새로운 트렌드를 나타내며, 개발자에게 인공 지능 도우미와 Grafana 생태계를 연결하는 강력한 다리를 제공합니다.