Connectors · Postgres

Connect Postgres to AI agents: schema metadata and column descriptions over MCP

For engineers connecting a Postgres database so agents understand its tables and columns.

Updated

To connect Postgres, run brainbox ingest with a postgres:// URL. The CLI introspects tables, columns, keys and relationships, ingestion proposes entities and relationships, and agents read them over MCP. By default no rows are read.

  • One command: ingest postgres://…
  • Schema metadata only by default; profiling is opt-in.
  • Use --tables to limit scope and --review to check before publishing.

Run it

Run ingest with the connection string. Name a project with --project; otherwise it is named after the current directory. By default the CLI reads schema metadata only, never rows. Opt-in column profiling (--profile-data, on meta ingest db) samples rows to compute statistics, and full mode also sends enum values and JSON key shapes.

npx -y @brainbox-labs/cli@latest ingest postgres://user:pass@host:5432/mydb --tables orders,customers --review

What lands in the Brain

Entities for your tables with fields and types, relationships with cardinality and join keys, and where each entity lives (its runtime binding). Add a data dictionary and SQL files to add meaning, then approve the draft.

Lineage and profiling

If an ETL builds your schema, pass the mapping document so the server can say which upstream column fed each one. Profiling is opt-in; preview what would be uploaded first with brainbox profile preview <url>.

npx -y @brainbox-labs/cli@latest meta ingest db postgres://user:pass@host/mydb --mapping etl/orders-mapping.yaml
Postgres ingest options
OptionWhat it does
--tables a,bLimit to these tables
--reviewStop before publishing and print a review link
--sql <dir>, --sql-file <file> (meta ingest db)Add SQL query files
--mapping <path> (meta ingest db)ETL or column mapping document for lineage
--profile-data [full] (meta ingest db)Opt-in column profiling
--skip-profile-columnsExclude table.column pairs from profiling

FAQ

What does the CLI read from Postgres?
Schema metadata: tables, columns, primary and foreign keys, indexes and constraints.
Can I limit which tables are ingested?
Yes, with --tables a,b.
How do I record where a column came from in an ETL?
Pass a mapping document with --mapping on meta ingest db; the server derives column lineage from it.
Can I profile columns?
Yes, opt-in with --profile-data on meta ingest db. Cardinality by default; full mode adds enum values and JSON key shapes.

Give your agents a brain.

Sign in and ask your first question.

Book a Demo