AI-Canvas MCP Server
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 typecheckDocumentation
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 VSCodeCore Concepts
Document Model
Document > Pages > NodesDocument: 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 |
| Container with layout capabilities |
| Basic rectangular shape |
| Circle or ellipse shape |
| Straight line segment |
| Regular polygon shape |
| Arbitrary vector path |
| Text content |
| Bitmap or image asset |
| Star shape |
| Arrow shape with direction |
| Connection line between nodes |
| Video or media element |
| 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
GridLayoutRendering and interaction support for screenshots, hit testing, snapping, transforms, and viewport control
Presentation export via
PPTXExporterMotion primitives through
AnimationEngineandTransitionManagerBrand and design-system generation including
DesignPipelineandBrandCollateralGenerator
Development
Prerequisites
Node.js >= 20.0.0
pnpm >= 9.15.0 via Corepack
Scripts
Command | Description |
| Start all packages in dev mode |
| Build all packages |
| Run workspace tests |
| Run workspace TypeScript checks |
| Run workspace ESLint checks |
| 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:coverageVSCode 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 testMCP 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 startTool Coverage
The current server ships 47 MCP tools grouped by workflow:
Group | Count | Examples |
Document | 2 |
|
Query and rendering | 5 |
|
Mutation | 1 |
|
History | 6 |
|
Tokens and codegen | 4 |
|
Brand | 7 |
|
Design system | 10 |
|
Print and mockups | 6 |
|
Pipeline and collateral | 5 |
|
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:latestRun
# 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:latestBuild locally
docker build -t ai-canvas-mcp -f Dockerfile.mcp .
docker run -i --rm -v $(pwd)/documents:/data ai-canvas-mcpMCP 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 startConnect 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 previewVercel
# Install Vercel CLI
npm i -g vercel
# Deploy from packages/web-app
cd packages/web-app && vercel --prodOr 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-webVSCode 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-*.vsixDevelopment / 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 |
| Push / PR to | Install -> typecheck -> test -> build |
| GitHub Release published | Build multi-arch image -> push to GHCR + Docker Hub |
Required repository secrets
Secret | Purpose |
| Docker Hub login (optional, GHCR works without it) |
| 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-notesTroubleshooting
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-lockfileClean rebuild
corepack pnpm clean
corepack pnpm install
corepack pnpm buildLicense
Released under the MIT License. See LICENSE.