Skip to main content
Glama
hani-ben-dhaou

Enterprise Big Data Copilot

Enterprise Big Data Copilot

Ein KI-Copilot, der natürlichsprachliche Fragen in validiertes, schemabewusstes Trino-SQL übersetzt – mit RAG, MCP-Tools und lokaler LLM-Inferenz.

Überblick

Mit dem Enterprise Big Data Copilot können Nutzer Big-Data-Plattformen in einfachem Englisch abfragen. Eine LangGraph-Pipeline ruft relevante Dokumentationen (RAG) und Live-Schema-Metadaten (MCP) ab, generiert mit einem lokalen LLM (Ollama) SQL, validiert es anhand von Sicherheits- und Schemaregeln und führt es – sofern die Plattform erreichbar ist – auf Trino aus und liefert echte Zeilen zurück.

Related MCP server: Doris MCP Server

Funktionen

  • Text-zu-SQL-Generierung in natürlicher Sprache für Trino

  • Lokale LLM-Inferenz mit Ollama (keine Cloud-API erforderlich)

  • RAG-Abruf über Trino-/Hive-/Iceberg-Dokumentation (Qdrant)

  • Schemabewusste Generierung auf Basis von Live-Katalogmetadaten

  • SQL-Validierung (Erzwingung von schreibgeschützten SELECT-Abfragen, Parse-Prüfung, Schema-Anbindung) mit automatischer Regenerationsschleife

  • Best-Effort-Abfrageausführung und Ergebnisabruf von Trino

  • MCP-Server (Model Context Protocol), der Metadaten-, Abfrage- und Profiling-Tools bereitstellt

  • OpenAI-kompatible API für Open WebUI

  • End-to-End-Pipeline-Tracing mit LangSmith

Architektur

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

Technologiestack

Technologie

Zweck

Python + FastAPI

Backend und REST/OpenAI-kompatible API

LangGraph

Pipeline-Orchestrierung (RAG → Schema → SQL → validieren → ausführen)

Ollama

Lokales LLM (llama3.2) und Embeddings (mxbai-embed-large)

LangChain + Qdrant

RAG-Dokumentabruf

FastMCP

Model-Context-Protocol-Server (Tools)

LangSmith

Pipeline-Tracing und -Überwachung

Trino

SQL-Abfrage-Engine (TPCH-Demokatalog)

Open WebUI

Chat-Oberfläche (optional)

Docker

Containerisierte Infrastruktur

Projektstruktur

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

Erste Schritte

Voraussetzungen

  • Python 3.11 oder 3.12 (3.13 wird nicht unterstützt)

  • Docker + Docker Compose

  • GPU optional (Ollama läuft auch auf der CPU)

Installation

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

Konfiguration

cp .env.example .env

Wichtige Variablen (Standardwerte funktionieren für die lokale Entwicklung):

Variable

Beschreibung

OLLAMA_BASE_URL / OLLAMA_MODEL

LLM-Server und -Modell (llama3.2)

OLLAMA_EMBED_MODEL

Embedding-Modell (mxbai-embed-large)

QDRANT_HOST / QDRANT_PORT

Qdrant-Vektordatenbank

TRINO_HOST / TRINO_PORT / TRINO_CATALOG / TRINO_SCHEMA

Trino (Standardkatalog tpch, Schema tiny)

MCP_TRANSPORT

inprocess (Standard, unter Windows empfohlen) oder sse

MCP_METADATA_SOURCE

inmemory (Demokatalog) oder trino (Live-Metadaten)

ENABLE_SQL_EXECUTION

Führt validiertes SQL auf Trino aus

LANGCHAIN_TRACING_V2

Auf true setzen, um LangSmith-Tracing zu aktivieren

LANGCHAIN_API_KEY

Ihr LangSmith-API-Schlüssel (Tracing bleibt ohne Angabe deaktiviert)

LANGCHAIN_PROJECT

LangSmith-Projektname (Standard: copilot)

Ausführen

# 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

Verwendung

Stellen Sie eine Frage in natürlicher Sprache:

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"}'

Die Antwort enthält das generierte SQL, eine Erklärung, einen Konfidenzwert, Warnungen und – sofern die Ausführung aktiviert ist – die Ergebniszeilen:

{
  "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}
}

Weitere Endpunkte: GET /api/v1/schema (Katalog auflisten), GET /api/v1/health und POST /v1/chat/completions (OpenAI-kompatibel, wird von Open WebUI verwendet).

Tests

pytest

Die Testsuite ist hermetisch und läuft ohne Live-Stack (146 Tests).

Tracing & Monitoring

Jede Pipeline-Abfrage (RAG-Abruf, Schemaabfrage, SQL-Generierung, Validierungsschleifen, Ausführung) kann mit LangSmith nachverfolgt werden. Erstellen Sie ein kostenloses Konto, holen Sie sich einen API-Schlüssel und setzen Sie: LANGCHAIN_TRACING_V2=true, LANGCHAIN_API_KEY=<Ihr Schlüssel> und optional LANGCHAIN_PROJECT=copilot. Solange kein Schlüssel konfiguriert ist, bleibt das Tracing deaktiviert.

LangSmith-Trace eines Copilot-Pipeline-Laufs

Docker

docker compose startet den gesamten Stack:

Dienst

Container

Port

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

Benannte Volumes speichern Ollama-Modelle, Qdrant-Daten und Open-WebUI-Daten. Das ollama-Volume ist als external deklariert – falls nicht vorhanden, einmalig erstellen:

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

Hinweis für Windows: MCP über echtes SSE kann in der Windows-Ereignisschleife unzuverlässig sein. Verwenden Sie für die lokale Entwicklung unter Windows MCP_TRANSPORT=inprocess; nutzen Sie SSE unter Linux/Docker.

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