Skip to main content
Glama
excalidraw-architect-mcp

excalidraw-architect-mcp

by BV-Venky

Excalidraw Architect MCP

PyPI Cursor Directory License: MIT

在理解陌生且复杂的代码库时,我们常常面临持续的挑战——既要管理认知负荷,又要试图想象各部分是如何组合在一起的。

问题所在

当你入职新项目、设计新系统或记录现有架构时,一张可视化图表能在几秒钟内传达出大段文字无法表达的信息。但目前的方案并不理想。Mermaid 图表生成很快,但功能有限——你无法拖动节点来重新定位,也无法在视觉上对组件进行分组。Excalidraw 解决了这些问题,但当 LLM 尝试直接生成 Excalidraw 时,它们会产生坐标幻觉——方框重叠、箭头缠绕,最终你不得不手动修复图表。

Related MCP server: mermaid-to-excalidraw-mcp

解决方案

excalidraw-architect-mcp 将“内容”与“位置”分离开来——AI 专注于结构,而引擎负责处理像素计算。

你的 LLM 负责描述组件和连接,而 MCP 使用专业的图布局算法来处理布局、样式和渲染。50 多种技术(Kafka、PostgreSQL、Redis 等)可自动应用样式,你可以使用自然语言迭代编辑图表(例如“在数据库前添加一个缓存”),并且它可以在 Cursor/Windsurf 中完全离线运行——无需 API 密钥。

  • 每次都能获得完美的布局 - 采用 Sugiyama 算法及自适应间距;无重叠方框

  • 架构感知样式 - 说出“Kafka”即可获得流式样式的节点,而不是通用的矩形

  • 与你的图表对话 - 使用自然语言在现有图表上添加、删除或重新连接组件

  • 中心节点可视化 - 网关和负载均衡器会自动拉伸以跨越其连接的服务

  • 导出为 SVG 和 PNG - 将任何 .excalidraw 文件转换为便携式图像,无需浏览器

查看实际效果

下面的每一帧完全由 AI 使用此 MCP 生成——无需任何手动定位。

电子商务平台架构

电子商务平台演示

支付处理流程

支付处理流程演示

使用场景

  • 入职新代码库 - 指向一个微服务,无需阅读一行代码即可获得高层架构图。当你需要细节时,将其指向一组类以获取低层流程图。

  • 头脑风暴和系统设计 - 当你在白板上设计新服务或讨论权衡时,要求它实时可视化架构。通过说“在这里加个缓存”或“把 Kafka 换成 SQS”来进行迭代,而不是从头开始重绘。

  • 保持活力的文档 - 将 .excalidraw 文件放入你的仓库中,并随着系统的演进用自然语言更新它。不再有六个迭代周期前过时的图表。

快速入门

安装

pip install excalidraw-architect-mcp

对于 PNG 导出支持(SVG 开箱即用):

pip install excalidraw-architect-mcp[png]

或者在不安装的情况下运行(需要 uv):

uvx excalidraw-architect-mcp

在你的 IDE 中配置 MCP

Cursor - 添加到 .cursor/mcp.json:

{
  "mcpServers": {
    "excalidraw-architect": {
      "command": "excalidraw-architect-mcp",
      "transport": "stdio"
    }
  }
}

Claude Code - 运行此单行命令:

claude mcp add-json excalidraw-architect '{"type":"stdio","command":"excalidraw-architect-mcp"}' --scope user

或者手动添加到项目根目录的 .mcp.json 中:

{
  "mcpServers": {
    "excalidraw-architect": {
      "type": "stdio",
      "command": "excalidraw-architect-mcp"
    }
  }
}

Windsurf / 其他 IDE - 相同的模式;指向 stdio 上的 excalidraw-architect-mcp 命令。

安装图表设计技能(推荐)

此仓库包含一个 Diagram Design Skill,它教导 AI 如何构建图表以获得最佳结果——节点数量限制、拓扑规则、边缘标签指南和常见模式。

