Purpose
excalidraw-architect-mcp is an MCP (Model Context Protocol) server for automatically generating Excalidraw hand-drawn style diagrams in AI programming environments. It targets Cursor, Claude Code, and Windsurf, solving the pain points of traditional diagramming tools: Mermaid generates fast but cannot drag, group, or annotate; Figma requires about thirty minutes of manual work per diagram; and LLMs writing Excalidraw JSON directly hallucinate coordinates, causing overlapping boxes and tangled arrows. This tool separates "describing what" from "placing where"—the AI describes the structure, and the engine handles the pixel calculations.
Main Capabilities
- 25 diagram types: architecture diagrams, flowcharts, sequence diagrams, state machines, ER models, swimlane diagrams, timelines, Gantt charts, quadrant charts, funnel charts, as well as hand-drawn bar charts, line charts, and scatter plots. Internally divided into five families that determine the layout engine.
- Automatic layout: uses the Sugiyama layered layout algorithm, supporting adaptive layer spacing (adjusted based on edge label length), hub node stretching (gateways/load balancers spanning the services they connect), obstacle-aware edge routing (arrows avoid intermediate nodes), and disconnected component stacking (e.g., monitoring stacks placed independently without overlapping).
- Technology-aware styling: built-in mappings for over 50 technologies (Kafka, PostgreSQL, Redis, etc.), automatically applying the corresponding visual styles; for example, saying "Kafka" yields a streaming node rather than a generic rectangle.
- Stateful editing: diagram metadata is embedded in the .excalidraw file, supporting natural language additions, deletions, and modifications, such as "add a Redis cache in front of the database in the existing diagram"; the MCP reads the current state, applies the changes, and re-renders.
- Mermaid conversion: can convert existing Mermaid flowcharts into Excalidraw.
- SVG/PNG export: a pure Python port of the roughjs stroke generator, with export results consistent with the Excalidraw canvas (double pencil strokes, superellipses, V-shaped arrowheads, slightly inset fills). SVG requires no additional dependencies; PNG requires the optional package cairosvg, and supports configurable resolution multipliers (default 2×).
- Knowledge graph (optional): persists the architecture as a version-controlled model (default .claude/architecture.md), supports querying dependencies, rendering subgraphs, and linting for circular dependencies and single points of failure.
How to Use
Configure the MCP server in your IDE. For Cursor, add it to .cursor/mcp.json; for Claude Code, run a one-line command or manually add it to .mcp.json; for other IDEs such as Windsurf, point to the excalidraw-architect-mcp command to communicate via stdio. You can also run it directly without installing (requires uv).
After installation, simply ask the AI in natural language, for example:
- "Create a high-level architecture diagram for this codebase"
- "Create an architecture diagram for a microservices system including an API gateway, authentication service, user service, order service, PostgreSQL, Redis cache, and Kafka event bus"
- "Convert this Mermaid diagram into an Excalidraw diagram"
- "Add a caching layer for the order service in the high-level architecture diagram"
- "Export the architecture diagram as SVG"
- "Export PNG at 3x resolution"
The AI calls the MCP tools and passes in the relationship mapping, and MCP handles layout, styling, and output. The generated .excalidraw files can be opened with the Excalidraw VS Code extension or dragged into excalidraw.com.
Call list_diagram_types() to get usage guidance for each type, and get_diagram_schema("<type>") to get the exact specification shapes.
Applicable Scenarios
- Getting up to speed on a new codebase: point it at a service to get a high-level architecture diagram without reading code, then generate sequence diagrams for key flows.
- Design documents and RFCs: architecture sketches, state machines for new lifecycles, quadrant charts for rejected options, Gantt charts for release plans, one visual language per tool.
- Runbooks and incident reports: sequence diagrams show what happened, timelines show when, and swimlane diagrams show who did what.
- Data platform documentation: medal tiers, role-scoped pipelines, integration topologies.
- Reports without BI tools: hand-drawn bar/line/scatter charts that match the style of architecture diagrams.
- Keeping documentation fresh: commit .excalidraw files and revise them in natural language as the system changes.
Limitations
- Diagram complexity: readability decreases as components and connections increase. It is recommended to have 6-15 nodes for architecture diagrams and 10-25 nodes for detailed flowcharts.Larger systems should be split into multiple focused diagrams.
- PNG export requires installing the additional cairosvg package.
- The knowledge graph feature is optional and applies only to architecture documentation workflows.
- Fonts: Excalidraw's Excalifont is a bundled web font that standalone SVG cannot resolve; exports use a real handwriting font stack (Excalifont → Virgil → Segoe Print → Bradley Hand → Chalkboard). For cross-platform consistency, you can pass in a font file for embedding.
- License: MIT.