tldraw MCP Server
Provides tools for creating, reading, updating, and deleting tldraw shapes on a live canvas, enabling AI agents to draw diagrams, architecture charts, and flowcharts programmatically.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tldraw MCP Serverdraw a flowchart of a login system"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tldraw MCP Server
Programmatic canvas toolkit for AI agents — create, read, update, and delete tldraw shapes in real time via the Model Context Protocol.
What It Is
An MCP server that gives AI agents (AdaL, Claude, Cursor, Codex CLI…) programmatic control over a live tldraw canvas. Draw diagrams, architecture charts, and flowcharts by just describing what you want.
Inspired by mcp_excalidraw — the same quality and completeness, built for the tldraw ecosystem.
Related MCP server: monosketch-mcp
Architecture
Flow: MCP client → MCP server (Zod validation) → Canvas server (Express HTTP) → WebSocket broadcast → Browser (tldraw editor, real time).
Quick Start
Prerequisites
Node.js >= 18
1 — Install & Build
git clone https://github.com/chindris-mihai-alexandru/tldraw-mcp-server.git
cd tldraw-mcp-server
npm install
npm run build
npm run build:frontend2 — Start the Canvas Server
npm run canvas
# Canvas running at http://127.0.0.1:3000Open http://127.0.0.1:3000 in your browser — this is the live canvas.
3 — Connect an MCP Client
The .mcp.json at the repo root works out-of-the-box for any project-level MCP client:
{
"mcpServers": {
"tldraw": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"EXPRESS_SERVER_URL": "http://127.0.0.1:3000"
}
}
}
}MCP Client Configuration
The default transport is stdio, so existing configs continue to work. Set MCP_TRANSPORT=http for shared HTTP endpoints (OpenAI Agents SDK, etc.).
Transport and adapter options
Variable | Default | Purpose |
|
|
|
|
| Client hint: |
|
| Server name for optional tool prefixes |
|
| Expose tools as |
|
| Compact tool descriptions to reduce discovery context |
|
| HTTP bind host |
|
| HTTP bind port |
|
| Streamable HTTP MCP path |
| local origins | Comma-separated Origin allowlist |
| local hosts | Comma-separated Host allowlist |
| unset | Bearer-token auth for HTTP (set and send |
AdaL CLI
Project-level — the .mcp.json in this repo is pre-configured. Open AdaL in this directory and the server is auto-discovered.
cd tldraw-mcp-server
adalPerformance mode for lower discovery overhead:
{
"mcpServers": {
"tldraw": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
"MCP_TRANSPORT": "stdio",
"MCP_CLIENT": "adal",
"MCP_PERFORMANCE_MODE": "true"
}
}
}
}Claude Code
# Project-level
claude mcp add tldraw --scope project \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-e MCP_TRANSPORT=stdio \
-e MCP_CLIENT=claude \
-- node /absolute/path/to/tldraw-mcp-server/dist/index.js
# User-level (available across all projects)
claude mcp add tldraw --scope user \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-e MCP_TRANSPORT=stdio \
-e MCP_CLIENT=claude \
-- node /absolute/path/to/tldraw-mcp-server/dist/index.jsClaude Desktop
Config: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
{
"mcpServers": {
"tldraw": {
"command": "node",
"args": ["/absolute/path/to/tldraw-mcp-server/dist/index.js"],
"env": {
"EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
"MCP_TRANSPORT": "stdio",
"MCP_CLIENT": "claude"
}
}
}
}Cursor
Config: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
"mcpServers": {
"tldraw": {
"command": "node",
"args": ["/absolute/path/to/tldraw-mcp-server/dist/index.js"],
"env": {
"EXPRESS_SERVER_URL": "http://127.0.0.1:3000",
"MCP_TRANSPORT": "stdio",
"MCP_CLIENT": "cursor"
}
}
}
}If a gateway expects server-prefixed tool names (tldraw__create_element), add "INCLUDE_SERVER_IN_TOOL_NAMES": "true" to the env.
OpenAI Agents SDK
Use Streamable HTTP for OpenAI Agents SDK and other shared-agent environments:
MCP_TRANSPORT=http \
MCP_HTTP_HOST=127.0.0.1 \
MCP_HTTP_PORT=3333 \
MCP_HTTP_PATH=/mcp \
EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
MCP_CLIENT=openai \
node dist/index.jsimport { Agent } from '@openai/agents'
const agent = new Agent({
name: 'diagram-agent',
instructions: 'Use the tldraw MCP server to create and inspect diagrams.',
mcpServers: [
{
name: 'tldraw',
url: 'http://127.0.0.1:3333/mcp',
headers: process.env.MCP_AUTH_TOKEN
? { Authorization: `Bearer ${process.env.MCP_AUTH_TOKEN}` }
: undefined,
},
],
})Codex CLI
codex mcp add tldraw \
--env EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
--env MCP_TRANSPORT=stdio \
-- node /absolute/path/to/tldraw-mcp-server/dist/index.jsSupergateway / systemd
Wrap the stdio server with supergateway for an HTTP endpoint:
npx -y supergateway \
--stdio "node /opt/tldraw-mcp-server/dist/index.js" \
--port 3333 \
--baseUrl http://127.0.0.1:3333 \
--ssePath /mcp \
--messagePath /messagesExample systemd unit:
[Unit]
Description=tldraw MCP HTTP Gateway
After=network.target
[Service]
Type=simple
WorkingDirectory=/opt/tldraw-mcp-server
Environment=EXPRESS_SERVER_URL=http://127.0.0.1:3000
Environment=MCP_PERFORMANCE_MODE=true
ExecStart=/usr/bin/npx -y supergateway --stdio "node dist/index.js" --port 3333 --baseUrl http://127.0.0.1:3333 --ssePath /mcp --messagePath /messages
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetMigration and rollback
No migration is required for existing AdaL users — stdio remains the default. To roll back optional behavior, unset MCP_TRANSPORT, MCP_PERFORMANCE_MODE, and INCLUDE_SERVER_IN_TOOL_NAMES, then use the original .mcp.json shape with only EXPRESS_SERVER_URL.
MCP Tools (27 tools)
Canvas Operations
Tool | Description |
| Create a shape, text, arrow, or note on the canvas |
| Get a single element by ID |
| Partially update any element property |
| Delete an element by ID |
| List/filter elements by type and bounding box |
| Create multiple elements atomically |
| Remove all elements (requires |
Grouping
Tool | Description |
| Group 2+ elements — they move and transform as a unit |
| Dissolve a group, releasing all children as independent shapes |
Sticky Notes
Tool | Description |
| Create a sticky note with sensible defaults (yellow, solid fill) |
| Update the content or styling of an existing sticky note |
| Return pre-built sticky templates with recommended colors and use cases |
Layout & Alignment
Tool | Description |
| Align multiple elements left/center/right/top/middle/bottom |
| Distribute elements evenly along horizontal or vertical axis |
| Automatically arrange using dagre, force-directed, or grid layout |
Viewport & Scene
Tool | Description |
| Zoom, pan, zoom-to-fit, or center on a specific element |
| Return color names, presets, and layout best practices |
| Summarize all canvas elements, positions, labels, and connections |
| Export all elements as a JSON snapshot |
| Import a JSON scene in replace or merge mode |
| Save the current canvas as a named in-memory snapshot |
| Restore a previously saved named snapshot |
Export
Tool | Description |
| Capture PNG from the canvas (server-side via Playwright, no browser needed) |
| Export canvas as an SVG string |
| Export canvas as a PNG image (server-side Playwright) |
| Export canvas as a JPEG image (server-side Playwright) |
| Export canvas as a PDF (Playwright for full fidelity, pdf-lib fallback) |
Shape Types
rectangle · ellipse · diamond · triangle · text · arrow · line · note · frame · star · cloud · hexagon
Element Properties
Property | Values | Default |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Development
# Type check
npm run type-check
# Backend (watch mode)
npm run dev:canvas # canvas server on :3000
npm run dev # MCP server on stdio
# Frontend (watch mode with hot reload)
npm run dev:frontend # Vite dev server on :5173
# Build everything
npm run build:all
# Run the full test suite once
npm test -- --runTesting a Tool
# Create a rectangle
npx @modelcontextprotocol/inspector --cli \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-- node dist/index.js --method tools/call \
--tool-name create_element \
--tool-arg type=rectangle --tool-arg x=100 --tool-arg y=100 \
--tool-arg width=200 --tool-arg height=80 \
--tool-arg text="Hello" --tool-arg color=blue --tool-arg fill=semi
# List all tools
npx @modelcontextprotocol/inspector --cli \
-e EXPRESS_SERVER_URL=http://127.0.0.1:3000 \
-- node dist/index.js --method tools/listTroubleshooting
Screenshot tool fails with "empty data"
get_canvas_screenshot prefers a server-side render (SVG + Playwright, no browser required). If Playwright is not installed or the export fails for any reason, it falls back to browser-based rendering. To ensure screenshots always work:
# Install Playwright (one-time)
npm install playwright
npx playwright install chromiumIf the error persists even with Playwright installed, ensure the canvas server is running (npm run canvas) and try again.
License
Acknowledgments
tldraw — The infinite canvas SDK
mcp_excalidraw — Reference architecture
Model Context Protocol — Open standard for AI tool integration
This server cannot be deployed
Maintenance
Related MCP Connectors
Real-time collaborative whiteboard — AI agents and humans edit the same board live over MCP.
AI agent draws editable hand-drawn diagrams (flowchart, ER, architecture) via MCP, not static images
Connect AI agents to Flato's editable canvas runtime through a hosted MCP server.
Create and edit architecture diagrams from your AI agent; get an SVG and a live editable canvas.
Related MCP Servers
- AlicenseAqualityDmaintenanceA 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.91MIT
- FlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI agents to create beautiful ASCII diagrams using Unicode box-drawing characters, with support for stateful canvas operations, multiple shape types, and style customization.2-
- AlicenseAqualityDmaintenanceA full-featured MCP server that lets AI assistants create and edit tldraw diagrams programmatically with 30 tools across all 14 shape types.432MIT
- FlicenseNot gradedqualityBmaintenanceMCP server enabling AI assistants to read and write Obsidian notes, create and edit Excalidraw drawings, and run Excalidraw scripts via natural language commands.-