Skip to main content
Glama

JoinPilot

CI License: MIT

Turn raw ERP tables and a plain-English requirement into a tested, human-approved data model.

JoinPilot profiles your tables, proposes how they should be joined with the numbers that prove it, waits for a person to approve, then generates guarded SQL views, runs automated system-integration checks, builds a KPI dashboard and answers business questions in plain English. Other AI tools can drive it through an MCP server.

Status: under active development. See the build plan for progress.

Why

Analysts spend days studying cryptic ERP tables, guessing join keys, writing views and testing them by hand. One wrong key, a join that duplicates rows or records with no match silently corrupts the KPIs leaders rely on. JoinPilot makes each of those decisions explicit, evidence-backed and testable.

Related MCP server: Kingdee MCP Server

How it works

  1. Upload CSV or Parquet tables, or load the synthetic ERP sample.

  2. Profile every column: types, nulls, distinct values, candidate keys and value overlap between columns.

  3. Describe the requirement, for example "Open receivables by customer and aging bucket, plus 2026 revenue by product group."

  4. Review the proposed join graph. Every join cites its evidence: overlap ratio, key uniqueness, cardinality, normalization (such as leading zeros) and fan-out risk.

  5. Approve joins. Only then are SQL views generated, guarded and checked (row counts, fan-out, orphans, null keys, bucket coverage, reconciliation), with automatic repair.

  6. Use the generated KPI dashboard, ask questions in plain English, or connect Claude through MCP.

Console

Profile. Every column's type, nulls, distinct values and uniqueness, the value overlaps between tables, and a glossary search that finds columns by business words.

Profile explorer with glossary search

Approve. The proposed join graph. Each join opens its evidence: overlap ratio, key uniqueness, cardinality and the normalization it needed, such as padding customer numbers with zeros. Nothing is built until you approve.

Join graph with evidence and the approval list

Results. The generated SQL views (DuckDB, Postgres, Snowflake or BigQuery), ready to copy or download, and the integration checks, each showing what was observed and what was expected.

Generated views and passing checks

Dashboard. KPIs the approved model supports, the ones the requirement asked for first. Every metric can switch to its rows or the guarded SQL behind it.

KPI dashboard generated from the approved model

The screenshots are captured from the running app by a Playwright script: cd web && SCREENSHOTS=1 npx playwright test screenshots.

Use it from Claude (MCP)

JoinPilot is also an MCP server. Claude Code or Claude Desktop can list projects, profile tables, propose joins, build and check the model after you approve it, read the dashboard and ask questions:

claude mcp add joinpilot -- uv run --directory /absolute/path/to/joinpilot joinpilot-mcp

The MCP guide covers Claude Desktop, the tools and the safety rules.

Architecture

 web/ React console ──HTTP──▶ FastAPI (api/) ◀── mcp/ MCP server
                                  │
   profiling/ (DuckDB) · joins/ (candidates, scoring) · agent/ (LangGraph, human approval)
   sqlgen/ + guard (sqlglot) → sandbox DuckDB · checks/ · kpi/ · qa/ (text-to-SQL)
   db/ (Postgres + pgvector) · jobs/ (arq + Redis) · llm/ (Gemini · fake · Ollama)

Tech stack

Layer

Choice

Backend

Python 3.12, uv, FastAPI, Pydantic v2

Agent

LangGraph with a Postgres checkpointer and human-in-the-loop interrupts

LLM

Google Gemini behind a provider interface; an offline fake provider for tests

Analytics

DuckDB (one sandboxed database per project), sqlglot SQL guard

App data

Postgres + pgvector, SQLAlchemy 2, Alembic

Jobs

arq + Redis

Web

React 19, Vite 8, TypeScript 7, Tailwind CSS 4, TanStack Query, React Flow, Recharts

Quality

pytest, Hypothesis, ruff, mypy (strict), oxlint, Vitest, Testing Library, Playwright

Ops

Docker, GitHub Actions, MCP (official Python SDK)

Quick start

uv sync                                        # backend
uv run uvicorn joinpilot.api.main:app --reload # API on http://localhost:8000
cd web && npm install && npm run dev           # console on http://localhost:5173

Evaluation

Every number below comes from a file in eval/results/, which records the split, dataset fingerprints, commit and date. Gold answers are written by the data generator and read only by eval/.

Join discovery, dev split (4 synthetic ERP datasets, 2026-11-26, commit e376633, results):

System

Precision

Recall

F1

Normalization recall

Fan-out recall

Decoy rejection

Name-only baseline

0.370

1.000

0.540

0.000

0.000

0.800

Overlap-only baseline

0.274

0.850

0.415

1.000

0.000

0.600

Inclusion-dependency baseline (90% overlap into a unique column)

1.000

1.000

1.000

1.000

0.000

1.000

JoinPilot, deterministic (no LLM)

1.000

1.000

1.000

1.000

1.000

1.000

How to read this honestly:

  • The 20 true joins are one 5-join schema seen 4 times (3 seeds and 2 naming styles), so normalization and fan-out each rest on a single planted case.

  • On dev, the textbook inclusion-dependency rule finds the same joins; uniqueness does most of the work. What JoinPilot adds here is flagging the fan-out trap (product texts in two languages) with the right filter, and an explanation for every decision.

  • The deterministic scorer was tuned on this split. The held-out test split (new seeds, size M, both naming styles and TPC-H) is run once, at the end, and is where the methods are expected to differ. LLM-based systems are added in M4.

Views and automated checks, dev split (same run): every view the agent generated was valid and every check passed on the first try, both when every recommended join was approved without review and when only the true joins were approved (no repairs were needed; repairing bad approvals is covered by tests).

