
Shadowjoin
io.github.harsh-chandakPublished by GitHub account harsh-chandakv0.3.2Updated Oct 24, 2026
Measure the matches your exact join is silently dropping, and get the rule that fixes each.
Overview
A local MCP server that measures how many matches an exact join silently drops, explains the misses, and suggests normalization rules to recover them.
- What you can do
- Measure a join between two configured sources and report a lower bound on lost matches, with sample pairs to check by hand. Explain the misses and separate mechanical normalization gaps from semantic ones needing alias tables. Suggest normalization rules and a greedy rule stack, warning when over-normalization recovers fewer matches. Compare runs to show whether a proposed fix actually improved the join. List the available normalization rules.
- When to use it
- Useful when a pipeline joins two sources on names, emails, SKUs or company names and you suspect silent losses, or when you want a repeatable, CI-checkable measurement instead of ad-hoc exploratory SQL. Also for deciding whether a real entity-resolution library is needed.
- Requirements
- Runs locally via npx (Node.js; SQLite needs Node 22.5+). Requires the SHADOWJOIN_CONFIG environment variable pointing to an absolute path of a config file naming data sources and their connection strings. Postgres and MySQL adapters need the optional pg or mysql2 peer packages; the MCP server needs the Model Context Protocol SDK peer. Read access to the sources it scans.
Installation
In SourceWeft
- Open Shadowjoin in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
shadowjoin
Measure the matches your exact join is silently dropping.
Your pipeline joins two sources on a name, an email, a SKU, a company. It matches what matches. Everything else just... isn't there. No error, no exception, no alert — the query returns, the dashboard renders, and a quarter of the rows that should have matched quietly don't.
shadowjoin runs a shadow matcher alongside your real join key and tells you how many matches you are losing, which normalization rule would recover each one, and — if you have any ground truth at all — proves the recoveries are real.
Fourteen seconds, no sound. Every figure in it is verbatim CLI output from the committed example below — higher-resolution version.
The progress output above is real: shadowjoin shows what it is doing while it
works. All of it is suppressed automatically when stdout is not a terminal, so
piping to a file, to jq, or running in CI produces byte-identical output to
before — and there is no postinstall script, because a tool you point at a
production database has no business running code at install time.
What it found on public data
Joining the S&P 500 constituent list against NYSE + Nasdaq listings on company name. Both files carry ticker symbols, so every recovered match can be checked rather than believed:
The exact join found one match. There were four hundred and twenty-eight, and 419 of them are confirmed correct by ticker.
Reproduce it yourself — the data ships with the repo:
A join you would actually ship
The example above is deliberately unflattering — a short index name against a full security description. Here is the realistic case.
Unicode CLDR country names (what your UI displays) joined to UN official country names (what your reference data uses), on the country name, with ISO 3166 alpha-3 as ground truth. That is a join people write every week.
It looks healthy. 82% matched, no errors, nobody investigating. And it is
silently dropping Antigua & Barbuda, Trinidad & Tobago,
São Tomé & Príncipe, Turks & Caicos Islands and Vietnam — the last one
because the UN spells it Viet Nam.
Two things this example shows that the first one does not:
Applying every rule finds nothing. The full rule set recovers zero here; the two-rule subset recovers five. Over-normalization collapses keys that should stay distinct, and shadowjoin names the better subset instead of letting you assume more rules is better.
It separates mechanical misses from semantic ones. The 39 it cannot explain are not normalization problems at all:
No string transform recovers those. They need an alias table or a real entity resolution library. Knowing which of your misses are mechanical and which are semantic is the difference between a one-line fix and a project.
That particular join is deliberately unflattering — a short index name against a full security description. It is a worked example of the measurement, not a claim that anyone ships that join. Point it at your own data to get a figure that means something about you.
The number is a floor, not an estimate
You cannot compute recall without labels. The entity-resolution literature calls the metric pair completeness, and it assumes an oracle you do not have in production.
So shadowjoin reports a lower bound: matches the shadow matcher found that exact matching missed. The shadow matcher has unknown recall of its own, so the true loss is at least this large and may be larger. Every figure ships with sample pairs so a human can verify them by hand, and when ground truth is available on both sides, the report carries a precision figure too.
This is deliberately the weaker claim. It is also the one that survives being questioned.
Why not just ask an LLM to check?
For a one-off look at a small table, do that — it is faster and this tool is redundant. It stops working when:
- You need the same number twice. An agent writes different SQL every run, so you cannot tell whether the pipeline changed or the query did.
- You need rules nobody thought of. Asked "is this join lossy," an agent tries
lower()andtrim(). It does not systematically try NFKD folding, diacritics, leading zeros, corporate suffixes, token reordering or listing boilerplate. The exhaustive rule set is the product. - You need it in CI.
--max-lossexits non-zero. "Ask Claude" has no exit code. - Exploratory SQL on production is expensive. This does hash joins on precomputed keys, under a statement timeout, in a read-only transaction.
Install
Zero runtime dependencies. pg and @modelcontextprotocol/sdk are optional
peers, pulled in only if you use the Postgres adapter or the MCP server.
Use it
CLI
Sources: CSV, JSON, Postgres, MySQL and SQLite. SQLite uses Node's built-in
node:sqlite (Node 22.5+), so it needs nothing installed; Postgres and MySQL
need pg or mysql2, which are optional peers.
Anything else works through the library in three lines, because the core takes two arrays rather than a connection:
Library
Claude Code plugin (easiest)
One command installs the skill and the MCP server together, and prompts for your config path:
Also listed in the official MCP registry
as io.github.harsh-chandak/shadowjoin.
MCP server
Lets an agent measure a join, look at real examples, propose a fix, and then prove the fix worked — a loop it cannot fake, because the measurement is not something it writes.
Tools: scan_join, explain_misses, suggest_normalization, compare_runs.
Two things this MCP server deliberately does not have:
- No tool that executes arbitrary SQL. An agent can name a configured source, a table and a column. That is the entire surface.
- No tool that accepts a connection string. Credentials live in your config file and never enter a tool call, because tool calls end up in transcripts.
Pointing it at a real database
shadowjoin opens a READ ONLY transaction with statement_timeout,
lock_timeout and idle_in_transaction_session_timeout set, and it refuses to
run if the role it connected with can write to the table it is about to read.
Give it a role that makes trust unnecessary:
Point it at a replica where you can.
It makes no outbound network connection except to the source you give it. No telemetry, not even opt-out. Check the imports — there are three dependencies and none of them is an HTTP client.
Limits
Read these before quoting a number from it.
- The figure is a floor. The shadow matcher's own recall is unknown. True loss is at least this, possibly more.
- Recoveries can be wrong. In the bundled example, 1 of 428 was contradicted
by ground truth and 8 were ambiguous — mostly share classes, where stripping
"Class A" merges genuinely different securities. Ambiguous matches need a
tie-breaker, not a normalization rule. Always read
samplePairs. - Per-rule counts overlap and will not sum to the total. Each is measured
independently against the exact baseline, deliberately, so the numbers are not
an artifact of the order rules happen to run in. Use
stack— the greedy ordering — to decide what to actually adopt. - More rules is not better. Applying every rule can recover fewer matches than the best subset, because over-normalization merges keys that should stay apart. shadowjoin warns when this happens and names the better subset.
- It reads your join keys, so those values are in memory while it runs.
--redacthashes them in sample output and server-side normalization keeps whole rows in the database, but neither makes the keys invisible. For regulated data, run it on a replica inside your own environment. - It does not write, fix or migrate anything. It measures.
unaccentin emitted SQL needs the Postgres extension of the same name.
Prior art
Blocking recall — pair completeness — is well established in the entity-resolution literature, along with its companions pairs quality and reduction ratio:
- A Survey of Blocking and Filtering Techniques for Entity Resolution
- Comparative Analysis of Approximate Blocking Techniques for Entity Resolution
- Supervised Meta-blocking
Those papers assume a labelled gold standard. shadowjoin's contribution is not the metric — it is computing a defensible version of it against a live pipeline with no labels at all, and reporting it as a bound rather than a point estimate.
For doing the matching rather than measuring what yours misses, use Splink, Dedupe or recordlinkage. shadowjoin is complementary: it tells you whether you need them.
License
MIT © Harsh N. Chandak
Source: README.md at commit adf3faf
Tools
0Version history
2- v0.3.2LatestOct 17, 2026
- v0.3.1Oct 11, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts