Skip to content

[FEATURE] Built-in MCP server for AI-assisted schema access #992

@chupi33

Description

@chupi33

Is your feature request related to a problem? Please describe.

When working with AI-powered development agents (Claude Code, Cursor, Copilot, Windsurf, etc.), there is no standardized way for these agents to access the database schema designed in DrawDB. Developers currently have to manually copy/paste SQL exports or describe their schema in natural language to give their AI assistant the necessary context. This is error-prone, tedious, and breaks the flow — especially on large schemas with dozens of tables, complex relationships, and specific constraints.

A related issue has already been raised for a CLI (#716), highlighting that DrawDB's powerful schema modeling capabilities are currently locked inside the browser GUI with no programmatic access.

Describe the solution you'd like

I'd like DrawDB to ship a built-in MCP (Model Context Protocol) server that exposes the diagram's schema data to AI dev agents in a read-oriented, structured way. MCP is the emerging open standard (initiated by Anthropic, now widely adopted) for connecting AI assistants to external data sources.

Proposed MCP tools / resources:

  • list_tables — Return all table names with optional brief descriptions/comments
  • describe_table(table_name) — Return full column definitions (name, type, nullable, default, constraints) for a given table
  • list_relationships — Return all foreign key relationships with cardinality (one-to-one, one-to-many, many-to-many) and referential actions (CASCADE, SET NULL, etc.)
  • describe_relationship(from_table, to_table) — Return detailed relationship info between two specific tables
  • get_schema_summary — Return a high-level overview: table count, relationship count, database dialect, subject areas, and notes
  • list_enums / list_custom_types — Return user-defined enums and custom types
  • export_ddl(dialect?) — Return the SQL DDL for the full schema or a subset of tables
  • export_dbml — Return the schema in DBML format (human-readable, database-agnostic)
  • search_tables(query) — Search tables/columns by name or comment (useful for large schemas)

Transport options:

The MCP server could support both stdio (for local tools like Claude Code) and Streamable HTTP (for remote/networked setups), making it compatible with the broadest range of MCP clients. A simple npx drawdb-mcp --file diagram.ddb or drawdb-mcp --watch ./project/schema.json command would make integration trivial.

Key use cases this would unlock:

  1. Schema-aware code generation — AI agents could generate repository layers, migrations, API endpoints, or ORM models that are perfectly aligned with the designed schema, without manual copy/paste.
  2. Code review with schema context — Agents reviewing PRs could cross-reference code changes against the actual database design to catch inconsistencies (e.g., a missing column, a wrong type, a broken relationship).
  3. Natural language querying — Developers could ask their AI assistant "which tables reference the users table?" or "what are the columns in the orders table?" and get instant, accurate answers.
  4. Documentation generation — Agents could produce up-to-date data dictionaries, ERD documentation, or onboarding guides directly from the source of truth.
  5. Schema validation in CI/CD — Combined with the CLI ([FEATURE] Command Line Interface (CLI) for Automated File Transformations (e.g., JSON to SQLite) #716), an MCP-enabled DrawDB could be integrated into automated pipelines where agents verify that migrations match the designed schema.

Additional context

  • The Model Context Protocol is now supported by Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, Zed, and many other AI-powered IDEs. An official MCP server for DrawDB would position it as a first-class citizen in the AI-assisted development workflow.
  • A community fork already exists ([anatoly314/drawdb-mcp](https://github.com/anatoly314/drawdb-mcp)) which demonstrates strong demand. However, it is focused on full GUI control via WebSocket (create/modify diagrams through AI), whereas this request is primarily about read access to schema data — a lighter, lower-risk integration that would benefit a much wider audience.
  • Other diagramming tools have started shipping MCP servers (e.g., [Draw.io MCP Server](https://github.com/lgazo/drawio-mcp-server)), and database tools like Microsoft's SQL MCP Server already expose schema exploration tools via MCP. DrawDB is uniquely positioned as an open-source, schema-first design tool — native MCP support would be a strong differentiator.
  • This feature aligns naturally with the existing JSON export format. The MCP server could simply parse a .ddb / .json diagram file and expose its content through the MCP protocol, requiring minimal changes to the core codebase.
  • The related CLI request ([FEATURE] Command Line Interface (CLI) for Automated File Transformations (e.g., JSON to SQLite) #716) could share the same underlying logic — the schema parsing and transformation layer could serve both the CLI and MCP server.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions