Generates Draw.io compatible diagrams (flowcharts, sequence diagrams, network diagrams, and custom diagrams) from natural language prompts, outputting XML files that can be opened directly in Draw.io
Creates UML sequence diagrams showing interactions between participants with support for messages and return flows
MCP Draw.io Diagram Server
A Model Context Protocol (MCP) server that generates Draw.io compatible diagrams from natural language prompts. This server enables AI assistants to create professional diagrams in XML format that can be opened directly in Draw.io.
Features
Flowchart Generation: Create sequential flowcharts with various shapes (process, decision, terminator, data, etc.)
Sequence Diagrams: Generate UML sequence diagrams showing interactions between participants
Network Diagrams: Build network and architecture diagrams with custom node positioning
Custom Diagrams: Full control over shapes, positions, and connections for any diagram type
Draw.io Compatible: Outputs valid Draw.io XML format that can be imported directly
Installation
Clone or download this repository
Install dependencies:
Configuration
Environment Variables
DRAWIO_OUTPUT_DIR: (Optional) Specifies the directory where diagram files will be saved. If not set, files are saved to the current working directory.
Example:
Usage with Claude Desktop
Add this server to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Basic Configuration
With Custom Output Directory
Make sure to update the paths to match your actual installation directory and desired output location.
Available Tools
1. create_flowchart
Creates a sequential flowchart diagram and saves it to a file.
Parameters:
filename: Name for the output .drawio file (extension added automatically)steps: Array of flowchart stepslabel: Text for the steptype: Shape type (process, decision, terminator, data, document, delay)connectorLabel: Optional label for the connector arrow
Example:
2. create_sequence_diagram
Creates a UML sequence diagram showing interactions and saves it to a file.
Parameters:
filename: Name for the output .drawio file (extension added automatically)participants: Array of participant namesinteractions: Array of interactionsfrom: Source participantto: Target participantmessage: Interaction messagedashed: Use dashed line for returns (optional)
Example:
3. create_network_diagram
Creates a network or architecture diagram with positioned nodes and saves it to a file.
Parameters:
filename: Name for the output .drawio file (extension added automatically)nodes: Array of network nodesid: Unique identifierlabel: Display labeltype: Shape type (rectangle, cylinder, database, cloud, hexagon, ellipse)x,y: Position coordinateswidth,height: Optional dimensions
connections: Array of connectionsfrom: Source node IDto: Target node IDlabel: Connection label (optional)
Example:
4. create_custom_diagram
Creates a custom diagram with full control over all elements and saves it to a file.
Parameters:
filename: Name for the output .drawio file (extension added automatically)shapes: Array of shapesid: Unique identifier for connectionslabel: Text labeltype: Shape type (see supported shapes below)x,y: Positionwidth,height: Optional dimensions
connectors: Array of connectors (optional)from: Source shape IDto: Target shape IDlabel: Connector label (optional)
Supported shape types:
rectangle,roundedRectangle,ellipse,diamondparallelogram,cylinder,hexagon,clouddocument,process,decision,dataterminator,database,actor,note
Example Prompts
Here are some example prompts you can use with Claude:
Simple Flowchart:
Create a flowchart named "password-reset" for password reset: Start -> Enter Email -> Send Reset Link -> Check Email -> Reset Password -> EndSystem Architecture:
Create a network diagram named "web-architecture" showing a three-tier web architecture with load balancer, web servers, app servers, and databaseUML Sequence:
Create a sequence diagram named "user-auth" for user authentication with User, Frontend, Auth Service, and DatabaseCustom Business Process:
Create a custom diagram named "order-process" showing an order processing workflow with decision points for inventory check and payment validation
Output Format
The server automatically saves diagrams as .drawio files in the configured output directory (or current working directory if not configured).
To use the generated diagrams:
The server will report the full path where the file was saved
Open the
.drawiofile directly in Draw.io (https://app.diagrams.net)Edit, export, or share the diagram as needed
File Naming:
Files are automatically saved with the
.drawioextensionIf you specify
filename: "my-diagram", it will be saved asmy-diagram.drawioThe
.drawioextension is added automatically if not present
Development
Project Structure
Running Standalone
While this is designed as an MCP server, you can test the diagram generation directly:
Troubleshooting
Server not appearing in Claude:
Verify the path in
claude_desktop_config.jsonis correctEnsure Node.js 18+ is installed
Check that
npm installcompleted successfullyRestart Claude Desktop after configuration changes
Diagrams not opening in Draw.io:
Ensure you saved the file with
.drawioextensionVerify the XML is complete (starts with
<?xmland ends with</mxfile>)Try importing via File > Import in Draw.io
License
MIT
Contributing
Contributions are welcome! Feel free to submit issues or pull requests.
Roadmap
Future enhancements:
More diagram types (ERD, class diagrams, state machines)
Style customization (colors, fonts, line styles)
Layout algorithms for automatic positioning
Template library for common diagram patterns
Export to multiple formats (PNG, SVG, PDF)