lv24-diagram
Renders and lints Mermaid diagrams, producing SVG/PNG images and enforcing readability budgets for nodes, depth, cycles, edge labels, and label length.
Reads a live PostgreSQL schema to list tables, columns, nullability, primary/unique keys, and constraints; runs read-only row-limited queries; and generates Mermaid ER diagrams from the database catalog.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@lv24-diagram generate an ER diagram from the live PostgreSQL schema"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
lv24-diagram
Architecture-as-code MCP server for real projects: render and lint Mermaid diagrams, build ER diagrams from a live PostgreSQL schema, scan a repository into an architecture view, drive a shared draw.io editor, and keep lv24-brain in sync.
One server instead of three (mermaid + dbhub + drawio), with the workflow glue those tools lack.
agent ──stdio──> lv24-diagram ──┬── mermaid-isomorphic + chromium (SVG/PNG)
├── pg (read-only catalog queries) (tables/columns/FK → ER)
├── docker-compose + nginx + package.json (arch scan)
├── MCP client → 127.0.0.1:3214 (draw.io editor)
└── brain CLI (context in, digest out)Why another MCP
Checks before pretty pictures.
diagram_lintenforces readability budgets (nodes, depth, cycles, edge labels, label length) so overview diagrams stay readable.ER from the database, not from memory. Column names are the classic silent error; the schema tools read
pg_class/information_schema/pg_constraintand never guess.Architecture from the repository.
arch_scanreads compose services, nginxproxy_passtargets (includingset $varandupstreamblocks) and packages, and reports what it could not resolve instead of inventing it.Brain in the loop.
brain_contextseeds a diagram with the project's actual goal;brain_publishwrites one idempotent note (content hash) pointing atdocs/architecture/.
Related MCP server: advancedrawio
Install
node -v # >= 22.5
npm i -g lv24-diagram
lv24-diagram versionWindows: install under the Node you actually use (npm prefix -g tells you where). The package
spawns the binary by absolute path from the OpenCode config, not through npx.
Mermaid rendering needs Chromium. If it is missing:
npm i -g lv24-diagram --allow-scripts=lv24-diagram
# or, from the package directory:
npx playwright install chromiumConfigure
cd <repo> && lv24-diagram init # writes diagram.config.json{
"docs": { "dir": "docs/architecture", "theme": "default", "backgroundColor": "#ffffff" },
"database": {
"kind": "postgres",
"host": "127.0.0.1",
"port": 5432,
"database": "app",
"user": "readonly_user",
"password": "${APP_DB_PASSWORD}", // never a literal secret
"schemas": ["public"],
"includeViews": false,
"excludeTables": ["spatial_ref_sys"],
"statementTimeoutMs": 15000,
"maxRows": 500
},
"drawio": { "url": "http://127.0.0.1:3214/mcp", "editorUrl": "http://127.0.0.1:3214/" },
"arch": { "maxFiles": 4000 },
"brain": { "enabled": true, "project": "my-project" }
}Discovery order: --config, $DIAGRAM_CONFIG, ./diagram.config.json,
~/.config/lv24-diagram/config.json. ${VAR} is expanded at load time; a missing variable is a
hard error.
OpenCode
{
"mcp": {
"servers": {
"lv24-diagram": {
"type": "local",
"command": ["node", "<npm-prefix>/node_modules/lv24-diagram/dist/src/cli.js", "mcp"]
}
}
}
}Tools
Tool | What it does |
| Mermaid → SVG + PNG (image content block) |
| Readability budget: nodes, depth, cycles, edge labels, label length |
| Store |
| Tables/views with row estimates from PostgreSQL |
| Columns, types, nullability, PK/UK |
| One read-only |
| Mermaid |
| Compose + nginx + packages → services, edges, unknowns |
|
|
| Health of the shared draw.io server and connected documents |
| Mermaid → native draw.io cells (replace/add/new-page) |
| Page → PNG / SVG / XML at an absolute path |
| Goal, next action, active items from lv24-brain |
| Idempotent digest note for the saved diagram set |
CLI: mcp, doctor, render, scan, brain, init, version.
draw.io
The editor is one shared HTTP server per machine (port 3214, WebSocket 3337), because two instances fight over the extension port. It can run headless and serve the editor:
lv24-diagram drawio start # node drawio-mcp-server --editor --transport http --http-port 3214 --extension-port 3337 --host 127.0.0.1Open http://127.0.0.1:3214/ once — the page connects a document, and the draw.io tools work.
Without an open editor they return No connected Draw.io documents; that is expected, not a fault.
Keep the tab visible: Chrome moves background tabs to bfcache and drops the WebSocket.
Brain sync
brain_contextrunsbrain open . --jsonand returnsgoal,next_action,active.diagram_save/schema_er/arch_diagramcallbrain_publishunlesspublish_to_brain: false.Publishing is skipped when the manifest content hash was already published; the note id and hash live in
docs/architecture/.diagrams.json.Notes contain names, counts and paths only.
redactSecretsstripsuser:pass@andpassword=/token=patterns before anything is written.If the brain CLI is missing or the project is unregistered, the diagram is still saved; the tool reports the sync failure instead of failing the work.
Security
Everything is local: stdio transport, draw.io bound to
127.0.0.1.Database access is read-only by construction: the session is set to read-only, the user should be
db_datareader/SELECT-only, and the SQL guard is explicitly a guardrail, not a permission boundary.No secrets in configs, notes or diagrams;
${ENV}only.arch_scanskips hidden directories and never reads.env*contents — only presence of files.
Development
npm install
npm run build
npm test # node:test, 21 tests
node dist/src/cli.js doctorSee AGENTS.md for repository rules and docs/design.md for decisions.
License
Apache-2.0.
Available Tools
14 toolsarch_diagramArchitecture diagramC
Build a Mermaid architecture view (container | context | deploy) from the repository scan, optionally save it.
Inputs: path, save, view, title.
arch_scanScan repository architectureB
Detect services from docker-compose, nginx proxy targets and packages. Facts only; unknowns are reported explicitly.
Inputs: path.
brain_contextProject context from lv24-brainA
Read the curated project state (goal, next action, active items) so diagrams match what the project is actually doing.
Inputs: no named parameters.
brain_publishPublish diagram digest to lv24-brainA
Write one note describing the saved diagram set. Idempotent: skipped when the content hash was already published. Use dry_run to preview the note without writing.
Inputs: dry_run.
diagram_lintLint MermaidB
Check a Mermaid diagram against readability budgets (node count, depth, cycles, edge labels, label length).
Inputs: mermaid (required), max_nodes.
diagram_renderRender MermaidB
Render a Mermaid diagram to SVG and/or PNG. Returns a text summary plus a PNG image when requested.
Inputs: mermaid (required), png, theme, background.
diagram_saveSave diagramB
Render and store a diagram as NN-slug.mmd/.svg/.png under docs.dir, update the README index, and optionally publish a digest to lv24-brain.
Inputs: title (required), mermaid (required), png, theme, +2 more.
drawio_exportExport draw.io diagramC
Export a page of the connected draw.io document to PNG, SVG or XML.
Inputs: format (required), output_path (required), page, embed_xml.
drawio_import_mermaidImport Mermaid into draw.ioC
Convert Mermaid into native draw.io cells on a page of the connected editor document.
Inputs: mermaid (required), mode, insert_mode.
drawio_statusdraw.io statusB
Check the shared draw.io MCP server and list connected editor documents.
Inputs: no named parameters.
schema_columnsDescribe columnsB
Return columns, types, nullability and PK/UK flags for the given tables.
Inputs: tables (required).
schema_erER diagram from schemaB
Build a Mermaid erDiagram from the live database schema (tables ranked by size), optionally render and save it.
Inputs: save, title, tables, max_entities, +1 more.
schema_queryRead-only queryA
Run one read-only SELECT/WITH statement with a row limit. The DB user must still be read-only; the guard is not a permission boundary.
Inputs: sql (required).
schema_tablesList tablesB
List tables and views with row estimates from the configured PostgreSQL database.
Inputs: pattern, include_views.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Tools are grouped by clear domain prefixes (diagram_, schema_, arch_, drawio_, brain_) and mostly have distinct purposes. A few boundaries blur: diagram_save internally renders, schema_er and arch_diagram both produce Mermaid and can optionally save, and diagram_render overlaps with both save paths. Descriptions mostly resolve these, so misselection risk is low but not zero.
All names use consistent snake_case with a domain prefix (diagram_, schema_, arch_, drawio_, brain_), making the set easy to scan. Minor deviations from a strict verb_noun pattern appear in noun-form names like schema_tables, schema_columns, schema_er, and arch_diagram, but the convention remains predictable.
Fourteen tools fit comfortably within the well-scoped 3-15 range and each corresponds to a meaningful step in the diagram workflow. No tool appears redundant or trivially thin given the breadth of Mermaid, schema, architecture, draw.io, and project-context functionality.
The surface covers the core lifecycle: render, lint, save with README indexing, schema introspection, ER and architecture generation, draw.io import/export, and brain context/publish. Gaps remain around managing saved artifacts (no list/read/delete of existing diagrams) and draw.io page creation, though these can be worked around outside the server.
Maintenance
Related MCP Connectors
Architecture diagrams, explanations and Mermaid source for public GitHub repositories.
Render, verify, describe, and safely edit Mermaid diagrams through MCP.
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
30+ deterministic dev and delivery tools: linting, metrics, diagrams, model advice, AI-text checks.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI coding agents to list, read, create, update, delete, and render PlantUML and Mermaid diagrams, and check them against the actual codebase to detect architecture drift.15100 npm1MIT
- AlicenseBqualityBmaintenanceEnables generating editable draw.io architecture diagrams from system descriptions, with automatic ELK layout, official icons, layered views, and objective quality scoring.11MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to turn natural-language descriptions of systems and data into editable, auto-laid-out Excalidraw diagrams across 25 types — from architecture and sequence diagrams to Gantt charts and scatter plots — plus optionally persist the architecture as a queryable, version-controlled knowledge graph. Runs fully offline with export to SVG and PNG, and diagrams can be revised afterward in natural language.-
- FlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to generate, revise, and export auto-laid-out hand-drawn diagrams from architecture descriptions across many diagram types, and optionally maintain a queryable, version-controlled architecture knowledge graph.-