tldraw-mcp
Provides tools for creating and editing tldraw files (.tldr) via JSON manipulation, including shape creation (rectangles, text, groups, arrows), page management, and file checkpoints.
Click on "Install 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-mcpAdd a new page named 'Design Notes'"
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
Minimal MCP server for editing tldraw .tldr files via JSON manipulation. Headless, no browser needed.
Status
Working skeleton. Schema validation is wired (@tldraw/tlschema validators run before every write), fractional indexing uses @tldraw/utils, file writes are guarded by proper-lockfile. Output verified end-to-end against the real tldraw runtime via Store.loadStoreSnapshot() in the contract test layer.
Tools
File / page lifecycle
Tool | What it does |
| Create a fresh |
| Add a new page |
| List pages with id, name, ordering index |
| Move shapes; |
Shapes
Tool | What it does |
| Create a rectangle (geo shape) |
| Create a text shape |
| Group shapes by reparenting them |
| Dissolve a group, reparenting its children to the group's parent |
| Arrow + bindings between two same-page shapes |
| List shapes — id, type, x, y, label only |
| Full record of one shape by id |
| Shallow-merge patch (use nested |
| Delete by id; |
Discovery & escape hatch (inspired by official tldraw-mcp-app)
Tool | What it does | Token cost |
| List supported shape types + curated required props. Pass | low / medium |
| Run a | varies |
Checkpoints (safety)
Tool | What it does | Token cost |
| Copy | low |
| List backups, newest first | low |
| Restore a backup (most recent if | low |
The token-saving design: tools take primitive args, return ids or ok. The full JSON only enters context when you call get_shape deliberately.
Install
Option 1 · npx (no install, recommended)
npx -y github:m9810223/tldraw-mcpFirst run clones, runs npm install, then triggers the prepare script which builds dist/. Subsequent runs are cached.
Pin a branch / tag / commit:
npx -y github:m9810223/tldraw-mcp#main
npx -y github:m9810223/tldraw-mcp#v0.1.0
npx -y github:m9810223/tldraw-mcp#abc1234Option 2 · Global install
npm install -g github:m9810223/tldraw-mcp
tldraw-mcp # the bin is on PATHOption 3 · Private repo over SSH
npx -y git+ssh://git@github.com/m9810223/tldraw-mcp.gitOption 4 · Local clone (for development)
git clone https://github.com/m9810223/tldraw-mcp.git
cd tldraw-mcp
npm install
npm run build
node dist/index.js # stdio MCP — waits on stdinRequirements
Node.js ≥ 20 (enforced by
engines.node)jqonPATH(only required for theexec_jqtool)macOS:
brew install jqDebian/Ubuntu:
sudo apt-get install -y jq
Wire up to Claude Code
claude mcp add (recommended). The -- separator is required so -y is
passed to npx instead of being parsed as a claude mcp add flag:
claude mcp add tldraw -- npx -y github:m9810223/tldraw-mcpAdd -s user for global (all projects) or -s project for a .mcp.json
checked into the repo. Default is -s local (this project, your machine).
…or by editing .mcp.json (project) / ~/.claude.json (user-global):
{
"mcpServers": {
"tldraw": {
"command": "npx",
"args": ["-y", "github:m9810223/tldraw-mcp"]
}
}
}If you installed globally with Option 2:
{
"mcpServers": {
"tldraw": { "command": "tldraw-mcp" }
}
}Restart Claude Code, then /mcp should list the tldraw server with 17 tools.
Wire up to other MCP clients
Same JSON shape, different config file location:
Client | Config path |
Claude Desktop |
|
Cursor |
|
VS Code |
|
Bootstrapping a .tldr file
Use the create_empty_file tool, or save an empty canvas from tldraw.com and point tools at the absolute path.
create_empty_file({ file: "/tmp/demo.tldr" })Design comparison vs official tldraw-mcp-app
The Cloudflare-hosted official MCP exposes only search + exec (run any JS in a live tldraw Editor). This skeleton goes the opposite way — typed JSON edits over .tldr files — and borrows the discovery pattern (search_api) and escape hatch (exec_jq) so an LLM can fall through when typed tools don't cover an operation.
Official | This skeleton | |
Transport | streamable-http + sse (Cloudflare) | stdio (works in Claude Code directly) |
Runtime | Real tldraw Editor in widget iframe | Pure Node, edits raw JSON |
Tools | 2 ( | 17: file/page lifecycle + 9 shape ops + search_api + exec_jq + ckpt |
Live preview | Yes (widget iframe) | No (open the file in tldraw to view) |
Coverage | Whole Editor API | Geo / text / arrow + jq escape hatch |
Known gaps
index(z-order) only supports appending above the current max — no insert-betweenNo alignment / distribution tools (use
update_shapeto setx/ydirectly, orexec_jq)No image / video / asset support
Schema version pinning is informational only — opening a file in a newer tldraw may trigger migrations
search_apicurated list is hand-maintained alongside the live@tldraw/tlschemareflection
Architecture
src/
index.ts MCP server entry, tool registration (stdio transport)
tools.ts Tool handlers + zod input schemas
shapes.ts tldraw record factories (geo/text/arrow/group/binding)
store.ts Load/save .tldr + withFileLock; helpers (id gen, indexing, find, page-of-shape, bindings-for-shape)
template.ts Empty .tldr generator using @tldraw/tlschema serialize()
validate.ts validateShape / validateBinding using createShapeValidator + createBindingValidator
checkpoint.ts Timestamped backups under .tldraw-mcp-checkpoints/
jq.ts Shell-out to jq for the exec_jq escape hatch
test/
unit/ store + validate (13 tests)
integration/ tools end-to-end on tmp .tldr (18 tests)
contract/ loadStoreSnapshot against real @tldraw/store (4 tests)Pure JSON manipulation — no @tldraw/store, no DOM, no React.
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/m9810223/tldraw-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server