InfluxDB Natural Language Query MCP Server

InfluxDB Natural Language Query MCP Server

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.

Category
Visit Server

README

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured