loading…
Search for a command to run...
loading…
Enables AI assistants to inspect, modify, export, and validate design documents with 47 tools covering design, code generation, branding, and print/mockup workf
Enables AI assistants to inspect, modify, export, and validate design documents with 47 tools covering design, code generation, branding, and print/mockup workflows.
CI Docker Publish License: MIT
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.
# 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
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
Document > Pages > Nodes
primitive and optionally semanticAI-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 |
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 existenceGridLayoutPPTXExporterAnimationEngine and TransitionManagerDesignPipeline and BrandCollateralGenerator| 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 |
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
# 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,先构建依赖包,再验证目标包lint、typecheck、test,确认当前基线as anyREADME.md、CLAUDE.md、Gemini.mdCLAUDE.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
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
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.
The MCP server ships as a multi-stage Docker image targeting linux/amd64 and linux/arm64.
docker pull ghcr.io/laoluojuhai/ai-canvas-mcp:latest
# 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
docker build -t ai-canvas-mcp -f Dockerfile.mcp .
docker run -i --rm -v $(pwd)/documents:/data ai-canvas-mcp
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.
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"
}
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.
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
# 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 build -t ai-canvas-web -f packages/web-app/Dockerfile .
docker run -p 3000:3000 ai-canvas-web
# 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
.canvas or .pen file to activate the visual editor| 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 |
| Secret | Purpose |
|---|---|
DOCKER_USERNAME |
Docker Hub login (optional, GHCR works without it) |
DOCKER_PASSWORD |
Docker Hub token |
# 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
pnpm: command not foundRun corepack enable and retry with corepack pnpm ....
Reinstall dependencies from the repository root:
rm -rf node_modules
corepack pnpm install --frozen-lockfile
corepack pnpm clean
corepack pnpm install
corepack pnpm build
Released under the MIT License. See LICENSE.
Выполни в терминале:
claude mcp add ai-canvas-mcp-server -- npx Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории development