Skip to main content
Glama

excalidraw-ai — MCP 服务器(AI 与 Excalidraw 的接口)

一个干净、不笨重的接口,供 AI 读取、观察和编辑实时的 Excalidraw 房间。无需浏览器自动化(光纤读取 + 拖放 + 远程浏览器丢弃),而是作为 socket 机器人 通过协作中继加入房间,直接使用 AES-GCM 加密的场景协议进行通信——确定性、无头、可扩展。

POC 状态: 核心桥接 + MCP stdio 表面已端到端工作,针对自托管的 excalidraw-room 中继(自测 + MCP 冒烟测试通过)。

为什么使用我们控制的中继

机器人与 中继 通信。Excalidraw 的托管中继(oss-collab.excalidraw.com)会阻止非浏览器机器人(403/400),因此对于我们自己的房间,我们运行 excalidraw/excalidraw-room(MIT 许可,与生产环境相同的代码),并通过 VITE_APP_WS_SERVER_URL 将 Excalidraw UI 指向它。

Related MCP server: Excalidraw MCP Server

架构

Excalidraw UI (fork) ──socket.io──▶ relay (excalidraw-room) ◀──socket-bot── excalidraw-ai (MCP)
   (humans)                           self-hosted                 (the AI's interface)

工具

工具

功能描述

create_room

为我们的中继创建新的房间 ID/密钥

join_room

加入房间,读取场景,开始监听

leave_room

断开连接

get_scene

获取画板元素 + 文本

get_changes

自上次调用以来的添加/更新/删除增量(“监听房间”)

add_elements

追加元素(实时广播)

update_elements

移动/重命名/重新着色现有元素(版本号增加)

delete_elements

标记为已删除

运行

npm install
# relay (one terminal):
cd /tmp/excalidraw-room && PORT=3002 node dist/index.js
# self-test the bridge core:
npm run selftest
# MCP smoke (stdio handshake + join + get_scene):
npm run mcp-smoke
# start the MCP server (stdio) — wire into Hermes/Copilot/Claude:
node src/server.js

接入 Hermes(~/.hermes/config.yaml)

mcp_servers:
  excalidraw_ai:
    command: "node"
    args: ["/root/workspace/mcclawd-org/excalidraw-ai/src/server.js"]

重启 Hermes → 工具将显示为 mcp_excalidraw_ai_*。

布局

  • src/crypto.js — AES-GCM 端到端辅助函数(Node Web Crypto)

  • src/elements.js — 元素构建器 + 场景合并/差异(id+版本语义)

  • src/room.js — RoomClient:socket 加入、读取、写入、变更流

  • src/server.js — MCP 服务器(stdio),工具注册

  • scripts/selftest.mjs、scripts/mcp-smoke.mjs — 验证

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to programmatically control a live Excalidraw canvas through element-level CRUD operations and real-time synchronization. It allows agents to iteratively build, inspect, and refine diagrams while providing visual feedback via screenshots and scene descriptions.
    3,166 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to programmatically control a live Excalidraw canvas with element-level CRUD operations and real-time synchronization. It supports iterative diagramming through scene descriptions, screenshots, and advanced layout tools for collaborative AI-human workflows.
    3,166 npm
    2
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Standalone backend for a self-hosted Excalidraw fork with per-board access control, providing an MCP remote endpoint that lets AI agents draw on real collaboration boards as specific users.
    -