AI-Canvas MCP Server
Enables AI assistants to inspect, modify, export, and validate design documents with 47 tools covering design, code generation, branding, and print/mockup workflows.
README
AI-Canvas
AI-native design system and UI tooling for semantic, type-safe, reversible design documents.
AI-Canvas combines a document model, renderer, code generators, and an MCP server so AI assistants can inspect, modify, export, and validate design work inside one TypeScript monorepo.
Quick Start
# Enable pnpm from Corepack if pnpm is not already on your PATH
corepack enable
# Install dependencies
corepack pnpm install
# Start development
corepack pnpm dev
# Run tests
corepack pnpm test
# Build all packages
corepack pnpm build
# Type check
corepack pnpm typecheck
Documentation
- CONTRIBUTING.md - contribution workflow and PR expectations
- CHANGELOG.md - notable unreleased and released changes
- CLAUDE.md - detailed development workflow and architecture notes
- Gemini.md - Gemini-oriented development guide aligned with CLAUDE.md
- TASKS.md - roadmap, milestones, and status tracking
- docs/product-design-strategy.md - product strategy and expansion plan
- packages/core/README.md - core engine package guide
- packages/renderer/README.md - renderer package guide
- packages/mcp-server/README.md - MCP server package guide
- packages/codegen/README.md - code generation package guide
- packages/vscode-extension/README.md - VSCode editor package guide
Architecture
packages/
├── core/ # @ai-canvas/core - Document model, operations, history, tokens (PenDocument dual mode)
├── mcp-server/ # @ai-canvas/mcp-server - 47 MCP tools (stdio + SSE transport)
├── renderer/ # @ai-canvas/renderer - IRenderBackend abstraction (Canvas2D + CanvasKit)
├── codegen/ # @ai-canvas/codegen - React/Vue/HTML/Tailwind generation
├── web-app/ # @ai-canvas/web-app - Standalone web app (React + multi-AI proxy)
└── vscode-extension/ # @ai-canvas/vscode-extension - Visual editor in VSCode
Core Concepts
Document Model
Document > Pages > Nodes
- Document: Metadata, design tokens, reusable components, pages, history
- Page: Root canvas surface containing the node tree
- Node: A typed design element categorized by
primitiveand optionallysemantic
Node Primitives
AI-Canvas currently supports 13 primitive node types:
| Primitive | Description |
|---|---|
frame |
Container with layout capabilities |
rectangle |
Basic rectangular shape |
ellipse |
Circle or ellipse shape |
line |
Straight line segment |
polygon |
Regular polygon shape |
path |
Arbitrary vector path |
text |
Text content |
image |
Bitmap or image asset |
star |
Star shape |
arrow |
Arrow shape with direction |
connector |
Connection line between nodes |
video |
Video or media element |
group |
Grouping container without layout |
Operations
Atomic, reversible operations for document modification:
insert- add a nodeupdate- modify node propertiesdelete- remove a nodemove- change parent or indexreplace- replace a node entirelyduplicate- copy an existing nodeset- smart insert or update based on target existence
Feature Highlights
- Immutable document updates with rollback, inverse operations, undo/redo, and checkpoints
- Semantic node search plus component discovery for AI-driven editing workflows
- Layout engines for auto-layout and CSS grid-style composition via
GridLayout - Rendering and interaction support for screenshots, hit testing, snapping, transforms, and viewport control
- Presentation export via
PPTXExporter - Motion primitives through
AnimationEngineandTransitionManager - Brand and design-system generation including
DesignPipelineandBrandCollateralGenerator
Development
Prerequisites
- Node.js >= 20.0.0
- pnpm >= 9.15.0 via Corepack
Scripts
| Command | Description |
|---|---|
corepack pnpm dev |
Start all packages in dev mode |
corepack pnpm build |
Build all packages |
corepack pnpm test |
Run workspace tests |
corepack pnpm typecheck |
Run workspace TypeScript checks |
corepack pnpm lint |
Run workspace ESLint checks |
corepack pnpm clean |
Clean build artifacts and workspace dependencies |
Testing
Tests use Vitest. Current test suites live under package-local src/__tests__ directories.
# Run all tests
corepack pnpm test
# Run a specific package
corepack pnpm --filter @ai-canvas/core test
# Watch mode
corepack pnpm --filter @ai-canvas/core test:watch
# Coverage
corepack pnpm --filter @ai-canvas/core test:coverage
VSCode Extension Development
# Build the extension
corepack pnpm --filter @ai-canvas/vscode-extension build
# Debug from VSCode
# Open the repository in VSCode and press F5
开发经验
以下经验已同步到 README.md、CLAUDE.md、Gemini.md,后续调整时应同时更新这三份文档。
- 命令写法统一使用
corepack pnpm ...;包级验证统一使用corepack pnpm --filter <package> ... - 包级
typecheck/test如果依赖其他包生成的dist/*.d.ts,先构建依赖包,再验证目标包 - 文档中的数量、能力清单和工具列表必须以代码为准,避免手填数字长期漂移
- 调整 CI 质量门禁前,先本地跑受影响包的
lint、typecheck、test,确认当前基线 - 多 Registry 发布流程必须显式覆盖所有目标仓库,且登录失败不能静默跳过
- 测试修复优先通过类型收窄和真实接口对齐解决,避免扩散
as any - 功能、命令、流程、工具数量有变化时,同时同步
README.md、CLAUDE.md、Gemini.md - 每次问题修复成功后,都要把可复用的经验补充到开发文档,至少同步
CLAUDE.md和Gemini.md
推荐验证顺序
# 1. 安装依赖
corepack pnpm install --frozen-lockfile
# 2. 如目标包依赖其他包的声明产物,先构建依赖包
corepack pnpm --filter @ai-canvas/renderer build
# 3. 再验证目标包
corepack pnpm --filter @ai-canvas/mcp-server typecheck
corepack pnpm --filter @ai-canvas/mcp-server test
# 4. 最后执行仓库级验证
corepack pnpm build
corepack pnpm test
MCP Server
The MCP server exposes the design document, rendering, codegen, brand, print, mockup, collateral, and export workflows to AI assistants.
open_document and save_document support both native .canvas documents and Pencil-compatible .pen files.
# Build and start the server
corepack pnpm --filter @ai-canvas/mcp-server build
corepack pnpm --filter @ai-canvas/mcp-server start
Tool Coverage
The current server ships 47 MCP tools grouped by workflow:
| Group | Count | Examples |
|---|---|---|
| Document | 2 | open_document, save_document |
| Query and rendering | 5 | get_document, query_nodes, get_layout, get_screenshot |
| Mutation | 1 | apply_operations |
| History | 6 | undo, redo, create_checkpoint |
| Tokens and codegen | 4 | get_tokens, set_tokens, generate_react, generate_tailwind_config |
| Brand | 7 | get_brand, generate_brand_tokens, generate_brand_book |
| Design system | 10 | get_design_patterns, create_seed_component, generate_style_guide |
| Print and mockups | 6 | get_print_presets, create_mockup, create_poster_template |
| Pipeline and collateral | 5 | run_design_pipeline, generate_collateral_kit, export_pptx |
See packages/mcp-server/README.md for the package-level workflow overview.
Deployment
MCP Server — Docker (Recommended)
The MCP server ships as a multi-stage Docker image targeting linux/amd64 and linux/arm64.
Pull from GitHub Container Registry
docker pull ghcr.io/laoluojuhai/ai-canvas-mcp:latest
Run
# stdio mode (used by Claude Desktop / Cursor)
docker run -i --rm \
-v $(pwd)/documents:/data \
ghcr.io/laoluojuhai/ai-canvas-mcp:latest
# Pass a specific document directory
docker run -i --rm \
-v /absolute/path/to/designs:/data \
ghcr.io/laoluojuhai/ai-canvas-mcp:latest
Build locally
docker build -t ai-canvas-mcp -f Dockerfile.mcp .
docker run -i --rm -v $(pwd)/documents:/data ai-canvas-mcp
MCP Server — Connect to Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"ai-canvas": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-v", "/absolute/path/to/designs:/data",
"ghcr.io/laoluojuhai/ai-canvas-mcp:latest"
]
}
}
}
Or run from source (requires the repo cloned and built):
{
"mcpServers": {
"ai-canvas": {
"command": "node",
"args": ["/absolute/path/to/ai-canvas/packages/mcp-server/dist/cli.js"]
}
}
}
After saving, restart Claude Desktop. The 47 design tools will appear in the tool panel.
MCP Server — Connect to Cursor
Open Cursor Settings → MCP → Add Server:
{
"name": "ai-canvas",
"command": "docker run -i --rm -v /absolute/path/to/designs:/data ghcr.io/laoluojuhai/ai-canvas-mcp:latest"
}
MCP Server — SSE Transport (HTTP)
The server also supports HTTP + Server-Sent Events for web-based clients:
# Build and start with SSE enabled
corepack pnpm --filter @ai-canvas/mcp-server build
MCP_TRANSPORT=sse MCP_PORT=3001 corepack pnpm --filter @ai-canvas/mcp-server start
Connect from any MCP-compatible client at http://localhost:3001/sse.
Web App — Static Hosting
The web app builds to a static bundle and can be deployed to any CDN.
# Build
corepack pnpm --filter @ai-canvas/web-app build
# Output: packages/web-app/dist/
# Preview locally
corepack pnpm --filter @ai-canvas/web-app preview
Vercel
# Install Vercel CLI
npm i -g vercel
# Deploy from packages/web-app
cd packages/web-app && vercel --prod
Or add a vercel.json at the repo root:
{
"buildCommand": "corepack pnpm --filter @ai-canvas/web-app build",
"outputDirectory": "packages/web-app/dist",
"installCommand": "corepack pnpm install --frozen-lockfile"
}
Docker (web app)
docker build -t ai-canvas-web -f packages/web-app/Dockerfile .
docker run -p 3000:3000 ai-canvas-web
VSCode Extension
Install from VSIX (manual)
# Build the extension package
corepack pnpm --filter @ai-canvas/vscode-extension build
cd packages/vscode-extension
npx vsce package # produces ai-canvas-*.vsix
# Install into VSCode
code --install-extension ai-canvas-*.vsix
Development / Debug
- Open the repo root in VSCode
- Press F5 — launches an Extension Development Host with the extension loaded
- Open any
.canvasor.penfile to activate the visual editor
CI / CD
| Workflow | Trigger | What it does |
|---|---|---|
ci.yml |
Push / PR to main |
Install -> typecheck -> test -> build |
docker-publish.yml |
GitHub Release published | Build multi-arch image -> push to GHCR + Docker Hub |
Required repository secrets
| Secret | Purpose |
|---|---|
DOCKER_USERNAME |
Docker Hub login (optional, GHCR works without it) |
DOCKER_PASSWORD |
Docker Hub token |
Create a release
# Tag a version and push — GitHub Actions handles the rest
git tag v1.0.0
git push origin v1.0.0
# Then create a GitHub Release from the tag to trigger docker-publish.yml
gh release create v1.0.0 --generate-notes
Troubleshooting
pnpm: command not found
Run corepack enable and retry with corepack pnpm ....
Workspace commands fail after pulling changes
Reinstall dependencies from the repository root:
rm -rf node_modules
corepack pnpm install --frozen-lockfile
Clean rebuild
corepack pnpm clean
corepack pnpm install
corepack pnpm build
License
Released under the MIT License. See LICENSE.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。