Summary
Add a url output mode to the Claude Code skill that generates a draw.io browser URL (same mechanism as the MCP Tool Server), so users can open diagrams in the browser without running a separate MCP server or installing draw.io Desktop.
Motivation
Currently, the four integration approaches serve different needs:
| Approach |
Output |
Fixed context cost |
Dependencies |
| MCP App Server |
Inline in chat |
Low (remote) |
MCP Apps host |
| MCP Tool Server |
Browser URL |
~12K tokens (XML ref + Mermaid ref embedded in tool descriptions) |
MCP client |
| Skill + CLI |
Local .drawio file |
~1K (SKILL.md, loaded on-demand only when skill is invoked) |
draw.io Desktop (for export) |
| Project Instructions |
Clickable link |
~0 |
Nothing |
The MCP Tool Server embeds shared/xml-reference.md (~8,400 tokens) and shared/mermaid-reference.md (~3,400 tokens) directly in tool descriptions — ~12K tokens permanently in context, even when the user never creates a diagram. (Token counts measured with tiktoken against current main.)
The skill-cli approach avoids this cost by loading the XML reference on-demand. But it currently only supports local file output, requiring either draw.io Desktop or a manual file-open step.
Bridging the gap: if the skill could also generate browser URLs, users would get the best of both worlds — on-demand context loading + browser-based editing — without needing an MCP server or draw.io Desktop.
Proposed behavior
Add a url format option to the skill:
/drawio url flowchart for user login → opens browser with diagram
/drawio url architecture overview → opens browser with diagram
When url is specified, the skill would:
- Generate draw.io XML (same as current flow)
- Write the
.drawio file (for persistence / re-editing)
- Generate a
https://app.diagrams.net/#create=... URL from the XML
- Open it in the default browser
Implementation
The URL generation uses only Node.js built-in modules (zlib for deflate, child_process for opening the browser) — no external dependencies required.
The core logic (same compression + URL format as mcp-tool-server/src/index.js):
- Read the XML file
encodeURIComponent(xml) → zlib.deflateRawSync() → base64 encode
- Build
https://app.diagrams.net/?grid=0&pv=0&border=10&edit=_blank#create={type:"xml",compressed:true,data:<b64>}
- Open URL in default browser (macOS:
open, Linux: xdg-open, Windows: .url temp file workaround to preserve # fragment)
Why zlib works as a pako replacement
The MCP Tool Server uses pako.deflateRaw() for compression. Node.js's built-in zlib.deflateRawSync() implements the same algorithm (RFC 1951). The output is identical for the same input, so URLs generated by either approach are interchangeable — draw.io's #create handler will decompress them correctly.
The Windows .url temp file workaround is also borrowed directly from the MCP Tool Server, which added it to prevent cmd.exe from stripping the #create= fragment (see mcp-tool-server/src/index.js).
Updated format table
| Format |
Output |
Dependency |
| (default) |
.drawio file |
None |
png / svg / pdf |
.drawio.png / .svg / .pdf |
draw.io Desktop |
url (proposed) |
Browser tab at app.diagrams.net |
Node.js (already available in Claude Code) |
Benefits
- No fixed context cost — XML reference is fetched on-demand when the skill is invoked, not permanently embedded in tool descriptions
- No MCP server needed — works in Claude Code without any MCP configuration
- No draw.io Desktop needed — diagrams open directly in the browser editor
- No external dependencies — uses only Node.js built-in
zlib
- Consistent URL format — same
#create= protocol as MCP Tool Server, so behavior is identical
- Complements existing modes —
url for quick browser viewing, local files for persistence/export
Considerations
- URL length: The URL contains the full diagram data in the hash fragment. Very large diagrams may hit browser URL length limits. The MCP Tool Server has the same constraint.
- Mermaid/CSV via URL: The
#create protocol also supports type: "mermaid" and type: "csv". This could be a follow-up enhancement if the skill ever adds Mermaid support.
- Persistence: When using
url mode, the skill should still write the .drawio file locally so the user has a persistent copy they can re-edit.
Summary
Add a
urloutput mode to the Claude Code skill that generates a draw.io browser URL (same mechanism as the MCP Tool Server), so users can open diagrams in the browser without running a separate MCP server or installing draw.io Desktop.Motivation
Currently, the four integration approaches serve different needs:
.drawiofileThe MCP Tool Server embeds
shared/xml-reference.md(~8,400 tokens) andshared/mermaid-reference.md(~3,400 tokens) directly in tool descriptions — ~12K tokens permanently in context, even when the user never creates a diagram. (Token counts measured with tiktoken against currentmain.)The skill-cli approach avoids this cost by loading the XML reference on-demand. But it currently only supports local file output, requiring either draw.io Desktop or a manual file-open step.
Bridging the gap: if the skill could also generate browser URLs, users would get the best of both worlds — on-demand context loading + browser-based editing — without needing an MCP server or draw.io Desktop.
Proposed behavior
Add a
urlformat option to the skill:/drawio url flowchart for user login→ opens browser with diagram/drawio url architecture overview→ opens browser with diagramWhen
urlis specified, the skill would:.drawiofile (for persistence / re-editing)https://app.diagrams.net/#create=...URL from the XMLImplementation
The URL generation uses only Node.js built-in modules (
zlibfor deflate,child_processfor opening the browser) — no external dependencies required.The core logic (same compression + URL format as
mcp-tool-server/src/index.js):encodeURIComponent(xml)→zlib.deflateRawSync()→ base64 encodehttps://app.diagrams.net/?grid=0&pv=0&border=10&edit=_blank#create={type:"xml",compressed:true,data:<b64>}open, Linux:xdg-open, Windows:.urltemp file workaround to preserve#fragment)Why zlib works as a pako replacement
The MCP Tool Server uses
pako.deflateRaw()for compression. Node.js's built-inzlib.deflateRawSync()implements the same algorithm (RFC 1951). The output is identical for the same input, so URLs generated by either approach are interchangeable — draw.io's#createhandler will decompress them correctly.The Windows
.urltemp file workaround is also borrowed directly from the MCP Tool Server, which added it to preventcmd.exefrom stripping the#create=fragment (seemcp-tool-server/src/index.js).Updated format table
.drawiofilepng/svg/pdf.drawio.png/.svg/.pdfurl(proposed)Benefits
zlib#create=protocol as MCP Tool Server, so behavior is identicalurlfor quick browser viewing, local files for persistence/exportConsiderations
#createprotocol also supportstype: "mermaid"andtype: "csv". This could be a follow-up enhancement if the skill ever adds Mermaid support.urlmode, the skill should still write the.drawiofile locally so the user has a persistent copy they can re-edit.