A powerful VS Code extension that provides a live visual diagram of your DBML (Database Markup Language) files and securely exposes your live schema to AI assistants via a built-in Model Context Protocol (MCP) server.
Features
-
Live DBML Visualization
- Automatically parses your active
.dbmlfile as you type. - Renders a beautiful Entity-Relationship Diagram (ERD) using Mermaid.js directly inside a VS Code Webview.
- Automatically parses your active
-
Bundled MCP Server
- Spins up a local MCP server in the background using
stdiotransport. - Syncs your active editor's DBML content in real-time.
- Exposes a
dbml://current-schemaresource so AI assistants (like Claude or Cursor) can perfectly understand your database schema without you having to copy-paste your code.
- Spins up a local MCP server in the background using
How to Run the Extension
- Open this project in VS Code.
- Press
F5to launch the Extension Development Host. - In the new VS Code window, open or create a
.dbmlfile. - Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P) and selectShow DBML Viewer. - Edit your
.dbmlcode and watch the diagram update instantly!
How to Connect to AI (MCP Setup)
Because this extension bundles an MCP server, you can give your AI agents live access to your database schema.
Claude Desktop
Add the following to your Claude configuration file (~/.claude_desktop_config.json on Linux/Mac):
{
"mcpServers": {
"dbml-diagram-viewer": {
"command": "node",
"args": [
"/path/to/your/dbml-viewer/out/mcp/server.js"
]
}
}
}
Cursor IDE
- Open Cursor Settings (
Ctrl + ,). - Navigate to Features -> MCP.
- Click + Add New MCP Server.
- Type:
command - Name:
dbml-diagram-viewer - Command:
node /path/to/your/dbml-viewer/out/mcp/server.js
Once connected, you can ask your AI: "Write a SQL query joining the tables from my dbml://current-schema" and it will magically know exactly what you've designed!
For details on how the extension is built, see the docs/ folder.