Skip to main content
Glama
hani-ben-dhaou

Enterprise Big Data Copilot

Enterprise Big Data Copilot

자연어 질문을 검증된 스키마 인지형 Trino SQL로 변환하는 AI 코파일럿입니다. RAG, MCP 도구, 그리고 로컬 LLM 추론을 사용합니다.

개요

Enterprise Big Data Copilot을 사용하면 사용자가 빅데이터 플랫폼을 자연어로 조회할 수 있습니다. LangGraph 파이프라인은 관련 문서(RAG)와 실시간 스키마 메타데이터(MCP)를 검색하고, 로컬 LLM(Ollama)으로 SQL을 생성한 다음, 안전 및 스키마 규칙에 따라 검증하며, 플랫폼에 연결할 수 있을 때는 Trino에서 실행하여 실제 결과 행을 반환합니다.

Related MCP server: Doris MCP Server

기능

  • Trino용 자연어 Text-to-SQL 생성

  • Ollama를 사용한 로컬 LLM 추론(클라우드 API 불필요)

  • Trino / Hive / Iceberg 문서에 대한 RAG 검색(Qdrant)

  • 실시간 카탈로그 메타데이터를 기반으로 하는 스키마 인지형 생성

  • SQL 검증(읽기 전용 SELECT 강제, 파싱 검사, 스키마 근거 확인) 및 자동 재생성 루프

  • Trino에서 best-effort 쿼리 실행 및 결과 조회

  • 메타데이터, 쿼리, 프로파일링 도구를 노출하는 Model Context Protocol(MCP) 서버

  • Open WebUI용 OpenAI 호환 API

  • LangSmith를 통한 엔드투엔드 파이프라인 추적

아키텍처

flowchart LR
    User --> API
    API --> Agent
    Agent --> RAG
    RAG --> Qdrant
    Agent --> LLM
    Agent --> MCP
    MCP --> Trino
    Agent --> Validation
    Agent --> Response
    Response --> User

기술 스택

기술

용도

Python + FastAPI

백엔드 및 REST/OpenAI 호환 API

LangGraph

파이프라인 오케스트레이션(RAG → 스키마 → SQL → 검증 → 실행)

Ollama

로컬 LLM(llama3.2) 및 임베딩(mxbai-embed-large)

LangChain + Qdrant

RAG 문서 검색

FastMCP

Model Context Protocol 서버(도구)

LangSmith

파이프라인 추적 및 모니터링

Trino 128

SQL 쿼리 엔진(TPCH 데모 카탈로그)

Open WebUI

채팅 UI(선택 사항)

컨테이너화된 인프라

프로젝트 구조

app/
├── agent/            # SQL agent + prompts (Ollama)
├── api/              # REST + OpenAI-compatible endpoints
├── core/             # Config, models, exceptions, logging
├── formatter/        # Response formatting
├── mcp/              # MCP server, client, catalog services
├── orchestrator/     # LangGraph pipeline
├── rag/              # Ingestion and retrieval (Qdrant)
├── services/         # Trino client
└── validator/        # SQL validation
tests/                # pytest suite
docker/               # App image + Trino config
docs/                 # RAG knowledge base
scripts/              # Document ingestion CLI

시작하기

사전 요구 사항

  • Python 3.11 또는 3.12(3.13은 지원되지 않음)

  • Docker + Docker Compose

  • GPU는 선택(Ollama는 CPU에서 실행 가능)

설치

git clone https://github.com/hani-ben-dhaou/Enterprise-Big-Data-Copilot.git
cd entreprise-bigdata-copilot

python -m venv .venv
# Windows: .venv\Scripts\activate | macOS/Linux: source .venv/bin/activate

pip install -r requirements.txt
pip install -r requirements-dev.txt   # pytest

설정

cp .env.example .env

주요 변수(기본값은 로컬 개발에 그대로 사용할 수 있습니다):

변수

설명

OLLAMA_BASE_URL / OLLAMA_MODEL

LLM 서버 및 모델(llama3.2)

OLLAMA_EMBED_MODEL

임베딩 모델(mxbai-embed-large)

QDRANT_HOST / QDRANT_PORT

Q드란트 벡터 데이터베이스

TRINO_HOST / TRINO_PORT / TRINO_CATALOG / TRINO_SCHEMA

Trino(기본 카탈로그 tpch, 스키마 tiny)

MCP_TRANSPORT

inprocess(기본값, Windows에서 권장) 또는 sse

MCP_METADATA_SOURCE

