Skip to the content.

MCPg v0.3.0 — Catalog completeness, visualisation, and diff

Released: 2026-05-23 · 7 PRs since 0.2.0 · 45 MCP tools (was 33) · PostgreSQL 14 / 15 / 16 / 17 in CI

v0.3.0 closes Batch A of the post-0.2.0 roadmap: an agent can now see every shape of object PostgreSQL exposes, render the schema as a diagram, and diff it against another schema. The diff is also the structural foundation Phase 27 (shadow migrations) will build on.

Headlines

1. Twelve new introspection and visualisation tools

Group Tool What it does
Custom types list_enums Enum types in a schema with labels in sort order
  list_domains Domains with base type, default, and check constraints
  list_composite_types Standalone composite types with attributes
Foreign data list_foreign_data_wrappers Installed FDWs (handler/validator/options)
  list_foreign_servers Foreign servers + their wrappers + options
  list_foreign_tables Foreign tables in a schema
  list_user_mappings Role-to-server mappings; PUBLIC surfaces as user="public"
Logical replication list_publications Publications + per-pub operations + qualified table list
  list_subscriptions Subscriptions (superuser-gated, by PG design)
Structural relations list_foreign_keys FKs resolved to columns, aligned by ordinal position
Visualisation generate_schema_diagram Mermaid ER diagram (PK/FK markers, parent→child edges)
Diff compare_schemas Typed structural diff between two schemas

2. Mermaid ER diagrams

generate_schema_diagram returns a Mermaid erDiagram block an agent can paste into any Mermaid-aware renderer (GitHub, Mermaid Live, IDEs). Entities carry PK/FK column markers; edges point from referenced parent to referencing child. Views and foreign tables are excluded; partitions are excluded by default (toggle with include_partitions=true). Cross-schema FKs and edges to filtered-out tables are skipped rather than left dangling.

3. Structural schema diff

compare_schemas(left_schema, right_schema) returns a typed diff: tables added / removed / changed, and per-changed-table the same trichotomy for columns, indexes, constraints, and foreign keys. Column changes carry a fields_changed list of differing ColumnInfo fields, so reviewers can see exactly what shifted. Identity is by name — renames surface as a paired add + remove (no guessing). All list orderings are stable (alphabetical) so repeated runs produce identical output. This is the structural piece Phase 27 shadow migrations need.

4. Trust improvements

Roadmap context

The post-0.2.0 roadmap (PLAN.md §11) groups twelve themes into six deliverable batches:

Upgrade notes

Acknowledgements

Sourcery reviewed every PR (Sourcery findings closed PRs #4 and #5). Pre-commit hooks, ruff, mypy --strict, the 90%-coverage gate, and the PG 14–17 service-container matrix ran on every change.