Read-only PostgreSQL schema extraction to compact TOON for MCP clients.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
A CLI tool that converts database schemas into the Toon schema definition format.
db2toon connects to a database and extracts schema information (tables, columns, types, constraints, indexes, routines, triggers, and examples), then converts it into the human-readable Toon format for database design documentation and visualization. PostgreSQL, SQLite, DuckDB, MySQL/MariaDB, CockroachDB, Microsoft SQL Server, and Oracle are supported. pg2toon remains a PostgreSQL compatibility command.
character varying β varchar)Download pre-built binaries from the releases page for your platform.
The module also exposes a public Go API for callers that want the canonical schema model instead of invoking a command:
Set exactly one of Request.DB or Request.Dump. Dump contents are parsed
offline and never executed. The public API returns *schema.Database, so
callers may inspect or transform the model before encoding it.
Build and run the MCP-compatible stdio server:
The server exposes db2toon.extract_schema. Its required argument is
dialect (postgres, sqlite, duckdb, mysql, mariadb, cockroachdb, mssql, sqlserver, or oracle).
Provide exactly one of db or dump; optional extraction settings are
supplied in an options object. Dump files are parsed offline and never
executed. The tool is read-only, uses a 30-second default timeout, and limits
responses to 4 MiB. Set options.timeout and options.max_output_bytes to
lower limits when needed. Connection strings are never included in tool errors
or results.
Include up to two sample rows per PostgreSQL table in the TOON output, using a stable ordering and a reproducible sample seed:
The default -example-sample=0 omits @example sections.
SQLite and DuckDB also support -example-sample, but currently use a simple
LIMIT query. -example-sample-ordered and -seed are currently effective
only for PostgreSQL.
Select multiple schemas, include partitioned tables, and change the default 30-second operation timeout with:
-db string: Database connection URL or local database path; mutually exclusive with -dump-dump string: Plain-text SQL dump path; mutually exclusive with -dbdialect: postgres, sqlite, duckdb, mysql, mariadb, cockroachdb, mssql, sqlserver, or oracle for db2toon; pg2toon always uses PostgreSQL-out string: Output file path (optional, defaults to stdout)-schema string: A single schema to extract (defaults to public for PostgreSQL, main for SQLite/DuckDB, dbo for SQL Server, and the session CURRENT_SCHEMA for Oracle)-schemas string: Comma-separated schemas to extract; cannot be combined with -schema-include-partitioned: Include PostgreSQL partitioned tables-include-views: Include supported views-exclude-tables string: Comma-separated tables to exclude entirely; accepts table or schema.table-exclude-example-tables string: Comma-separated tables to exclude from @example sampling-exclude-example-fields string: Comma-separated qualified fields to exclude from examples, such as public.users.password_hash-example-sample int: Number of sample rows to include per table (defaults to 0)-example-sample-ordered: Select sample rows using deterministic ordering for PostgreSQL (defaults to false)-seed int: Seed for reproducible PostgreSQL sample selection (defaults to 0; currently ignored by SQLite/DuckDB)-timeout duration: Connection and extraction timeout (defaults to 30s)Dump mode supports plain-text SQL exports for PostgreSQL, SQLite, DuckDB,
MySQL/MariaDB, CockroachDB, SQL Server, and Oracle. Common tables, columns, constraints,
indexes, comments, and bounded INSERT examples are parsed without executing
the dump. PostgreSQL retains native enums, sequences, views, functions,
procedures, and triggers, including dollar-quoted routine bodies. MySQL/MariaDB
supports DELIMITER-based routine and trigger declarations. SQL Server and
Oracle retain supported views, functions, procedures, triggers, sequences,
types, synonyms, and selected vendor objects. Complex vendor-specific PL/SQL/
T-SQL bodies are preserved as available statement text; unsupported declarations
are ignored rather than executed.
The Toon format provides a clean, human-readable schema definition:
@database name {dialect=dialect}: Source database metadata. Live connections derive the name from the connection string; dump mode uses the dump filename without its extension.[TableName]: Table definition# comment: Table or column commentsname type {tags}: Column definition with optional tags
{pk}: Primary key{req}: Required (NOT NULL){pk,req}-> table(column): Foreign key reference (inline for single columns)@indices: Section for database indexes@enum: Enumerated type values@type: User-defined type metadata@sequence: Sequence configuration@synonym: Alternate object name@routine: Function or procedure metadata and definition where available@triggers: Table trigger metadata@objects: Vendor-specific schema objects, including Oracle materialized
views, packages, partitioned tables, scheduler jobs, and database links@example[n]{columns}:: Up to n sampled rows from the table// comment: Inline column commentNo reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/db2toon-mcp)<a href="https://allmcps.com/mcp/db2toon-mcp"><img src="https://allmcps.com/api/badge/db2toon-mcp?style=directory" alt="DB2TOON MCP on AllMCPs" /></a>