inmemory(데모 카탈로그) 또는 trino(실시간 메타데이터)

ENABLE_SQL_EXECUTION

Trino에서 검증된 SQL 실행

LANGCHAIN_TRACING_V2

LangSmith 추적을 사용하려면 true로 설정

LANGCHAIN_API_KEY

LangSmith API 키(비어 있으면 추적이 꺼진 상태 유지)

LANGCHAIN_PROJECT

LangSmith 프로젝트 이름(기본값 copilot)

실행

# 1. Start infrastructure (Ollama, Qdrant, Trino)
docker compose up -d

# 2. Pull models and ingest documentation (Qdrant must be up)
docker exec -it copilot-ollama ollama pull llama3.2
docker exec -it copilot-ollama ollama pull mxbai-embed-large
python scripts/ingest_docs.py

# 3. Start the API
uvicorn app.main:app --reload --port 8000

# 4. Optional: standalone MCP server (SSE on :8001)
python -m app.mcp.server

사용법

자연스러움으로 질문하세요:

curl -X POST http://localhost:8000/api/v1/query \
  -H "Content-Type: application/json" \
  -d '{"question":"Show me the top 10 customers by total revenue last month"}'

응답에는 생성된 SQL, 설명, 신뢰도 점수, 경고가 포함되며, 실행이 활성화되었을 때는 결과 행도 포함됩니다:

{
  "question": "Show me the top 10 customers by total revenue last month",
  "sql": "SELECT ...",
  "explanation": "...",
  "confidence": 0.92,
  "warnings": [],
  "dialect": "trino",
  "results": [["42", "Acme", 98765.00]],
  "execution": {"status": "ok", "columns": ["id", "name", "revenue"], "row_count": 1, "truncated": false}
}

기타 엔드포인트: GET /api/v1/schema(카탈로그 목록), GET /api/v1/health, 및 POST /v1/chat/completions(OpenAI 호환, Open WebUI에서 사용).

테스트

pytest

테스트 스위트는 자체 독립적이며 라이브 스택 없이 실행됩니다(테스트 146개).

추적 및 모니터링

모든 파이프라인 쿼리(RAG 검색, 스키마 조회, SQL 생성, 검증 루프, 실행)는 LangSmith 으로 추적할 수 있습니다. 무료 계정을 만들고 API 키를 받아 다음을 설정하세요: LANGCHAIN_TRACING_V2=true, LANGCHAIN_API_KEY=<your key>, 그리고 선택적으로 LANGCHAIN_PROJECT=copilot. 키가 설정되어 있지 않으면 추적은 꺼진 상태로 유지됩니다.

LangSmith로 추적한 코파일럿 파이프라인 실행

Docker

docker compose는 전체 스택을 실행합니다:

서비스

컨테이너

포트

Ollama

copilot-ollama

11434

Qdrant

copilot-qdrant

6333

Trino

copilot-trino

8080

Open WebUI

copilot-webui

3000

Copilot API

copilot-api

8000

MCP 서버

copilot-mcp

8001

이름이 지정된 볼륨은 Ollama 모델, Qdrant 데이터, Open WebUI 데이터를 보존합니다. ollama 볼륨은 external로 선언되어 있으므로, 존재하지 않으면 한 번만 생성하세요:

docker volume create ollama
docker compose up -d
docker compose ps
docker compose logs -f copilot-api
docker compose down

Windows 참고 사항: 실제 SSE를 통한 MCP는 Windows 이벤트 루프에서 불안정할 수 있습니다. Windows 로컬 개발에서는 MCP_TRANSPORT=inprocess인 상태를 유지하고, Linux/Docker에서는 SSE를 사용하세요.

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    B
    quality
    D
    maintenance
    Provides AI models with structured access to Trino's distributed SQL query engine, enabling LLMs to directly query and analyze data stored in Trino databases.
    3
    10
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language querying of Apache Doris databases via LLM-powered SQL generation, execution, and metadata management through the MCP protocol.
    9
    Apache 2.0
  • F
    license
    A
    quality
    A
    maintenance
    Natural language to SQL engine with multi-connector support (PostgreSQL, MySQL, Snowflake, BigQuery, DuckDB), document QA, semantic caching, and self-hosted MCP server.
    9
    2

View all related MCP servers

Related MCP Connectors

  • The grounded data layer for any LLM: governed SQL, metrics, lineage and catalog over your data.

  • Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

Latest Blog Posts

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/hani-ben-dhaou/Enterprise-Big-Data-Copilot'

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