lakehouse-ai-copilot MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
lakehouse-ai-copilot
Agentic Text-to-SQL, Column-Level AST Lineage, and Self-Healing Data Quality Copilot
lakehouse-ai-copilot bridges Data Engineering and AI Engineering with a stateful LangGraph workflow over a DuckDB Medallion warehouse, protected by SQLGlot AST read-only policy guardrails, automated column-level lineage, self-healing SQL & Data Quality remediation, an MCP server, and an automated execution-accuracy + safety benchmark harness.
Architecture
flowchart LR
Q["Natural Language Query"] --> R["Schema Retriever<br/>(Warehouse Metadata)"]
R --> G["SQL Planner / Generator"]
G --> AST["SQLGlot AST Guardrail<br/>(Read-Only + Allow-List + LIMIT)"]
AST -->|"Blocked"| STOP["Policy Rejection"]
AST -->|"Allowed"| LIN["SQLGlot Column Lineage<br/>(Output -> Source Table.Col)"]
AST --> EX["DuckDB Executor"]
EX -->|"Execution Error"| HEAL["Self-Healing Node<br/>(Fuzzy Identifier + AST Repair)"]
HEAL --> AST
EX -->|"Success"| RES["Grounded Rows + Lineage"]Related MCP server: Alma Atlas
Key Engineering Highlights
SQLGlot AST Security Guardrails (
validate_and_rewrite_sql): Walks the parsed DuckDB AST to rejectDROP,DELETE,UPDATE,INSERT,COPY,PRAGMA, multi-statement payloads, and disallowed tables, while auto-enforcing boundedLIMITclauses.Automated Column-Level Lineage (
extract_column_lineage): Traces every output projection (including joins and computed expressions likegross_profit_usdandblended_roas) back to its upstream(source_table, source_column)dependencies.Stateful LangGraph Self-Healing Loop: Routes DuckDB binder/execution failures through error-guided repair (
_attempt_sql_repair+ AST re-validation) up tomax_heal_attempts.Self-Healing Data Quality Engine (
detect_and_remediate_dq): Scans warehouse tables for duplicate primary keys, negative revenue/unit bounds, andNULLregion/SKU spikes and applies idempotent remediation SQL.FastAPI + MCP Serving: Exposes
/ask,/lineage,/dq/scan,/dq/remediatevia FastAPI andask_warehouse_copilot,trace_sql_column_lineage,scan_and_heal_dqover Model Context Protocol (mcp).
Quickstart
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Run lint & tests
ruff check src tests benchmarks
pytest -v
# Run Text-to-SQL, AST safety, self-healing, and DQ benchmark
lac benchmark
# Start FastAPI or MCP stdio server
uvicorn lakehouse_ai_copilot.api:app --reload --port 8001
python -m lakehouse_ai_copilot.mcp_serverBenchmarks (Verified Local Run)
Measured via lac benchmark on the DuckDB Medallion warehouse (silver_retail_sales, gold_marketing_spend, dim_products):
Metric | Measured Result |
Text-to-SQL Execution Accuracy (12 golden queries) | 1.00 (12/12 exact row match) |
Adversarial SQL AST Block Rate (8 injection/DDL cases) | 1.00 (8/8 blocked) |
Self-Healing Recovery Rate (4 broken SQL cases) | 1.00 (4/4 healed & executed) |
Column-Level AST Lineage Coverage | 1.00 (100% queries traced) |
DQ Anomaly Detection & Auto-Remediation | 3/3 ( |
End-to-End Copilot Latency | p50: 17.8 ms / p95: 22.04 ms |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Hosted MotherDuck MCP server: explore data, run DuckDB SQL, and build Dives and Flights.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables DuckDB database interaction through MCP, supporting SQL queries, table creation, and schema inspection with optional read-only mode.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query live schema, lineage, and query-context across data warehouses, dbt projects, orchestration systems, and BI tools via MCP tools.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants and MCP clients to ask natural-language questions about DuckDB or CSV data and receive safe, read-only SQL-generated tabular insights with automatic schema discovery and multi-table joins.1-
- FlicenseNot gradedqualityAmaintenanceEnables interaction with a DuckDB database through MCP tools for executing SQL queries, creating tables, and inspecting schemas. It also supports read-only mode to prevent write operations.-