对于 Cursor 用户:

mkdir -p ~/.cursor/skills/excalidraw-diagram-design && \
curl -o ~/.cursor/skills/excalidraw-diagram-design/SKILL.md \
  https://raw.githubusercontent.com/BV-Venky/excalidraw-architect-mcp/main/.skills/excalidraw-diagram-design/SKILL.md

对于其他 IDE: 下载 SKILL.md 文件并将其添加到你的 IDE 提示词上下文或系统指令中。

AI 会自动获取该技能并在生成图表时应用它。请随意修改规则以适应你的偏好——调整节点限制、添加你自己的模式或调整样式指南。

关于图表复杂性的说明: 随着组件和连接数量的增加,图表不可避免地变得难以阅读——这对于人类手绘图表也是如此,不仅仅是自动化布局。为了获得最佳效果,架构图的目标应为 6-15 个节点,详细流程图的目标应为 10-25 个节点。如果你的系统规模更大,请将其拆分为多个重点图表,而不是将所有内容挤在一起。

使用方法

只需自然地询问你的 AI IDE:

"Create a high-level architecture diagram of this codebase"

"Create an architecture diagram for a microservices system with an API Gateway, Auth Service, User Service, Order Service, PostgreSQL, Redis cache, and Kafka event bus"

"Convert this mermaid diagram to excalidraw diagram"

"Add a Caching layer to the Order Service in the High Level architecture diagram"

"Export the architecture diagram to SVG"

"Export the diagram as a PNG at 3x resolution"

AI 会使用关系映射调用 MCP 工具。MCP 处理布局、样式和输出。使用 Excalidraw VS Code 扩展 打开生成的 .excalidraw 文件,或将其拖入 excalidraw.com。

功能特性

自动布局引擎

使用 Sugiyama 分层布局算法,具有:

  • 自适应层间距 - 间距根据边缘标签长度进行调整

  • 中心节点拉伸 - 网关/负载均衡器拉伸以跨越连接的服务

  • 障碍感知边缘路由 - 箭头绕过中间节点,而不是穿过它们

  • 断开组件堆叠 - 独立的子图(例如监控堆栈)被放置在不重叠的位置

组件库

50 多种技术映射,具有自动视觉样式:

分类

技术

数据库

PostgreSQL, MySQL, MongoDB, DynamoDB, Cassandra, ClickHouse, SQLite, CockroachDB

消息队列

Kafka, RabbitMQ, SQS, Redis Streams, NATS

缓存

Redis, Memcached, Varnish

负载均衡器

Nginx, HAProxy, ALB/ELB, Traefik, Envoy

计算

Docker, Kubernetes, Lambda, ECS, Fargate

存储

S3, GCS, Azure Blob, MinIO

API

REST, GraphQL, gRPC, WebSocket

CDN

CloudFront, Cloudflare

监控

Prometheus, Grafana, Datadog, ELK

客户端

Browser, Mobile, Desktop, CLI

状态化编辑

图表元数据嵌入在 .excalidraw 文件中。询问 AI:

"Add a Redis cache in front of the database in the existing diagram"

MCP 读取当前状态,应用修改,并以正确的布局重新渲染。

Mermaid 转换

已经有了 Mermaid 流程图?转换它:

"Convert this Mermaid diagram to Excalidraw" (粘贴你的 Mermaid 语法)

图像导出

将任何 .excalidraw 图表导出为便携式图像——无需浏览器、Excalidraw 应用或 Node.js。

  • SVG - 零额外依赖;使用纯 Python 渲染器,处理矩形、椭圆、菱形、文本(包括多行)和带箭头的箭头

  • PNG - 需要可选的 cairosvg 包 (pip install excalidraw-architect-mcp[png]);支持可配置的分辨率乘数(默认为 2×)

"Export the architecture diagram as an SVG"

MCP 工具

工具

描述

create_diagram

从结构化的节点/连接数据创建新图表

