Skip to main content
Glama
yannick-cw

mermaid-to-excalidraw-mcp

by yannick-cw
README.md
# mermaid-to-excalidraw-mcp

MCP server that converts Mermaid diagrams to styled Excalidraw files.

> Generated with [Claude Code](https://claude.ai/code). AI slop included, but it helps me every day :)

## The Problem

When asking Claude to create diagrams, you have two bad options:

1. **Generate Excalidraw JSON directly** - Works, but costs ~500 tokens per shape. A simple 5-node diagram = 2500+ tokens of JSON in Claude's response.

2. **Use existing mermaid-to-excalidraw** - Token-efficient input, but strips all colors and requires a browser.

## The Solution

This MCP server lets Claude write compact Mermaid (30 tokens) and outputs styled `.excalidraw.md` files directly to disk - no tokens wasted on JSON output.

```
You: "Create an architecture diagram: React -> API -> PostgreSQL + Redis"

Claude writes: ~50 tokens of Mermaid
Output: Styled diagram saved to file
```

![Example flowchart](examples/flowchart.png)

## Setup

```bash
git clone https://github.com/yannick-cw/mermaid-to-excalidraw-mcp
cd mermaid-to-excalidraw-mcp && npm install && npm run build
```

Add to `~/.claude.json`:

```json
{
  "mcpServers": {
    "mermaid-excali": {
      "command": "node",
      "args": ["/absolute/path/to/mermaid-to-excalidraw-mcp/dist/index.js"]
    }
  }
}
```

## Usage

Just ask Claude to create a diagram and specify where to save it:

> "Create an ER diagram for a blog system with users, posts, and comments. Save to ~/diagrams/blog.excalidraw.md"

The output file opens directly in **Obsidian** (with [Excalidraw plugin](https://github.com/zsviczian/obsidian-excalidraw-plugin)) or can be imported to **excalidraw.com**.

## Features

**Diagram types:** Flowcharts, sequence diagrams, ER diagrams

**Semantic colors** - Add a directive to color nodes by type:

```
%%{excali: styles: {FE: ui, API: api, DB: db, Cache: cache}}%%
flowchart TD
    FE[React App] --> API[Node Service]
    API --> DB[(PostgreSQL)]
    API --> Cache[Redis]
```

Available styles: `ui` `api` `db` `cache` `queue` `gateway` `external` `agent` `storage` `user` `orchestrator` `problem` `solution` `highlight`

**Connected arrows** - shapes stay linked when you move them

**Embedded source** - original Mermaid preserved in the file for portability

## More Examples

![Sequence diagram](examples/sequence.png)

![ER diagram](examples/er.png)

## Inspired by

- [mermaid-to-excalidraw](https://github.com/excalidraw/mermaid-to-excalidraw) - the original, browser-based
- [obsidian-excalidraw-plugin](https://github.com/zsviczian/obsidian-excalidraw-plugin) - what makes `.excalidraw.md` work

TDQS

A3.6/5.0

Scored across 2 tools

Disambiguation4/5

The two tools are clearly distinct: convert performs a transformation action, while list_styles retrieves metadata. There's no overlap in purpose. The only minor concern is that list_styles could arguably be a helper within convert, but as separate tools they're unambiguous.

Naming Consistency5/5

Both tools use a consistent verb-first snake_case pattern: convert and list_styles. The naming follows a predictable convention with concise, descriptive verbs that clearly indicate the action each tool performs.

Tool Count2/5

With only 2 tools for what appears to be a conversion-focused server, the surface feels quite thin. A tool like this would reasonably benefit from additional tools such as getting validation feedback, converting to different output formats, or inspecting diagrams before conversion. Two tools barely constitutes a functional server.

Completeness3/5

The core conversion workflow is covered (convert + style discovery), but there are notable gaps. There's no validate/preview tool to check a Mermaid diagram before converting, no way to batch convert multiple diagrams, and no handling for additional diagram types beyond the three mentioned. The surface works for basic usage but has dead ends.

Maintenance

ActivityInactive
ResponsivenessNo issues