canvas-relay
MCP server for a persistent local whiteboard that lets AI assistants read, add, update, and delete canvas elements, with undo/redo and provenance tracking.
README
Canvas Relay
Canvas Relay is a persistent local whiteboard shared by people and MCP-capable AI assistants. A person can draw in the browser while an agent reads the same scene, adds structured elements, records authorship, and continues the work in a later conversation.
The project is intentionally small: it uses Node.js built-ins, plain HTML, CSS, and JavaScript, with no runtime dependencies.
Features
- Browser-based infinite-style canvas with pan, zoom, selection, drawing, text, notes, frames, and erasing.
- MCP server over standard input/output for AI clients.
- Persistent JSON scene and history storage.
- Human and AI provenance on every element and edit.
- Non-destructive update and erase effects with undo and redo.
- Independent visibility filters for human-created and AI-created elements.
- SVG and JSON export.
- Traditional Chinese, English, and Japanese interface translations.
- Local-only HTTP server with same-origin checks and a restrictive content security policy.
Install
Canvas Relay requires Node.js 20 or newer and a desktop browser.
node --version
git clone https://github.com/rncchen/canvas-relay.git
Set-Location canvas-relay
The project has no external runtime packages, so npm install is not required. Once configured, the MCP client starts mcp.mjs, which automatically starts the browser server at http://127.0.0.1:4173.
You do not normally need to run npm start. Use it only to run the browser canvas without an MCP client or to troubleshoot automatic startup. A second MCP process reuses an existing healthy Canvas Relay server on the same port.
Add the MCP server to Codex
Run these commands from the repository root, replacing the example with the absolute path on your computer:
codex mcp add canvas-relay -- node "C:\absolute\path\to\canvas-relay\mcp.mjs"
codex mcp list
Restart Codex or open a new session after adding the server. In the Codex IDE extension, add an STDIO server from MCP servers, use node as the command and the absolute mcp.mjs path as its argument, then restart the extension.
Project-scoped .codex/config.toml configuration is also supported:
[mcp_servers.canvas-relay]
command = "node"
args = ["C:\\absolute\\path\\to\\canvas-relay\\mcp.mjs"]
cwd = "C:\\absolute\\path\\to\\canvas-relay"
Add the MCP server to Claude Code
Use --scope user to make Canvas Relay available across projects, or replace it with local for the current project only:
claude mcp add --transport stdio --scope user canvas-relay -- node 'C:\absolute\path\to\canvas-relay\mcp.mjs'
claude mcp list
Open a new Claude Code session and run /mcp to verify the connection. See the official Claude Code MCP documentation for scope and STDIO details.
Claude Code discovers the bundled skill at .claude/skills/use-canvas-relay/SKILL.md. It opens the session-specific canvas URL after editing. See the official Claude Code Skills documentation for discovery rules.
Add the MCP server to Claude Desktop
Open Settings → Developer → Edit Config. On Windows, edit %APPDATA%\Claude\claude_desktop_config.json and replace the example path below:
{
"mcpServers": {
"canvas-relay": {
"type": "stdio",
"command": "node",
"args": [
"C:\\absolute\\path\\to\\canvas-relay\\mcp.mjs"
]
}
}
}
Save the file, fully quit Claude Desktop, and launch it again. Claude Desktop does not load project-scoped Claude Code skills, but the MCP process still starts the browser server automatically.
See the official MCP Claude Desktop tutorial for the settings screen and platform-specific configuration paths.
The repository-local .mcp.json is ignored because it contains a machine-specific absolute path.
Use the bundled skill and browser verification
The repository includes .agents/skills/use-canvas-relay/SKILL.md for Codex and .claude/skills/use-canvas-relay/SKILL.md for Claude Code. Restart the client if its skill does not appear.
Use $use-canvas-relay to draw a three-bedroom floor plan.
The skill assigns a unique canvasId to the current conversation, edits that canvas, then uses browser control to open http://127.0.0.1:4173/?canvas=<canvasId> for visual verification. Install or enable the bundled Browser plugin in the ChatGPT / Codex Browser settings to allow local browser inspection.
Sessions and author labels
Use a different canvasId for each conversation and keep that value unchanged across all tool calls in the same conversation. The browser URL must use the same value in its canvas query parameter.
Author labels are hidden by default without removing author metadata. Enable Author labels in the top-left display controls when provenance is needed. For a clean MCP preview, call canvas_get_view with includeAuthors: false.
Recommended agent workflow
- Choose a unique
canvasIdfor the conversation and reuse it for every tool call. - Call
canvas_get_scenebefore changing the canvas. - Call
canvas_get_viewwhen layout, overlap, density, or freehand content must be understood visually. - Add or update elements in batches.
- Preserve existing content unless the user explicitly asks to erase or clear it.
- Use
canvas_undowhen a canvas operation needs to be reverted. - Open the matching browser URL, hide author labels, and inspect the actual layout before delivery.
MCP tools
| Tool | Purpose |
|---|---|
canvas_get_scene |
Read source elements, effects, provenance, layers, activity, and the current composite scene. |
canvas_get_view |
Render the current composite scene as SVG. |
canvas_add_elements |
Add text, notes, rectangles, ellipses, lines, arrows, freehand strokes, or frames. |
canvas_update_elements |
Add non-destructive move, resize, text, and style changes. |
canvas_delete_elements |
Add reversible erase effects for selected elements. |
canvas_undo |
Restore the scene before the latest human or AI operation. |
canvas_redo |
Reapply the latest undone operation. |
canvas_clear |
Reversibly erase all currently visible elements. Use only after explicit user confirmation. |
The MCP server also exposes these resources:
canvas://scene/currentcanvas://view/current.svg
Data and configuration
The unnamed default canvas is stored in data/scene.json and data/history.json. Named sessions are stored under data/canvases/<canvasId>/scene.json and history.json. All runtime data is ignored by Git.
| Variable | Default | Purpose |
|---|---|---|
PORT |
4173 |
HTTP port for the browser application. |
CANVAS_RELAY_DATA_DIR |
<repository>/data |
Alternate directory for scene, history, and lock files. |
The HTTP server binds to 127.0.0.1. It is designed for local use and has no authentication layer. Do not expose it directly to a network.
Tests
npm test
The test suite covers MCP negotiation, persistent scene changes, authorship, non-destructive effects, layer composition, undo, and redo.
Documentation
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。