find_relevant_tablesLABSCO SUMMARY
It refuses rather than inventing the join.
The behaviour worth the setup is what happens when a question cannot be answered: the tool returns a structured refusal naming the reason and suggesting the recovery call, instead of fabricating a relationship that looks plausible. Add the PII refusal happening before the query runs, and a SHA256-hashed append-only audit log that audit verify exits non-zero on if a past row was rewritten, and you get a surface you can point at a production database. The cost is curation — the semantic layer only exists after an operator confirms entities.
What it is
A read-only layer between an agent and a database. Queries are compiled from definitions you control — entities, canonical joins and declared metrics — so there is no path from a prompt to raw SQL at your database.
What you get
- Physical-schema tools work as soon as you have indexed:
find_relevant_tablesretrieves by embedding cosine,describe_tabledumps one table,describe_columndrills in with the bidirectional FK graph suggest_joinsreturns the shortest FK-graph paths between table pairs;get_example_queriesreturns real SQL observed against a table from pg_stat_statements- The semantic layer opens once an entity is confirmed:
find_relevant_entities,list_entitiesanddescribe_entitycover curated entities and their identity columns list_metricsandget_metricdeclare and run pre-defined metrics;list_joinsandresolve_joinreturn canonical relationships, paste-ready- Every response carries a
token_estimateso an agent can budget context, and a status of success, empty, partial, degraded, error or refused withfollow_up_hintsfor the next call - PII tags propagate from the physical schema through joins and metrics — a query touching a blocked category is refused before the database is reached
Requirements
The PyPI package schemabrain, version 0.6.0, run as uvx schemabrain serve over stdio, or uvx schemabrain init to walk the whole setup. DATABASE_URL holds the Postgres connection string and stays in the environment, so credentials never appear in argv or logs; --store-path points at the SQLite store built by schemabrain index, defaulting to ./schemabrain.db. Postgres is the supported source today.
Setup effort
One command plus credentials — uvx schemabrain init, then supply credentials
USE CASES
Answering a business question against a curated schema
Find the entity, read its definition, and run a declared metric rather than composing SQL.
Exploring a schema nobody documented
Fall back to the physical tools when the semantic layer is empty or the question is purely structural.
Getting the join right
Ask for the canonical relationship between two entities, or the shortest FK path between two tables.
Keeping sensitive columns out of answers
PII tags travel through joins and metrics, so a query touching a blocked category is refused before the database sees it.
12 tools
Listed in project docs. Your client may show a different list.
describe_tabledescribe_columnsuggest_joinsget_example_queriesfind_relevant_entitieslist_entitiesdescribe_entitylist_metricsget_metriclist_joinsresolve_joinBEFORE YOU INSTALL
What to know first
Tools you get
12 tools named in the project's documentation.
Requires
- pipx (or pip) to install schemabrain; uvx only for the one-shot wizard
- DATABASE_URL in your environment
INSTALLATION
Connect your client
Server setup
Setup
pipx install schemabrain
schemabrain --versionuvx
uvx schemabrain initMCP Clients
Claude Desktop
schemabrain init --host claude-desktopThe configuration on this page does not set DATABASE_URL; the project's instructions put it in a .env file. Check which folder the server reads that file from before you rely on it.
Claude Code
schemabrain init --host claude-codeThe configuration on this page does not set DATABASE_URL; the project's instructions put it in a .env file. Check which folder the server reads that file from before you rely on it.
Cursor
schemabrain init --host cursorThe configuration on this page does not set DATABASE_URL; the project's instructions put it in a .env file. Check which folder the server reads that file from before you rely on it.
Windsurf
schemabrain init --host windsurfThe configuration on this page does not set DATABASE_URL; the project's instructions put it in a .env file. Check which folder the server reads that file from before you rely on it.
Zed, Codex, Cline, Continue
schemabrain init --host manualThe configuration on this page does not set DATABASE_URL; the project's instructions put it in a .env file. Check which folder the server reads that file from before you rely on it.