draw-mcp
Generate and validate production-quality draw.io XML with Claude Code.
draw-mcp combines a Claude Code skill with a CLI validator: 31 rules across 10 modules, four validation modes, reusable presets, and CI-ready output. It focuses on the structural and visual defects that syntax-only checks miss.
Quick start · Validation rules · Examples · Specifications
Why draw-mcp?
AI can generate valid draw.io XML that is still difficult to edit or review: disconnected edges, invalid hierarchy, unsafe HTML, missing fonts, broken containers, and unreadable Japanese labels. draw-mcp turns those quality requirements into executable checks.
| Capability | draw-mcp | draw.io MCP Server | Mermaid.js |
|---|
| Output | Native draw.io XML | Image/JSON | Text DSL |
| Layout control | Explicit and editable | Auto-layout | Auto-layout |
| Validation | 31 structural and visual rules | None | Syntax only |
| CJK text checks | Yes | Limited | No layout control |
| Offline validation | Yes | Optional | Yes |
| Best fit | Production diagrams and CI | Fast previews | Simple diagrams |
The official draw.io MCP server remains complementary for previews, Mermaid, and CSV workflows. draw-mcp is the quality gate for diagrams that must remain editable and consistent.
Quick start
Install the Claude Code plugin
/plugin marketplace add ekusiadadus/draw-mcp
/plugin add https://github.com/ekusiadadus/draw-mcp
Then ask Claude Code to create a diagram:
Create an architecture diagram with application and infrastructure layers.
Validate it in strict mode before finishing.
Install the CLI from GitHub
python -m pip install "git+https://github.com/ekusiadadus/[email protected]"
draw-mcp-validate diagram.drawio --mode strict
For local development:
git clone https://github.com/ekusiadadus/draw-mcp.git
cd draw-mcp
python -m pip install -e ".[dev]"
pytest
The validator can also emit JSON for CI and automation:
draw-mcp-validate diagram.drawio --mode production --format json
Supported Features
Features backed by validator rules, tests, and real examples:
- 31 Validation Rules across 10 modules (defined in
claims.yaml)
- 4 Validation Modes: loose, standard, strict, production
- CLI Tool:
draw-mcp-validate with text/JSON output, severity filtering, and mode selection
- Preset System: YAML-based presets as validation profiles (
--preset)
- Font Management: Enforces
fontFamily on all text elements
- Edge Routing: Z-order, relative geometry, arrowhead spacing, node spacing
- Containers: Swimlane, group, custom containers with pointer events
- Layers: Layer structure validation, cross-layer edge detection
- Endpoint Semantics: Source/target validity, floating/orphan edge detection
- Security: Dangerous HTML tag detection, control character validation
- Japanese Text: Width allocation for CJK characters
- CI Integration: GitHub Actions, pre-commit hooks, 153+ tests
Experimental Features
Features documented but not deeply validated:
- Advanced routing heuristics (crossing density, edit tolerance)
- Custom connection-point presets
- PRODUCTION mode auto-detection of preset from example metadata
Non-Goals
Features explicitly out of scope:
- Hosted preview (use draw.io desktop or VS Code extension)
- Mermaid or CSV conversion (use official
jgraph/drawio-mcp)
- Dark mode / lightbox runtime options
- Browser tab or editor orchestration
- Auto-layout (use draw.io's built-in layout engines)
Usage
Once installed, Claude Code uses this skill automatically for draw.io diagrams.
Create a simple flowchart showing: Start -> Process -> End
Draw an architecture diagram with swimlane containers
Create a layered diagram with infrastructure and application layers
Validation Modes
| Mode | Purpose | Rule Count |
|---|
loose | Minimal parseability check | 5 |
standard | Default development mode | 22 |
strict | PR and CI review | 31 |
production | Team-shared artifacts + preset compliance | 31 |
Rule counts are defined in claims.yaml and verified by CI.
Validation Rules (31)