mermaid_to_excalidraw

将 Mermaid 流程图语法转换为 .excalidraw

modify_diagram

在现有图表上添加/删除/更新节点和连接

get_diagram_info

读取当前图表状态(修改前调用)

export_diagram

将 .excalidraw 导出为 SVG 或 PNG 图像

贡献

详情请参阅 CONTRIBUTING.md。

许可证

MIT - 详见 LICENSE。

Available Tools

26 tools
create_diagramA

Create a new Excalidraw diagram of any supported type.

Two input modes:

  1. Graph types (architecture, flowchart) - pass nodes and connections. The tool handles layout, styling, and rendering; no coordinates needed.

  2. Typed diagrams (every other type) - pass diagram_type and a spec object shaped for that type. Call list_diagram_types to choose a type and get_diagram_schema to see its spec shape.

Inputs: output_path (required), spec, nodes, theme, +3 more. Returns: result

export_diagramA

Export an .excalidraw file to SVG or PNG image.

Converts an existing .excalidraw diagram into a portable image file without requiring a browser or the Excalidraw application.

Inputs: input_path (required), output_path (required), scale, format. Returns: result

get_diagram_infoA

Get a structured summary of an existing Excalidraw diagram.

Call this BEFORE modify_diagram to understand what nodes and connections currently exist. The summary includes node ids, labels, component types, and the full connection topology.

Inputs: file_path (required). Returns: result

get_diagram_schemaA

Get the JSON schema and selection guidance for one diagram type.

Call this before passing a spec to create_diagram for a type you have not used yet, so the payload matches on the first attempt.

Inputs: diagram_type (required). Returns: result

kg_add_serviceB

Add or update a service in the knowledge graph.

Inputs: id (required), tags, label, links, +6 more. Returns: result

kg_diffB

Show how the architecture changed since a git ref (default HEAD).

Compares the current knowledge file against its version at ref.

Inputs: ref, graph_path. Returns: result

kg_driftA

Detect drift between the declared architecture and Python imports under code_root.

Best-effort: treats each top-level package as a service and infers edges from imports. Reports undocumented and possibly-stale dependencies.

Inputs: code_root (required), graph_path. Returns: result

kg_exportC

Export the knowledge graph to another format.

Inputs: format, graph_path, output_path. Returns: result

kg_importB

Import an existing .excalidraw diagram's services into the knowledge graph.

Bootstraps the graph from diagrams you already created with this tool.

Inputs: excalidraw_path (required), graph_path. Returns: result

kg_infoA

Summarize the whole knowledge graph: services, domains, and topology.

Call this before mutating the graph to reason about current state.

Inputs: graph_path. Returns: result

kg_initB

Create a new architecture knowledge graph file (markdown).

The knowledge graph is the persistent source of truth for your system's services and dependencies. Diagrams are rendered from it.

Inputs: title, direction, overwrite, graph_path. Returns: result

kg_lintA

Architecture health check: cycles, single points of failure, orphans, dangling references, and (optionally) unowned services.

Inputs: graph_path, check_owners. Returns: result

kg_onboarding_docC

Generate a human onboarding guide (entry points, hubs, domains) from the graph.

Inputs: graph_path, output_path. Returns: result

kg_pathC

Trace the shortest dependency path between two services.

Inputs: to_id (required), from_id (required), graph_path. Returns: result

kg_remove_serviceC

Remove a service and all dependencies touching it.

Inputs: id (required), graph_path. Returns: result

kg_renderC

Render the entire architecture to an .excalidraw file.

Inputs: output_path (required), theme, graph_path. Returns: result

kg_render_aroundB

Render a service plus everything within depth hops of it.

direction: "downstream" (its dependencies), "upstream" (its dependents), or "both".

Inputs: depth (required), service_id (required), output_path (required), theme, +2 more. Returns: result

kg_render_domainC

Render only the services belonging to one domain.

Inputs: domain (required), output_path (required), theme, graph_path. Returns: result

