Skip to main content
Glama

InfluxDB Natural Language Query MCP Server

by dohoon84

MCP Server

자연어로 InfluxDB 쿼리를 생성하고 실행하는 서버입니다.

설치 및 설정

1. Python 환경 설정

# Python 3.11.3 설치 pyenv install 3.11.3 pyenv local 3.11.3 # 가상환경 생성 및 활성화 python -m venv .venv source .venv/bin/activate # 의존성 설치 pip install -r requirements.txt

2. 서버 실행

# 개발 모드로 실행 uvicorn app:app --reload --host 0.0.0.0 --port 8080

3. InfluxDB 설정

서버를 실행하기 전에 InfluxDB가 필요합니다. 다음 정보를 확인하세요:

  • URL: http://your-influxdb-host:8086
  • Organization: your-org
  • Token: your-token
  • Bucket: your-bucket

사용 방법

1. 단일 메트릭 쿼리

# CPU 사용률 조회 response = client.query("CPU 사용률") # 특정 호스트의 메모리 상태 response = client.query("host1 메모리 상태")

2. 복합 메트릭 쿼리

# 모든 메트릭 조회 response = client.query("모든 메트릭 최근 1분") # 특정 호스트의 전체 상태 response = client.query("host1 전체 상태")

테스트

1. 테스트 환경 설정

# pytest 설치 pip install pytest # PYTHONPATH 설정 (프로젝트 루트 디렉토리에서) export PYTHONPATH=.

2. 테스트 실행

# 전체 테스트 실행 (자세한 출력) pytest tests/test_nl2flux.py -v # 특정 테스트 실행 pytest tests/test_nl2flux.py::test_build_flux -v # 특정 카테고리의 테스트 실행 pytest tests/test_nl2flux.py -v -k "parse" # 파싱 관련 테스트 pytest tests/test_nl2flux.py -v -k "build" # 쿼리 생성 관련 테스트 # 실패한 테스트만 실행 pytest tests/test_nl2flux.py -v --last-failed # 테스트 커버리지 확인 pytest tests/test_nl2flux.py -v --cov=nl2flux

3. 테스트 케이스

현재 구현된 테스트 케이스:

  • test_parse_duration: 시간 표현 파싱 ("5분 전", "2시간 전" 등)
  • test_parse_agg: 집계 함수 파싱 ("평균", "최대", "최소" 등)
  • test_parse_measurement: 메트릭 타입 파싱 ("CPU", "메모리" 등)
  • test_build_flux: 기본 쿼리 생성
  • test_parse_duration_various_ranges: 다양한 시간 범위 테스트
  • test_parse_agg_various_functions: 다양한 집계 함수 테스트
  • test_parse_measurement_various_metrics: 다양한 메트릭 타입 테스트
  • test_build_flux_with_host_filter: 호스트 필터링 쿼리 생성
  • test_build_multi_metric_flux: 복합 메트릭 쿼리 생성

자세한 테스트 케이스와 예시는 테스트 케이스 문서를 참조하세요.

4. 테스트 추가 방법

새로운 테스트를 추가하려면 tests/test_nl2flux.py 파일에 테스트 함수를 추가하세요:

def test_new_feature(): # 테스트할 입력 text = "새로운 쿼리 표현" bucket = "test_bucket" # 예상되는 결과 expected_flux = """ from(bucket: "test_bucket") |> range(start: -1m) |> filter(...) """ # 실제 결과와 비교 assert build_flux(bucket, text) == expected_flux
-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Enables users to generate and execute InfluxDB queries using natural language commands in Korean. Supports querying metrics like CPU usage, memory status, and system monitoring data through conversational interface.

  1. 설치 및 설정
    1. 1. Python 환경 설정
    2. 2. 서버 실행
    3. 3. InfluxDB 설정
  2. 사용 방법
    1. 1. 단일 메트릭 쿼리
    2. 2. 복합 메트릭 쿼리
  3. 테스트
    1. 1. 테스트 환경 설정
    2. 2. 테스트 실행
    3. 3. 테스트 케이스
    4. 4. 테스트 추가 방법

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/dohoon84/influx-db-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server