mcp-schema-designer

v1.1.4
io.github.vpatser1/mcp-schema-designer Checked 8 hours ago Published 4 months ago

Design database schemas from natural language, validate SQL, generate migrations and types

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

design_schema

Design a database schema from a natural language description. Generates CREATE TABLE SQL (PostgreSQL), index recommendations, and a text-based ERD. Optionally accepts explicit table definitions to validate and enhance.

ParameterTypeDescription
description *stringNatural language description of the data model (e.g. 'an e-commerce platform with products, orders, and user reviews')
tablesarrayOptional: provide explicit table definitions to validate and enhance instead of generating from description

validate_schema

Validate SQL CREATE TABLE statements for best practices. Checks for missing primary keys, unnamed constraints, missing FK indexes, data type issues (e.g. TIMESTAMP vs TIMESTAMPTZ), naming conventions (snake_case, plural tables), and N+1 query risks.

ParameterTypeDescription
sql *stringSQL CREATE TABLE statements (PostgreSQL dialect) to validate

migrate_schema

Generate migration SQL by diffing a "from" schema against a "to" schema. Produces ALTER TABLE statements in safe dependency order, rollback SQL, and warnings for destructive changes (column drops, type changes).

ParameterTypeDescription
from_sql *stringCurrent database schema as SQL CREATE TABLE statements
to_sql *stringTarget database schema as SQL CREATE TABLE statements

generate_types

Generate typed code from SQL CREATE TABLE statements. Supports three output formats: TypeScript interfaces, Zod validation schemas, or JSON Schema definitions.

ParameterTypeDescription
format *stringOutput format: 'typescript' for interfaces, 'zod' for Zod schemas, 'json-schema' for JSON Schema
sql *stringSQL CREATE TABLE statements (PostgreSQL dialect) to generate types from

optimize_queries

Analyze a SQL query against a schema and suggest performance improvements. Identifies missing indexes, recommends query rewrites, and provides EXPLAIN plan interpretation hints.

ParameterTypeDescription
query *stringThe SQL query to optimize
schema *stringSchema context as SQL CREATE TABLE statements, so the tool can identify missing indexes and table structure