AI-Canvas MCP Server

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.

Category
Visit Server

README

AI-Canvas

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.

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

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 primitive and optionally semantic

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 node
  • update - modify node properties
  • delete - remove a node
  • move - change parent or index
  • replace - replace a node entirely
  • duplicate - copy an existing node
  • set - 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 AnimationEngine and TransitionManager
  • Brand and design-system generation including DesignPipeline and BrandCollateralGenerator

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.mdCLAUDE.mdGemini.md,后续调整时应同时更新这三份文档。

  • 命令写法统一使用 corepack pnpm ...;包级验证统一使用 corepack pnpm --filter <package> ...
  • 包级 typecheck / test 如果依赖其他包生成的 dist/*.d.ts,先构建依赖包,再验证目标包
  • 文档中的数量、能力清单和工具列表必须以代码为准,避免手填数字长期漂移
  • 调整 CI 质量门禁前,先本地跑受影响包的 linttypechecktest,确认当前基线
  • 多 Registry 发布流程必须显式覆盖所有目标仓库,且登录失败不能静默跳过
  • 测试修复优先通过类型收窄和真实接口对齐解决,避免扩散 as any
  • 功能、命令、流程、工具数量有变化时,同时同步 README.mdCLAUDE.mdGemini.md
  • 每次问题修复成功后,都要把可复用的经验补充到开发文档,至少同步 CLAUDE.mdGemini.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

  1. Open the repo root in VSCode
  2. Press F5 — launches an Extension Development Host with the extension loaded
  3. Open any .canvas or .pen file 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured