MCP Hub
Back to servers

tldraw-mcp

A minimal MCP server for AI-driven canvas manipulation and visualization using tldraw. It enables AI clients to programmatically create, update, and manage shapes, flowcharts, and frames on a live interactive canvas.

Updated
Feb 2, 2026

tldraw-mcp

Minimal MCP server for AI-driven canvas manipulation with tldraw.

Architecture

┌─────────────┐     stdio      ┌─────────────┐    WebSocket    ┌─────────────┐
│  AI Client  │◄──────────────►│  tldraw-mcp │◄───────────────►│   Widget    │
│ (Claude,etc)│                │   (server)  │   :4000         │  (tldraw)   │
└─────────────┘                └─────────────┘                 └─────────────┘
                                                                    :3000

Tools

ToolDescription
create_shapeCreate shapes (rectangle, ellipse, star, cloud, diamond, etc.)
update_shapeUpdate shape properties (position, size, color, fill)
delete_shapesDelete shapes by ID
connect_shapesConnect two shapes with an arrow
create_frameCreate a frame to group shapes together
create_flowchartCreate a flowchart with nodes and edges (auto-layout)
get_snapshotGet current canvas state
zoom_to_fitZoom canvas to fit all shapes
clear_canvasClear all shapes

Quick Start

# 1. Clone and install
git clone https://github.com/dpunj/tldraw-mcp
cd tldraw-mcp
bun install

# 2. Start the widget (tldraw canvas + WebSocket server)
cd widget
bun install
bun run dev
# Opens http://localhost:3000 (canvas) + ws://localhost:4000 (relay)

# 3. In another terminal, test the MCP server
cd ..
bun run dev

Claude Desktop Config

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "tldraw": {
      "command": "bun",
      "args": ["run", "/path/to/tldraw-mcp/src/index.ts"]
    }
  }
}

Environment Variables

VariableDefaultDescription
TLDRAW_WS_URLws://localhost:4000Widget WebSocket URL
WS_PORT4000Widget WS server port

Development

# MCP server
bun run dev      # Run server
bun run build    # Build for distribution
bun run check    # TypeScript check

# Widget
cd widget
bun run dev      # Start vite + WS server

License

MIT

Reviews

No reviews yet

Sign in to write a review