schemabrain init
The activation wizard. Pulls the seven stages of getting from “I have a Postgres URL” to “Claude Desktop sees the schemabrain MCP server” into one command. Each stage auto-skips when its work is already done, so re-runs are safe and cheap.
- Source check — validates the URL is reachable and the session is read-only on Postgres.
- Index schema — DDL introspection into the SQLite store.
- Curate entities — LLM-suggested domain entities (or dbt manifest if found).
- Curate metrics — LLM-suggested aggregations (or dbt metrics if found).
- Curate joins — FK +
pg_stat_statementsmining; deterministic, no LLM. - Wire host — writes the
schemabrainblock into the chosen MCP host’s config. - Next step — prints what to ask the agent first.
Source
| Flag | Purpose |
|---|---|
--source URL | Postgres URL. Deprecated when the URL contains a password — prefer --url-env. |
--url-env VARNAME | Env var holding the source URL (e.g. DATABASE_URL). Keeps credentials out of argv. |
--from-dbt PATH | Import entities + metrics from a dbt manifest.json. Auto-detected from $DBT_PROJECT_DIR or by walking up from cwd for a dbt_project.yml. |
Stages
Turn individual wizard stages on or off:| Flag | Effect |
|---|---|
--skip-index | Skip stage 2. Use when you have already indexed in a different session. |
--enrich | Generate LLM column descriptions during index (Claude Haiku 4.5; ~2.00 for a 50-table schema). Requires ANTHROPIC_API_KEY. |
--no-entities | Skip stage 3. Curate later via schemabrain entities suggest --apply. |
--no-metrics | Skip stage 4. Curate later via schemabrain metrics suggest --apply. |
--no-joins | Skip stage 5. Curate later via schemabrain joins suggest --apply. |
--no-embed | Skip local sentence-embedding generation. Required on Apple Silicon + Python 3.12+ where fastembed’s onnxruntime dependency has no wheel. Degrades find_relevant_entities to keyword/substring matching. |
Host
| Flag | Default | Purpose |
|---|---|---|
--host {claude-desktop,claude-code,cursor,windsurf,manual} | claude-desktop | Which host to wire. manual prints the snippet without writing anywhere. |
--store-path PATH | ./schemabrain.db | Path to the local SQLite store. |
--env-var VARNAME | SCHEMABRAIN_DATABASE_URL | Env var the host sets to the DB URL in its config. |
Cost
| Flag | Default | Purpose |
|---|---|---|
--entities-max-cost-usd USD | $SCHEMABRAIN_MAX_LLM_COST_USD | Hard cap on stage 3 LLM spend. |
--metrics-max-cost-usd USD | $SCHEMABRAIN_MAX_LLM_COST_USD | Hard cap on stage 4 LLM spend. |
Behaviour
| Flag | Effect |
|---|---|
--yes, -y | Accept every prompt. Implies --skip-llm-confirm plus the host-overwrite confirmation. Use in CI. |
--skip-llm-confirm | Skip the Enter-to-continue pause before LLM stages. Auto-on in non-TTY environments. |
--print-only | Alias for --host manual. Prints the snippet, writes nothing. |
--pii-block CSV | Comma-separated PIICategory list written into the host snippet as serve --pii-block .... Omitted defaults to credential,payment_card,government_id under --yes (with a stderr confirmation) or to an interactive prompt otherwise. Pass '' to clear the operator policy; the always-on catastrophic-leak floor still refuses at every read gate and cannot be disabled. |
--emit-yaml-dir PATH | After the wizard completes, write one YAML per applied entity / metric / canonical join into PATH/entities/, PATH/metrics/, PATH/joins/. Gives the operator on-disk definitions to edit and re-apply alongside the SQLite store. Refuses if any target file already exists. |
Examples
First-time setup for Claude Desktop
CI smoke (non-interactive, deterministic)
dbt-driven curation
Apple Silicon + Python 3.12+
Related
Setup walkthrough
Narrative for first-time users.
schemabrain index
The underlying indexer the wizard calls.
schemabrain doctor
Health-check what
init wired up.schemabrain apply
Re-apply the YAMLs
--emit-yaml-dir produced.