drawio
@achmadya-dev/mcp-drawio
MCP server for draw.io. Create diagrams via LLM — rendered inline in chat using MCP Apps.
Built on @achmadya-dev/mcp-core and @modelcontextprotocol/ext-apps.
Requirements
Node.js ≥ 20
MCP host with MCP Apps support (e.g. Cursor)
Install via npx
{
"mcpServers": {
"drawio": {
"command": "npx",
"args": ["-y", "@achmadya-dev/mcp-drawio"]
}
}
}Tools
Tool | Description |
| Render a diagram inline in chat from Mermaid or draw.io XML |
| Search 10k+ industry icon shapes (AWS, Cisco, P&ID, …) for XML diagrams |
search_shapes is registered when the bundled shape index is present (included in the npm package after build).
show_inline_drawio
Provide exactly one of mermaid or xml:
Input | Use for |
| Flowchart, sequence, ER, class, state, gantt, mindmap, C4, and 25+ other types |
| Hand-placed layouts, swimlanes, cloud/network/P&ID stencils, UI mockups |
Optional layout passes (XML only):
Option | Effect |
| Re-layout vertices with ELK (flowcharts, pipelines, hierarchical diagrams) |
| ELK flow direction (XML only; defaults to vertical) |
| Obstacle-avoiding edge routing without moving vertices |
For industry icons in XML diagrams, call search_shapes first and use the returned style strings in mxCell attributes. References: xml-reference.md, mermaid-reference.md.
Inline viewer
The create_diagram tool renders an interactive iframe in chat:
Zoom, pan, and fit-to-view
Fullscreen mode
Open in draw.io — opens the diagram in app.diagrams.net for editing and export (PNG, SVG, PDF)
To save a diagram as an image, use Open in draw.io → File → Export as.
Develop from source
git clone https://github.com/achmadya-dev/mcp-drawio.git
cd drawio-mcp
pnpm install
pnpm run build
pnpm startLocal Cursor config (.cursor/mcp.json):
{
"mcpServers": {
"drawio": {
"command": "node",
"args": ["${workspaceFolder}/dist/index.js"],
"cwd": "${workspaceFolder}"
}
}
}After changing viewer or server code, rebuild and restart the MCP server in Cursor.
Scripts
Command | Description |
| Compile TypeScript and copy |
| Run MCP server (stdio) |
| Run tests |
| Regenerate shape search index (requires network) |
| Format with Prettier |
Environment
Variable | Description |
| MCP Apps iframe domain (passed in resource |
| Optional path to a local |
| Optional path to a local |
| Optional path to a local |
The draw.io viewer loads from https://viewer.diagrams.net by default (CDN). Optional bundle overrides are useful for offline development or pinning a specific draw.io release.
Project layout
src/
index.ts MCP server entry (stdio, MCP Apps)
drawio/
drawio.ts Bundle loader (HTML, shape index, references)
utils.ts createDiagram, searchShapes, validation
viewer/html.ts Inline MCP App viewer (draw.io + MCP SDK)
tools/
search_shapes.ts Shape search tool (defineTool)
assets/
shared/ Tool description references (XML, Mermaid)
shape-search/ Pre-built shape index (~10k shapes)
vendor/app/ libavoid WASM (edge routing in viewer)
scripts/
copy-assets.ts Build-time asset copy
generate-shape-index.ts
dist/ Published to npmDiagram formats (quick guide)
Need | Approach |
Flowchart, sequence, ER, class, … | Mermaid via |
AWS / Azure / Cisco / P&ID icons | XML + |
Edit or export PNG/SVG | Open in draw.io in the inline viewer |
libavoid vendor refresh
Browser WASM lives in src/assets/vendor/app/libavoid/. To refresh:
cd src/assets/vendor/app/libavoid
npm pack libavoid-js && tar -xzf libavoid-js-*.tgz
cp package/dist/index.js libavoid.min.js
cp package/dist/libavoid.wasm libavoid.wasmRegenerate shape index (optional, when draw.io releases new shapes):
pnpm run generate:shapes
pnpm run buildRelease
Uses Changesets:
pnpm changeset
pnpm run version-packagesPush to main → GitHub opens a Version packages PR → merge → npm publish via CI.
Requires NPM_TOKEN secret on the repository.
License
Apache-2.0
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/achmadya-dev/mcp-drawio'
If you have feedback or need assistance with the MCP directory API, please join our Discord server