MCP ConfigsMay 7, 2026·4 min read

Excalidraw MCP — Generate Diagrams from Claude Code

Excalidraw MCP exposes the Excalidraw scene API as MCP server. Claude Code / Cursor draw architecture diagrams, ERDs, flowcharts to a .excalidraw file.

Agent ready

Safe staging for this asset

This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.

Stage only · 17/100Policy: stage
Agent surface
Any MCP/CLI agent
Kind
Mcp Config
Install
Stage only
Trust
Trust: Community
Entrypoint
Asset
Safe staging command
npx -y tokrepo@latest install fb4ffcf1-7fb2-40fb-9a7e-4b55dc3f694f --target codex

Stages files first; activation requires review of the staged README and plan.

Intro

Excalidraw MCP wraps the Excalidraw scene API as a Model Context Protocol server. Claude Code / Cursor / Codex CLI can call excalidraw_create_scene, excalidraw_add_shape, excalidraw_add_arrow to generate architecture diagrams, ERDs, and flowcharts directly into a .excalidraw file. Best for: agents documenting code with diagrams without copy-paste from a separate diagram tool. Works with: Excalidraw 0.17+, any MCP host. Setup time: 3 minutes.


MCP config

{
  "mcpServers": {
    "excalidraw": {
      "command": "npx",
      "args": ["-y", "excalidraw-mcp"],
      "env": {
        "EXCALIDRAW_OUTPUT_DIR": "./diagrams"
      }
    }
  }
}

Tools exposed

Tool Behavior
excalidraw_create_scene Start a new .excalidraw file
excalidraw_add_rectangle Box (x, y, w, h, text, color)
excalidraw_add_ellipse Circle/ellipse
excalidraw_add_arrow Arrow connecting two shape IDs
excalidraw_add_text Free text label
excalidraw_export_png Render to PNG (with custom theme)

Example prompt to Claude Code

> Read the architecture from src/. Generate an Excalidraw diagram showing:
  - Frontend (Nuxt) at top
  - API gateway
  - 3 microservices (auth, payments, notifications)
  - Postgres + Redis at bottom
  - Arrows showing typical request flow
  Save to docs/architecture.excalidraw and export PNG.

Claude Code calls the MCP tools step by step, lays out shapes with sensible spacing, and saves both the editable .excalidraw and a .png preview.

Open in Excalidraw

open https://excalidraw.com  # then drag-and-drop the file
# or
excalidraw open ./docs/architecture.excalidraw  # if Excalidraw desktop installed

Use as a CI artifact

Diagrams generated by the MCP server in CI can be attached to PRs as architecture documentation that updates automatically with code changes.


FAQ

Q: Is Excalidraw MCP official? A: Excalidraw the editor is official (excalidraw/excalidraw on GitHub, ~95K stars). The MCP server wrappers are community-built — multiple implementations exist (excalidraw-mcp, excalidraw-mcp-server). They use the official Excalidraw scene format.

Q: Will the diagram be editable in Excalidraw afterwards? A: Yes — the output is a standard .excalidraw JSON file. Open it in Excalidraw web (excalidraw.com) or desktop, edit, save. The agent-generated layout is just a starting point.

Q: Can it draw on top of an existing diagram? A: Yes — pass the existing .excalidraw file and use excalidraw_load_scene first. The agent appends or modifies. Useful for incremental architecture docs.


Quick Use

  1. Add the JSON snippet below to your MCP config (Claude Code: ~/.claude/mcp.json)
  2. Restart your MCP host
  3. Ask the agent to draw a diagram — it calls the Excalidraw MCP tools

Intro

Excalidraw MCP wraps the Excalidraw scene API as a Model Context Protocol server. Claude Code / Cursor / Codex CLI can call excalidraw_create_scene, excalidraw_add_shape, excalidraw_add_arrow to generate architecture diagrams, ERDs, and flowcharts directly into a .excalidraw file. Best for: agents documenting code with diagrams without copy-paste from a separate diagram tool. Works with: Excalidraw 0.17+, any MCP host. Setup time: 3 minutes.


MCP config

{
  "mcpServers": {
    "excalidraw": {
      "command": "npx",
      "args": ["-y", "excalidraw-mcp"],
      "env": {
        "EXCALIDRAW_OUTPUT_DIR": "./diagrams"
      }
    }
  }
}

Tools exposed

Tool Behavior
excalidraw_create_scene Start a new .excalidraw file
excalidraw_add_rectangle Box (x, y, w, h, text, color)
excalidraw_add_ellipse Circle/ellipse
excalidraw_add_arrow Arrow connecting two shape IDs
excalidraw_add_text Free text label
excalidraw_export_png Render to PNG (with custom theme)

Example prompt to Claude Code

> Read the architecture from src/. Generate an Excalidraw diagram showing:
  - Frontend (Nuxt) at top
  - API gateway
  - 3 microservices (auth, payments, notifications)
  - Postgres + Redis at bottom
  - Arrows showing typical request flow
  Save to docs/architecture.excalidraw and export PNG.

Claude Code calls the MCP tools step by step, lays out shapes with sensible spacing, and saves both the editable .excalidraw and a .png preview.

Open in Excalidraw

open https://excalidraw.com  # then drag-and-drop the file
# or
excalidraw open ./docs/architecture.excalidraw  # if Excalidraw desktop installed

Use as a CI artifact

Diagrams generated by the MCP server in CI can be attached to PRs as architecture documentation that updates automatically with code changes.


FAQ

Q: Is Excalidraw MCP official? A: Excalidraw the editor is official (excalidraw/excalidraw on GitHub, ~95K stars). The MCP server wrappers are community-built — multiple implementations exist (excalidraw-mcp, excalidraw-mcp-server). They use the official Excalidraw scene format.

Q: Will the diagram be editable in Excalidraw afterwards? A: Yes — the output is a standard .excalidraw JSON file. Open it in Excalidraw web (excalidraw.com) or desktop, edit, save. The agent-generated layout is just a starting point.

Q: Can it draw on top of an existing diagram? A: Yes — pass the existing .excalidraw file and use excalidraw_load_scene first. The agent appends or modifies. Useful for incremental architecture docs.


Source & Thanks

Built by Excalidraw + community MCP servers. Licensed under MIT.

excalidraw/excalidraw — ⭐ 95,000+

🙏

Source & Thanks

Built by Excalidraw + community MCP servers. Licensed under MIT.

excalidraw/excalidraw — ⭐ 95,000+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets