# DB2TOON MCP [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/kamil5b/db2toon  
**GitHub Stars:** 5  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/db2toon-mcp

## Description
Read-only PostgreSQL schema extraction to compact TOON for MCP clients.

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/kamil5b/db2toon), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Install:

```sh
git clone https://github.com/kamil5b/db2toon.git
```

2. Install:

```sh
cd db2toon
```

3. Install:

```sh
CGO_ENABLED=0 go build -o output/db2toon-mcp ./cmd/db2toon-mcp
```

4. Start the server:

```sh
./output/db2toon-mcp
```

## Documentation

## What DB2TOON MCP does

DB2TOON MCP turns database structure into TOON, a compact schema definition format intended to remain readable to both developers and language models. Its MCP interface is focused on inspection: the exposed `db2toon.extract_schema` tool reads metadata and returns the encoded result without providing database mutation operations.

The extractor can process live connections for PostgreSQL, SQLite, DuckDB, MySQL, MariaDB, CockroachDB, Microsoft SQL Server, and Oracle. It can also parse plain-text SQL dumps for those dialects. Extracted information may include tables, columns, data types, primary and foreign keys, indexes, comments, views, routines, triggers, sequences, enums, extensions, and other supported vendor-specific objects.

## How it works

Call `db2toon.extract_schema` with a required `dialect` and exactly one source: `db` for a connection URL or local database path, or `dump` for a SQL dump path. Optional extraction controls are supplied through an `options` object. The output is TOON text containing database metadata and schema definitions, with foreign keys represented as inline references or multi-column relationships.

Dump input is parsed offline and is never executed. The parser can retain bounded `INSERT` examples and, for supported dialects, preserve routine or trigger declarations as statement text. Live extraction derives the database name from the connection, while dump extraction uses the dump filename.

The operation uses a default 30-second timeout and caps responses at 4 MiB. Lower limits can be supplied through the extraction options. Connection strings are excluded from tool errors and results.

## Setup and configuration

Build the MCP-compatible stdio binary from the repository with Go:

```bash
CGO_ENABLED=0 go build -o output/db2toon-mcp ./cmd/db2toon
./output/db2toon-mcp
```

Pre-built binaries are available for supported Linux, macOS, and Windows platforms on the project's releases page. The project builds without CGO for those platforms; DuckDB database access requires `libduckdb` at runtime.

A request must select one dialect: `postgres`, `sqlite`, `duckdb`, `mysql`, `mariadb`, `cockroachdb`, `mssql`, `sqlserver`, or `oracle`. It must also provide either `db` or `dump`, but not both. Schema selection and extraction behavior are controlled in the options object, including timeout, output size, examples, schema filters, view inclusion, partitioned-table inclusion, and table or field exclusions.

## Tools and capabilities

- Extract live schemas from eight database families and compatible dialect names.
- Parse SQL dumps without connecting to or executing against a database.
- Normalize supported type names and map foreign-key relationships.
- Preserve indexes, comments, views, routines, triggers, sequences, and supported vendor objects.
- Add bounded example rows, with deterministic ordering and seeded selection available for PostgreSQL.
- Select one or multiple schemas and exclude tables or sensitive example fields.
- Return compact TOON suitable for MCP-based documentation and schema analysis.

## Limitations and notes

The MCP interface is read-only. Example sampling defaults to zero rows; when enabled, SQLite and DuckDB use a simple `LIMIT` query, while PostgreSQL supports ordered, reproducible selection with a seed. SQLite does not expose catalog comments, so those comments cannot be preserved.

Dump parsing supports common schema declarations, constraints, indexes, comments, and bounded inserts, but unsupported vendor declarations are ignored rather than executed. Complex PL/SQL and T-SQL bodies are preserved only as available statement text. The response-size limit of 4 MiB may require lower-scope extraction or exclusions for large schemas.

_Full upstream README: https://allmcps.com/mcp/db2toon-mcp/readme_

