Labsco
tovarsh logo

mcp-drawdb

from tovarsh

Interact with drawdb database diagrams in the browser. Open https://drawdb.icen.ai/editor before using.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup

mcp-drawdb

δΈ­ζ–‡ζ–‡ζ‘£

MCP server for drawdb β€” lets AI assistants (Claude Code, Cursor, etc.) directly read and modify database diagrams in your browser.

How It Works

Copy & paste β€” that's it
Claude Code  ──stdio──►  npx mcp-drawdb  ──ws──►  Relay (embedded)  ◄──ws──  Browser (drawdb)
  • npx mcp-drawdb starts a WebSocket relay server internally (auto port 23432–23442), then connects as a client. If a relay is already running, it reuses it.
  • drawdb in the browser auto-scans ports 23432–23442 to find the relay, exposes diagram state to tools
  • The relay routes messages between Claude Code and the browser

No separate relay process needed β€” everything runs inside the MCP bridge.

Tools (14)

ToolDescription
pingTest connection to the browser
list_tablesList all tables with fields
get_diagramFull diagram overview: tables, fields, layout (x/y/w/h), relationships, database type
add_tableAdd a table with fields, color, comment
update_tableRename table, add/drop/alter fields with full property control
delete_tableDelete a table (cascades to relationships)
add_relationshipAdd FK with cardinality (1:1, 1:n, n:1, n:m) and constraint rules
delete_relationshipDelete a relationship
set_layoutReposition tables on canvas
set_databaseSwitch database type (mysql, postgresql, sqlite, mariadb, transactsql, oraclesql, generic)
get_issuesValidate diagram: duplicate names, missing PKs, type mismatches, etc.
export_sqlGenerate DDL SQL for the target database
clear_diagramRemove all tables and relationships
undoView last action on the undo stack

Environment Variables

VariableDefaultDescription
RELAY_URL(embedded)Connect to an external relay instead of starting one
PORT23432Starting port for the relay (auto-increments up to 23442)
HOST0.0.0.0Relay listen address
CORS_ORIGIN*CORS origin for the relay HTTP endpoint

Field Properties

When using add_table, update_table, each field supports:

PropertyTypeDescription
namestringColumn name
typestringSQL type (INT, VARCHAR, TEXT, DATETIME, ENUM, ...)
primarybooleanPrimary key
uniquebooleanUnique constraint
nullablebooleanAllow NULL (false = NOT NULL)
incrementbooleanAuto increment
unsignedbooleanUnsigned (numeric types)
default_valuestringDefault value
checkstringCHECK constraint expression
commentstringColumn comment
sizestringType size/precision (e.g. "255" for VARCHAR(255))
valuesstring[]Allowed values for ENUM/SET

Standalone Relay

For advanced setups (Docker, shared server), you can run the relay separately:

Copy & paste β€” that's it
npx mcp-drawdb-relay

Then configure the bridge with RELAY_URL:

Copy & paste β€” that's it
{
  "mcpServers": {
    "drawdb": {
      "command": "npx",
      "args": ["mcp-drawdb"],
      "env": {
        "RELAY_URL": "ws://your-server:23432"
      }
    }
  }
}

License

MIT