KPI correctness, dev split (same run): with the recommended joins approved, the generated dashboard got 416 of 416 gold KPI values right (100%): open receivables by aging bucket, the top 10 customers by open amount per bucket, 2026 revenue by product group, monthly order counts and the top 10 customers by revenue, in both naming styles. Counts must match exactly, money within 0.01%, and a row the app adds that gold does not have counts against it. KPI correctness is measured only on the synthetic ERP schema the templates were written against; the test split adds new seeds and a larger size of that schema, and on other schemas (TPC-H included) the templates may simply not apply.

SQL safety (same run): the guard blocked 100% of 71 red-team attacks (file and URL readers, other databases, recursive queries, values grown to gigabytes from tiny input, parser crashes, stacked statements, DDL and DML, system functions, Unicode lookalikes and more) and wrongly blocked 0% of 11 ordinary analytics queries (attacks). The stricter mode used for model-written questions also refuses 2 of those 11, both of which pad customer keys by hand; the model views already do that.

Question answering: measured with a language model only (--llm); the first run is pending a free Gemini key.

Data

All data is synthetic (a seeded ERP-style generator with planted data-quality issues) or public (TPC-H). SAP-style table names are a public naming convention used only for realism.

Credits

Built by Karan Patel.

License

MIT

Available Tools

11 tools
approve_joinsA

Approve joins by edge id (omit approve for the recommended ones) and reject the rest, then build the views, run the checks (with repair) and build the dashboard. Edge ids must come from propose_joins or get_run. Only call this after the user has agreed to the joins.

Inputs: run_id (required), approve, reject_reason. Returns: error, views, run_id, status, +5 more

ask_questionB

Answer a business question with guarded, read-only SQL over the tested model. The answer includes the SQL, the rows and where they came from.

Inputs: question (required), project_id (required). Returns: A question's answer: the SQL, the rows and the evidence, or why it was blocked.

create_projectC

Create an empty project.

Inputs: name (required). Returns: name, tables, project_id

export_sqlB
Read-only

The run's data model as one SQL script for DuckDB, Postgres, Snowflake or BigQuery.

Inputs: run_id (required), dialect. Returns: result

get_check_resultsB
Read-only

Every automated check on the run's views: row counts, fan-out, orphan and null keys, aging bucket coverage and money reconciliation.

Inputs: run_id (required). Returns: result

get_dashboardB
Read-only

The KPI dashboard of the project's newest completed run, with each metric's SQL.

Inputs: project_id (required). Returns: run_id, metrics

get_runC
Read-only

A run's status, proposals, views and check summary.

Inputs: run_id (required). Returns: error, views, run_id, status, +5 more

list_projectsB
Read-only

List JoinPilot projects with their tables.

Inputs: no named parameters. Returns: result

load_sampleB

Load the synthetic SAP-style ERP sample (six tables with planted data-quality issues).

Inputs: project_id (required). Returns: name, tables, project_id

profile_tablesB
Read-only

Profile every table: row counts, candidate keys, and per column its type, null rate, distinct values and uniqueness.

Inputs: project_id (required). Returns: tables, overlaps, project_id

propose_joinsA

Start a run for a business requirement. It profiles the tables, ranks join candidates with evidence and stops for approval (status awaiting_approval); nothing is built yet. With no join candidates the run completes at once with no proposals.

Inputs: project_id (required), requirement (required). Returns: error, views, run_id, status, +5 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 11 tools

    Disambiguation4/5

    Each tool maps to a distinct step in the pipeline (profile, propose, approve, inspect, export), and the propose/approve split is explicitly documented as a stop-for-approval workflow. Minor overlap exists between get_run, get_check_results and get_dashboard as three separate read surfaces, and propose_joins internally performs profiling that profile_tables also does, but the descriptions keep these boundaries usable.

    Naming Consistency5/5

    All eleven tools use snake_case verb_noun form (list_projects, create_project, propose_joins, get_run, export_sql). No mixed conventions or vague single-word names.

    Tool Count5/5

    Eleven tools is well within the ideal range and each one covers a discrete stage of the join-modeling lifecycle. There is no filler or redundant tool.

    Completeness4/5

    The surface covers the full workflow from project creation and sample data through profiling, join approval, checks, dashboard and SQL export, plus ad-hoc Q&A. Gaps are minor: no delete/rename project, no explicit list_runs or cancel/resume-run operation, so agents must rely on get_run with an id.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants such as Claude, Cursor, and Windsurf to query and operate a cloud ERP through natural language, exposing 87 tools spanning purchasing, sales, inventory, manufacturing, costing, assets, auditing, and financial reporting. Supports read-only queries plus create, submit, audit, and reverse-audit operations with metadata exploration, SQL Server schema probing, and optional HTTP/SSE remote deployment.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants such as Claude and Cursor to query and operate Kingdee Cloud Star ERP in natural language, covering purchasing, sales, inventory, production, cost accounting, and financial reporting through dozens of built-in tools. It supports read-only queries, bill creation, submission, audit workflows, and metadata or SQL Server schema exploration.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants such as Claude and Cursor to query and operate Kingdee Cloud Star ERP through natural language, covering 87 tools across purchasing, sales, inventory, production, costing, fixed assets, financial reporting, and audit workflows. It also supports metadata discovery and optional SQL Server schema exploration.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables Claude to answer business questions about stock, orders, customer balances, overdue orders and KPIs from live ERP data using fixed, parameterized read-only queries, with bounded results and every call logged to an audit trail.
      5
      MIT