kg_render_viewC

Render a focused diagram of just the given services (induced subgraph).

Inputs: node_ids (required), output_path (required), theme, graph_path. Returns: result

kg_set_domainC

Assign a service to a domain (optionally set the domain's display label).

Inputs: domain (required), service_id (required), label, graph_path. Returns: result

list_diagram_typesA

List every supported diagram type with guidance on when to use it.

Call this BEFORE create_diagram when the right diagram type isn't obvious. Picking the wrong type is the most common way a diagram fails - a swimlane drawn as a flowchart loses the handoffs that were the point.

Two rules worth applying whatever you pick:

  • Target density ~4/10. Above 9 nodes it is probably two diagrams.

  • Mark only 1-2 elements "focal": true. The accent color is a signal, and using it everywhere destroys it.

Returns: A table of type -> family, when to use it, and when not to.

Inputs: no named parameters. Returns: result

mermaid_to_excalidrawA

Convert Mermaid flowchart syntax into an Excalidraw diagram.

Supports the mermaid flowchart subset that AI agents commonly generate:

  • Directions: graph TD, LR, BT, RL

  • Node shapes: [text], {text}, ((text)), ([text])

  • Edge types: -->, ---, -.-> ==> with |label|

  • Subgraphs: subgraph Title ... end

Component types are auto-detected from node labels (e.g., a node labeled "PostgreSQL DB" automatically gets database styling).

Inputs: output_path (required), mermaid_syntax (required), theme. Returns: result

modify_diagramA

Modify an existing Excalidraw diagram created by this tool.

Supports iterative editing: add components, remove nodes, update labels, and rewire connections - without recreating the entire diagram.

IMPORTANT: Call get_diagram_info first to understand the current diagram state before making modifications.

For typed diagrams (sequence, pyramid, bar, swimlane, ...) there is a single operation:

{"op": "update_spec", "patch": {"tiers": [...], "title": "New title"}}

The patch is deep-merged into the stored spec and the diagram re-rendered. Lists are replaced wholesale, so send the complete list to change one entry. The node/connection operations below apply to architecture and flowchart diagrams only.

Inputs: file_path (required), operations (required), theme. Returns: result

whats_connected_toA

Impact analysis: what breaks if service_id fails?

Reports direct dependents, the full transitive upstream blast radius, and what the service itself depends on.

Inputs: service_id (required), graph_path. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 26 tools

    Disambiguation4/5

    Most tools target clearly distinct operations, and descriptions separate KG management, diagram creation, and analysis queries well. The four kg_render* variants (full, domain, view, around) are close enough to cause some misselection risk, though each has a well-defined scope.

    Naming Consistency4/5

    The kg_ prefix provides a strong, predictable pattern for graph operations, and most diagram tools use clear verb_noun names. Minor exceptions like whats_connected_to and mermaid_to_excalidraw break the pattern, but overall the naming is disciplined and readable.

    Tool Count3/5

    At 26 tools, the server sits just above the heavy band, and the kg_render_domain/view/around trio could plausibly be consolidated into one parameterized render operation. The breadth is partly justified by spanning diagram authoring and knowledge-graph management, but the surface is still large.

    Completeness5/5

    The toolset covers the full lifecycle for both the knowledge graph and diagrams: init, add/update/remove, link/unlink, query, render, export, plus analysis features like lint, drift, diff, impact, and path tracing. The only missing operations are non-essential file-management tasks like deleting a rendered diagram.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      MCP server that converts Mermaid diagrams to styled Excalidraw files, saving them directly to disk without token overhead.
      2
      MIT
    • F
      license
      A
      quality
      B
      maintenance
      An MCP server that generates standalone SVG architecture diagrams from text descriptions, running entirely on your machine with no dependencies or network access.
      8
      -
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for generating and editing architecture diagrams from natural language or code, supporting formats like Terraform, docker-compose, Kubernetes, SQL, Mermaid, and PlantUML.
      2
      MIT