dqsleuth
Reads dbt target artifacts to surface failing tests, inspect test definitions and compiled SQL, and trace upstream/downstream lineage with failing nodes marked.
Uses DuckDB as its local, read-only analysis engine and can read DuckDB database files, including dbt-duckdb warehouses, to profile tables, run read-only SQL, and investigate data quality issues.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@dqsleuth revenue dropped 35% yesterday. Is it real?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
dqsleuth
dqsleuth is an MCP server for investigating data quality problems. It gives Claude (or any MCP client) read-only tools to find out why the data is wrong, not just that a test failed.
Ask it things like:
"Revenue dropped 35% yesterday. Is that real?"
"Why does joining orders to customers give me more rows than orders has?"
"Our
uniquetest onstg_ordersis failing. Where did it break and what does it affect?"
It runs locally on DuckDB. It reads CSV, Parquet and NDJSON files, DuckDB databases (including a dbt-duckdb warehouse), an optional Postgres database, and dbt's target/ artifacts. It never writes to any of them.
Install
Claude Code (plugin)
/plugin install dqsleuth --marketplace tripleaceme/dqsleuthOn Claude Code older than 2.1.275, add the marketplace first:
/plugin marketplace add tripleaceme/dqsleuth
/plugin install dqsleuth@dqsleuthThe plugin bundles the MCP server and an /dqsleuth:investigate skill. The skill gives Claude a structured method: hypotheses, evidence, root cause, fix, prevention. It needs uv on your PATH, because the server runs through uvx.
Any other MCP client
{
"mcpServers": {
"dqsleuth": {
"command": "uvx",
"args": ["dqsleuth", "--root", "/path/to/your/project"]
}
}
}Or install it with pip install dqsleuth and run dqsleuth --root ..
Related MCP server: mcp-duckdb-analyst
Try it on the demo data
The repo ships a small shop dataset with six planted faults. Clone it, open Claude Code in examples/shop, and ask:
/dqsleuth:investigate revenue on 30 Oct 2026 dropped. Is it real?Claude should find that Paystack payments are completely missing that day. That makes it a feed problem, not lost sales. Along the way it should also find the 25 orders that were loaded twice and the two failing dbt tests. The faults are listed at the top of examples/make_demo.py, and tests/test_engine.py checks that dqsleuth finds each one.
Tools
Tool | What it answers |
| What can I read? Tables, where they came from, whether dbt artifacts were found. |
| Register another file, glob ( |
| Row count and per-column nulls, distinct values, min/max. Flags constant columns, high null rates, and placeholder strings like |
| Null counts per column. With a time column, null % per period, which shows when nulls started. |
| Is this key unique? If not, are the extra rows exact copies (a re-run or overlapping incremental load) or conflicting values (wrong grain or a fan-out)? |
| Latest timestamp, lag from now, rows per period, empty periods and low-volume periods. |
| Orphaned foreign keys (rows an INNER JOIN drops), NULL keys, and a non-unique parent key that makes a LEFT JOIN inflate totals. |
| Compares a window with its baseline and attributes the change to segments. Flags segments that disappeared, which usually means a feed did not land. |
| One read-only SELECT to confirm a hypothesis. |
| Failing, erroring and warning tests from the last run, worst first. |
| One test's definition, config, tested model and compiled SQL. |
| Upstream and downstream of a node, marking every node with failing tests. Downstream includes exposures. |
There is also an investigate MCP prompt for clients that support prompts.
Configuration
Setting | Flag | Environment variable |
Project root to scan for data |
|
|
Extra files, globs or folders |
|
|
dbt |
|
|
Postgres connection URL | — |
|
Skip scanning the root |
| — |
On start, dqsleuth scans the root up to four levels deep. It registers up to 60 data files and finds target/manifest.json. It skips .git, virtualenvs, node_modules and dbt_packages. dbt artifacts are re-read whenever dbt rewrites them, so a new dbt build shows up without a restart.
The Claude Code plugin sets the root to your project directory. To point it at Postgres, export DQSLEUTH_POSTGRES_URL before starting Claude Code. Use a read-only database role.
Safety
dqsleuth is built to be safe to hand to an agent:
No writes. Files are exposed as views. DuckDB databases and Postgres are attached
READ_ONLY.dq_run_sqlrejects anything that isn't a single SELECT.No reads outside the project. After start-up, DuckDB's external access is switched off for everything except the project root and paths you passed with
--source. A query likeread_text('~/.ssh/id_rsa')fails, and the setting cannot be switched back on the live connection.No SQL injection through names. Table and column names are checked against the catalog before they go into SQL.
No secrets in results. The Postgres password goes to libpq through
PGPASSWORD, so it never appears in the connection string that a SELECT could see.No network calls, except installing DuckDB's Postgres extension the first time you use Postgres.
Results are capped (limit on every listing tool) so a large table can't flood the agent's context.
Development
uv sync
uv run python examples/make_demo.py
uv run pytesttests/test_stdio.py starts the real server over stdio and calls it through an MCP client, the same way Claude Code does.
Roadmap
Read Soda and Great Expectations results alongside dbt's.
OpenMetadata lineage and ownership, so an investigation can name who owns the broken table.
Snowflake and BigQuery through DuckDB community extensions.
Distribution checks: a numeric column whose mean or spread shifted between windows.
Contributions are welcome. New checks go in src/dqsleuth/engine.py with a planted fault in examples/make_demo.py and a test that finds it.
License
MIT
Available Tools
12 toolsdq_add_sourceARead-onlyIdempotent
Register more data for investigation. Files become views; DuckDB databases are attached READ_ONLY.
Use for data outside the auto-discovered folders, or to read many partition files as one table via a glob.
Inputs: path (required), name. Returns: object
dq_check_duplicatesARead-onlyIdempotent
Check whether key_columns are unique, and diagnose what kind of duplication it is.
Separates exact duplicate rows (the same record loaded twice: a re-run or overlapping incremental window) from conflicting duplicates (same key, different values: wrong grain or a join fan-out).
Inputs: table (required), key_columns (required), sample. Returns: object
dq_check_freshnessARead-onlyIdempotent
Check how recent the data is and whether volume is steady: latest timestamp, lag from now, rows per period, empty periods (missing loads) and periods with under half the median volume.
Gaps and low-volume periods are computed over the whole range; only the latest 60 periods are listed row by row. To check one segment (e.g. a single provider), use dq_run_sql with a GROUP BY.
Inputs: table (required), time_column (required), grain, periods. Returns: object
dq_check_nullsARead-onlyIdempotent
Count NULLs per column, optionally broken down over time to pinpoint when a column started going null.
Inputs: table (required), grain, columns, periods, +1 more. Returns: object
dq_check_relationshipARead-onlyIdempotent
Test a join before trusting it: orphaned child keys (rows an INNER JOIN silently drops), NULL foreign keys, and a non-unique parent key (which makes a LEFT JOIN fan out and inflate totals).
Inputs: child_key (required), parent_key (required), child_table (required), parent_table (required), +1 more. Returns: object
dq_dbt_lineageARead-onlyIdempotent
Walk dbt lineage from a node, marking every upstream/downstream node that has failing tests.
Upstream answers "where did this break?"; downstream answers "what does this break?", including exposures (dashboards) that would show wrong numbers.
Inputs: node (required), depth, direction. Returns: object
dq_dbt_test_detailARead-onlyIdempotent
Everything needed to explain one dbt test: its definition, config (severity, where), the model it tests, and the compiled SQL that returns the failing rows.
Inputs: test (required). Returns: object
dq_dbt_test_resultsARead-onlyIdempotent
Summarise the last dbt test/build run from target/run_results.json: counts by status, and each failing test with its type, column, tested model and failure count, worst first.
Inputs: limit, statuses. Returns: object
dq_explain_metric_changeARead-onlyIdempotent
Explain why a metric moved: compare a window with its baseline, then attribute the change to segments.
For "revenue dropped 35% yesterday": gives the overall change and, per dimension, which segments account for it. A segment flagged 'missing in current window' usually means a feed did not load, which is a data problem rather than a business one.
Inputs: table (required), time_column (required), top, metric, +4 more. Returns: object
dq_list_sourcesARead-onlyIdempotent
List every table dqsleuth can read, where each came from, and whether dbt artifacts were found.
Call this first. Tables come from CSV/Parquet/NDJSON files and DuckDB databases discovered under the project root, sources added with dq_add_source, and an optional read-only Postgres attachment.
Inputs: no named parameters. Returns: object
dq_profile_tableARead-onlyIdempotent
Profile a table: row count, and per column the type, null %, distinct count, min/max and mean.
Also flags investigation leads: fully-null or constant columns, high null rates, placeholder strings ('N/A', 'null', '') that hide missing values from NULL checks, and likely key columns.
Inputs: table (required). Returns: object
dq_run_sqlARead-onlyIdempotent
Run one read-only SELECT to confirm a hypothesis. Any other statement type is rejected.
Inputs: sql (required), limit. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have clearly distinct purposes: source discovery, profiling, null checks, duplicates, freshness, relationships, metric attribution, SQL, and dbt diagnostics. There is some overlap between dq_profile_table and dq_check_nulls, and dq_run_sql can be used broadly, but the descriptions make the intended boundaries reasonably clear.
All tools consistently use snake_case with a dq_ prefix, and names are mostly verb_noun or clear resource-action phrases. The dbt tools form a consistent dq_dbt_* subgroup, so the set is predictable despite not every name being verb_noun.
With 12 tools, the server is well-scoped for a data quality investigation toolkit. Each tool appears to earn its place by covering a distinct step in profiling, checking, diagnosing, and dbt triage.
The surface covers the core lifecycle well: source listing/addition, profiling, nulls, duplicates, freshness, relationships, metric change attribution, read-only SQL, and dbt test/lineage diagnostics. Minor gaps exist, such as removing registered sources or explicit schema/type drift checks, but dq_run_sql and profiling provide reasonable workarounds.
Maintenance
Related MCP Connectors
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Profile, query and diff CSV, Excel, JSON or NDJSON from text or a public URL.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables language models to run data-quality checks and profiling on local files, using dbt-style assertions like not_null, unique, relationships, and accepted_values.MIT
- AlicenseAqualityDmaintenanceEnables read-only analytical access to local CSV, Parquet, JSON files or a DuckDB database through MCP, with table discovery, column profiling, guarded SQL querying, and explain plans for safe use with Claude Desktop and Claude Code.81MIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients like Claude Desktop, Claude Code and Cursor to safely explore local CSV, Excel, Parquet and SQLite files by running guarded read-only DuckDB SQL over a sandboxed data directory. It also supports data profiling, chart generation as image content, and exporting query results, without ever allowing writes or access outside the configured folder.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to explore and analyse local CSV, Parquet or JSON files through validated read-only SELECT queries, with schema discovery, profiling and query-plan tools. Results are capped, timed, PII-masked and audit-logged inside a locked DuckDB sandbox that cannot write, reach the network or read other files.MIT