tldraw-mcp
tldraw-mcp
JSON 조작을 통해 tldraw .tldr 파일을 편집하기 위한 최소한의 MCP 서버입니다. 헤드리스 방식이며 브라우저가 필요하지 않습니다.
상태
작동하는 스켈레톤입니다. 스키마 유효성 검사가 연결되어 있으며(@tldraw/tlschema 유효성 검사기가 모든 쓰기 작업 전에 실행됨), 분수 인덱싱은 @tldraw/utils를 사용하고, 파일 쓰기는 proper-lockfile로 보호됩니다. 출력은 계약 테스트 계층에서 Store.loadStoreSnapshot()을 통해 실제 tldraw 런타임과 비교하여 엔드투엔드로 검증되었습니다.
Related MCP server: obsidian-codex-mcp
도구
파일 / 페이지 수명 주기
도구 | 기능 |
| 기본 페이지가 포함된 새로운 |
| 새 페이지 추가 |
| id, 이름, 정렬 인덱스가 포함된 페이지 목록 표시 |
| 도형 이동; |
도형
도구 | 기능 |
| 직사각형(geo 도형) 생성 |
| 텍스트 도형 생성 |
| 도형을 재부모화하여 그룹화 |
| 그룹을 해제하고 자식 도형을 그룹의 부모로 재부모화 |
| 같은 페이지에 있는 두 도형 간의 화살표 + 바인딩 연결 |
| 도형 목록 표시 — id, type, x, y, label만 표시 |
| id별로 하나의 도형에 대한 전체 레코드 가져오기 |
| 얕은 병합 패치 (속성 편집을 위해 중첩된 |
| id별로 삭제; |
탐색 및 탈출구 (공식 tldraw-mcp-app에서 영감)
도구 | 기능 | 토큰 비용 |
| 지원되는 도형 유형 + 필수 속성 목록 표시. | |
| 파일에 대해 | 가변 |
체크포인트 (안전)
도구 | 기능 | 토큰 비용 |
|
| |
| 백업 목록 표시 (최신순) | |
| 백업 복원 ( |
토큰 절약 설계: 도구는 기본 인수를 취하고 id 또는 ok를 반환합니다. 전체 JSON은 get_shape를 의도적으로 호출할 때만 컨텍스트에 들어옵니다.
설치
옵션 1 · npx (설치 불필요, 권장)
npx -y github:m9810223/tldraw-mcp첫 실행 시 클론하고 npm install을 실행한 다음, dist/를 빌드하는 prepare 스크립트를 트리거합니다. 이후 실행은 캐시됩니다.
브랜치 / 태그 / 커밋 고정:
npx -y github:m9810223/tldraw-mcp#main
npx -y github:m9810223/tldraw-mcp#v0.1.0
npx -y github:m9810223/tldraw-mcp#abc1234옵션 2 · 전역 설치
npm install -g github:m9810223/tldraw-mcp
tldraw-mcp # the bin is on PATH옵션 3 · SSH를 통한 비공개 저장소
npx -y git+ssh://git@github.com/m9810223/tldraw-mcp.git옵션 4 · 로컬 클론 (개발용)
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 stdin요구 사항
Node.js ≥ 20 (
engines.node에 의해 강제됨)PATH에jq필요 (exec_jq도구에만 필요)macOS:
brew install jqDebian/Ubuntu:
sudo apt-get install -y jq
Claude Code에 연결
claude mcp add (권장). -- 구분 기호가 필요하므로 -y가 claude mcp add 플래그로 파싱되지 않고 npx로 전달됩니다:
claude mcp add tldraw -- npx -y github:m9810223/tldraw-mcp전역(모든 프로젝트)의 경우 -s user를, 저장소에 체크인된 .mcp.json의 경우 -s project를 추가하세요. 기본값은 -s local (현재 프로젝트, 사용자 컴퓨터)입니다.
…또는 .mcp.json (프로젝트) / ~/.claude.json (사용자 전역)을 편집하여 설정:
{
"mcpServers": {
"tldraw": {
"command": "npx",
"args": ["-y", "github:m9810223/tldraw-mcp"]
}
}
}옵션 2를 사용하여 전역으로 설치한 경우:
{
"mcpServers": {
"tldraw": { "command": "tldraw-mcp" }
}
}Claude Code를 재시작하면 /mcp 명령어를 통해 17개의 도구가 포함된 tldraw 서버가 나열되어야 합니다.
다른 MCP 클라이언트에 연결
JSON 구조는 동일하며 설정 파일 위치만 다릅니다:
클라이언트 | 설정 경로 |
Claude Desktop |
|
Cursor |
|
VS Code |
|
.tldr 파일 부트스트래핑
create_empty_file 도구를 사용하거나 tldraw.com에서 빈 캔버스를 저장한 후 도구에서 절대 경로를 지정하세요.
create_empty_file({ file: "/tmp/demo.tldr" })공식 tldraw-mcp-app과의 설계 비교
Cloudflare에서 호스팅되는 공식 MCP는 search + exec(실시간 tldraw 에디터에서 JS 실행)만 노출합니다. 이 스켈레톤은 정반대의 방식인 .tldr 파일에 대한 타입 지정 JSON 편집을 수행하며, 타입 지정 도구가 작업을 다루지 못할 때 LLM이 사용할 수 있도록 탐색 패턴(search_api)과 탈출구(exec_jq)를 차용했습니다.
공식 | 이 스켈레톤 | |
전송 방식 | streamable-http + sse (Cloudflare) | stdio (Claude Code에서 직접 작동) |
런타임 | 위젯 iframe 내 실제 tldraw 에디터 | 순수 Node, 원시 JSON 편집 |
도구 | 2개 ( | 17개: 파일/페이지 수명 주기 + 도형 작업 9개 + search_api + exec_jq + ckpt |
실시간 미리보기 | 예 (위젯 iframe) | 아니오 (tldraw에서 파일을 열어 확인) |
커버리지 | 전체 에디터 API | Geo / 텍스트 / 화살표 + jq 탈출구 |
알려진 제한 사항
index(z-order)는 현재 최대값 위로 추가하는 것만 지원하며, 중간 삽입은 지원하지 않음정렬 / 배분 도구 없음 (
update_shape를 사용하여x/y를 직접 설정하거나exec_jq사용)이미지 / 비디오 / 에셋 지원 없음
스키마 버전 고정은 정보 제공용일 뿐이며, 더 최신 버전의 tldraw에서 파일을 열면 마이그레이션이 트리거될 수 있음
search_api큐레이션 목록은 실시간@tldraw/tlschema리플렉션과 함께 수동으로 유지 관리됨
아키텍처
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)순수 JSON 조작 — @tldraw/store, DOM, React 없음.
Available Tools
18 toolsconnectA
Connect two shapes with an arrow. Arrow position is binding-driven (start/end stored as 0,0 fallback). Returns arrow id + binding ids.
Inputs: file (required), fromId (required), toId (required), text.
create_empty_fileA
Create a new empty .tldr file with one default page. Errors if file exists unless overwrite=true.
Inputs: file (required), overwrite.
create_groupA
Group existing shapes into a new group. Reparents the given shape ids under a new group shape.
Inputs: file (required), childIds (required).
create_pageB
Create a new page in the document. Returns the new page id.
Inputs: file (required), name (required).
create_rectC
Create a rectangle shape on the main page. Returns its id.
Inputs: file (required), x (required), y (required), w (required), +3 more.
create_textC
Create a text shape on the main page. Returns its id.
Inputs: file (required), x (required), y (required), text (required), +2 more.
delete_shapeC
Delete a shape by id.
Inputs: file (required), id (required), cascade.
exec_jqA
Escape hatch: run a jq filter against the .tldr JSON. Set write=true to persist (auto-checkpoints first).
Inputs: file (required), filter (required), write.
get_shapeB
Get the full record of a single shape by id.
Inputs: file (required), id (required).
list_checkpointsA
List checkpoint backups for a .tldr file, newest first.
Inputs: file (required).
list_pagesB
List all pages with id, name, and ordering index.
Inputs: file (required).
list_shapesA
List shapes (id, type, x, y, label only - props omitted to save tokens).
Inputs: file (required), type.
move_to_pageB
Move shapes to a different page by reparenting them. Note: arrows and bindings should move together for correctness.
Inputs: file (required), shapeIds (required), pageId (required), bindings.
restore_checkpointA
Restore a checkpoint over the .tldr file. Omits checkpoint to restore the most recent.
Inputs: file (required), checkpoint.
save_checkpointA
Copy the .tldr file to a timestamped backup. Returns the backup path.
Inputs: file (required), label.
search_apiA
List supported tldraw shape types and their required props. Use this to discover what can be created before falling back to exec_jq.
Inputs: query, type, verbose.
ungroupA
Dissolve a group: reparent its children to the group's parent and delete the group shape.
Inputs: file (required), groupId (required).
update_shapeA
Update a shape via shallow merge. Pass nested {"props": {...}} to update props.
Inputs: file (required), id (required), patch (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Each tool has a clearly distinct purpose, from creating shapes and pages to managing checkpoints and connecting shapes. The exec_jq escape hatch is intentionally broad but its role as a fallback is well-documented, avoiding confusion.
All tool names follow a consistent verb_noun pattern in snake_case (e.g., create_rect, list_pages, update_shape). No mixed conventions or ambiguous verbs.
With 18 tools, the set is well-scoped for a drawing application: it covers shape CRUD, grouping, pages, checkpoints, and an escape hatch. The count feels complete without being overwhelming.
The toolset covers core operations but misses explicit tools for creating non-rectangle shapes (e.g., ellipses, lines). However, search_api and exec_jq fill these gaps, so agents can still achieve full functionality.
Maintenance
Related MCP Connectors
Collaborative whiteboard MCP server — create objects, connectors, C4 diagrams, and manage boards
Remote MCP server for notes, tasks, kanban boards and docs - the Slates agentic workspace
Hosted MCP server for Obsidian Sync vaults: read, search, edit notes. Not affiliated with Obsidian.
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.92MIT
- AlicenseAqualityCmaintenanceLocal-first MCP server for working with an Obsidian vault. No API key required1720MIT
- AlicenseNot gradedqualityBmaintenanceA Codex stdio MCP server that generates simple tldraw product workflow diagrams as .tldr files.75 npm25MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that exposes an Obsidian vault (search, read, create, and update notes) via Streamable HTTP.-