SchemaBrain + Claude Desktop
60 seconds: install SchemaBrain, run schemabrain init, restart Claude Desktop with Cmd+Q, ask Claude about your database.
SchemaBrain is the trust and intelligence layer between Claude Desktop and your Postgres database — twelve read-only MCP tools, validated metrics, tamper-evident audit. Works on macOS and Windows; Claude Desktop has no Linux build today, so Linux users see /setup/claude-code instead.
Install
postgresql+psycopg://... URL) or 2. Try with sample data (a 12-table SaaS fixture spins up in Docker; ~$0.03 to index). Just press Enter to take the default (2) and try the demo.
It then introspects the schema, classifies columns for PII, optionally calls Anthropic to suggest entities/metrics/joins, and writes the MCP entry to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
Restart Claude Desktop
Quit fully with Cmd+Q (macOS) or via the system tray (Windows). Closing the window is not enough — Claude Desktop only reads the MCP config on cold start. Relaunch.Ask Claude
list the entities SchemaBrain knows aboutIf Claude calls
list_entities and reports user, order, etc., you’re done. If not, run schemabrain doctor --verify to smoke-test the wiring without an Anthropic key.
Next: First 5 Queries walks you through exercising each load-bearing mechanism (read-only, PII refusal, audit chain, structured recovery) in ~10 minutes.
What you get
- 12 MCP tools, none of which can write. Full list and propagation rules in
/mechanism/read-only. - PII-aware refusal at the
get_metricboundary. SchemaBrain defaults to blockingcredential,payment_card, andgovernment_id.--pii-blockreplaces the set rather than extending it, so widen by listing the full target set, e.g.--pii-block credential,payment_card,government_id,contact,health. Details in/mechanism/pii-taxonomy. - Tamper-evident audit chain. Every tool call lands in an append-only
mcp_audittable with a SHA256 chain hash. Verify withschemabrain audit verify. Details in/mechanism/audit-chain. - Structured recovery envelopes. When
get_metricrefuses or fails, the response is a typed contract (recovery.suggested_tool,recovery.suggested_args) Claude can act on programmatically. Details in/mechanism/structured-recovery.
Sample refusal envelope
When Claude attempts a metric that touches a blocked PII category:recovery.suggested_tool, pivots to describe_entity to enumerate non-PII columns, and re-tries without the blocked column. No human round-trip required.
Troubleshooting
- “Server disconnected” in Claude Desktop — almost always a missed Cmd+Q. Quit fully and relaunch.
postgresql://URL fails withModuleNotFoundError— usepostgresql+psycopg://(psycopg v3 scheme).schemabrain initauto-rewrites the bare scheme with a one-line confirmation.onnxruntimeinstall fails on Apple Silicon + Python 3.12 — downgrade to Python 3.11 (pyenv install 3.11.10 && pyenv local 3.11.10) or pass--no-embedto degrade semantic search to keyword-only.
docs/setup.md (wizard) · docs/setup/manual.md (manual flow, logs, troubleshooting).