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を使用すると、ユーザーは平易な英語でBig Dataプラットフォームにクエリを実行できます。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からのベストエフォート型クエリ実行と結果取得

  • メタデータ、クエリ、プロファイリングツールを公開する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

SQLクエリエンジン(TPCHデモカタログ)

Open WebUI

チャットUI(オプション)

Docker

コンテナ化されたインフラストラクチャ

プロジェクト構造

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

Qdrantベクトルデータベース

TRINO_HOST / TRINO_PORT / TRINO_CATALOG / TRINO_SCHEMA

Trino(デフォルトカタログtpch、スキーマtiny

MCP_TRANSPORT

inprocess(デフォルト、Windows推奨)またはsse

MCP_METADATA_SOURCE

inmemory(デモカタログ)またはtrino(ライブメタデータ)

ENABLE_SQL_EXECUTION

検証済みSQLをTrinoで実行

LANGCHAIN_TRACING_V2

trueに設定するとLangSmithトレースを有効化

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/healthPOST /v1/chat/completions(OpenAI互換、Open WebUIで使用)。

テスト

pytest

テストスイートは密閉型で、ライブスタックなしで実行されます(146テスト)。

トレースとモニタリング

すべてのパイプラインクエリ(RAG検索、スキーマ参照、SQL生成、検証 ループ、実行)は、LangSmith でトレースできます。 無料アカウントを作成し、APIキーを取得して、以下を設定します: LANGCHAIN_TRACING_V2=trueLANGCHAIN_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 Server

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