Draw.io Diagram Server
Generates professional 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.
README
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:
npm install
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:
export DRAWIO_OUTPUT_DIR=/path/to/diagrams # Linux/macOS
set DRAWIO_OUTPUT_DIR=C:\diagrams # Windows
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
{
"mcpServers": {
"drawio-diagram": {
"command": "node",
"args": ["D:\\TopSecret\\diagram-master\\index.js"]
}
}
}
With Custom Output Directory
{
"mcpServers": {
"drawio-diagram": {
"command": "node",
"args": ["D:\\TopSecret\\diagram-master\\index.js"],
"env": {
"DRAWIO_OUTPUT_DIR": "C:\\Users\\YourName\\Documents\\Diagrams"
}
}
}
}
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:
Create a flowchart named "login-process" for a login process with these steps:
1. Start (terminator)
2. Enter credentials (data)
3. Validate credentials (process)
4. Is valid? (decision)
5. Show dashboard (process)
6. End (terminator)
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:
Create a sequence diagram named "api-request" for an API request with participants: Client, API Server, Database
Show these interactions:
- Client sends "GET /users" to API Server
- API Server sends "SELECT * FROM users" to Database
- Database returns "User data" to API Server (dashed)
- API Server returns "200 OK" to Client (dashed)
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:
Create a network diagram named "web-architecture" showing:
- Web Server (rectangle) at position 100, 100
- Application Server (rectangle) at position 300, 100
- Database (database/cylinder) at position 500, 100
Connect them in sequence with labeled connections
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 -> End -
System Architecture:
Create a network diagram named "web-architecture" showing a three-tier web architecture with load balancer, web servers, app servers, and database -
UML Sequence:
Create a sequence diagram named "user-auth" for user authentication with User, Frontend, Auth Service, and Database -
Custom 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
.drawioextension - If you specify
filename: "my-diagram", it will be saved asmy-diagram.drawio - The
.drawioextension is added automatically if not present
Development
Project Structure
diagram-master/
├── index.js # MCP server implementation
├── drawio-generator.js # Draw.io XML generation utilities
├── package.json # Project dependencies
└── README.md # This file
Running Standalone
While this is designed as an MCP server, you can test the diagram generation directly:
import { DrawioGenerator } from './drawio-generator.js';
const generator = new DrawioGenerator();
const steps = [
{ label: 'Start', type: 'terminator' },
{ label: 'Process Data', type: 'process' },
{ label: 'End', type: 'terminator' }
];
const xml = generator.createFlowchart(steps);
console.log(xml);
Troubleshooting
Server not appearing in Claude:
- Verify the path in
claude_desktop_config.jsonis correct - Ensure Node.js 18+ is installed
- Check that
npm installcompleted successfully - Restart Claude Desktop after configuration changes
Diagrams not opening in Draw.io:
- Ensure you saved the file with
.drawioextension - Verify 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)
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
E2B
Using MCP to run code via e2b.