The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Codex Tldraw MCP listing page.
A stdio MCP server that generates editable repo-local tldraw diagrams, portable SVG previews, and trackable code graphs with drift detection.

Add the server to Codex:
Then ask Codex to diagram the current repo:
Reverse-engineer its runtime architecture:
Or ask for a diagram directly:
Create a trackable JavaScript or TypeScript module graph:
After the code changes, compare it with the saved graph:
The default outputs are:
Open the .tldr board in a tldraw-compatible viewer to edit it. Any MCP host, browser, documentation system, or code review can display the .svg preview directly.
See the v0.6.0 release notes for compatibility and verification details.
.tldr board that stays with the project it explains, plus a portable .svg preview.For a handwriting font app, the workflow may be inferred as:
If you prefer editing Codex MCP config directly:
diagram_repo: scans a repo and appends a product workflow diagram to <repo>/boards/<boardName>.tldr.draw_canvas: appends a prompt-provided workflow, state machine, architecture sketch, or plan to <repo>/boards/<boardName>.tldr.draw_architecture: appends a simple codebase architecture view with a main flow, supporting components, actions, calls, and errors.diagram_code_graph: scans repository-local JavaScript and TypeScript modules and appends a trackable import graph.compare_code_graph: previews drift or marks changed and stale elements on an existing trackable code graph.list_boards: lists boards under a repo's boards/ directory.read_board_summary: summarizes generated diagrams and shape counts and returns both artifact paths.Each tool accepts an optional repoPath. Relative paths are resolved from the MCP server working directory.
Every diagram-writing tool saves both artifacts and returns boardPath and svgPath in structured output. Tool content also includes MCP resource links for the editable board and SVG preview. The SVG renderer covers the text, rectangle, and arrow shapes generated by this server and needs no browser runtime.
Board resources list and read summaries, editable .tldr files, and SVG previews from the most recent repoPath used by a tool call. Before any tool call, resources default to the MCP server working directory.
diagram_code_graph stores stable repository-relative identities and fingerprints in MCP-owned shape metadata. Each source module becomes a node. Static imports, dynamic imports, re-exports, and CommonJS require calls between repository modules become edges.
Run compare_code_graph after the repository changes. Preview mode is the default and does not write the board:
To update the board, ask Codex to apply the drift markers or pass applyMarkers: true. The comparison uses four states:
unchanged: the stored identity and fingerprint still match.changed: the module still exists, but its exports or local import relationships changed.stale: the board contains an element that no longer exists in the current code graph.new: the current graph contains an element that is absent from the board.Stale elements become red and dashed. Changed modules become orange and dashed. New elements appear in the tool result; v0.4.0 does not insert or rearrange them. Re-running the comparison restores the original generated style when code matches again.
The comparison changes only MCP-generated graph styling and metadata. It preserves positions, sizes, labels, manual shapes, and other diagrams on the board, and it restores each element's prior color when drift clears. Boards created by diagram_repo, draw_canvas, or an older release do not contain trackable code-graph metadata; create a graph with diagram_code_graph before comparing drift.
The v0.4.0 scanner supports .js, .jsx, .mjs, .cjs, .ts, .tsx, .mts, and .cts modules. It reports unresolved relative imports and counts external imports without drawing external packages. It models module/import relationships, not runtime call graphs.
draw_canvas does not scan source files. The current repository is only the storage location for the generated board.
Example prompts:
draw_architecture helps a new reader understand how work moves across a codebase. Codex inspects the code first, then sends the renderer a small model:
Keep libraries and helper modules inside component actions. For example, "validate the response with Zod" belongs inside the API component rather than becoming a separate Zod component. Meaningful arrows have bindings to both endpoint shapes.
See Architecture Diagrams for the analysis contract and input model.
This project is early and feedback is useful. Please open an issue if:
Use the GitHub issue templates for bugs, feature requests, and real-world examples.
This project is snapshot-only. It does not control a live browser canvas or provide live collaboration. It writes board files to the repository being diagrammed so a tldraw-compatible viewer can open them later.
The official tldraw MCP App is designed for hosts that can render an interactive tldraw canvas inside the chat context. In Codex Desktop, tool discovery worked in testing, and the tldraw search tool returned Editor API details, shape types, and helpers. The live exec path did not work: every call timed out after 30 seconds, including a read-only call to count the current page shapes.
That failure mode suggested a host compatibility gap, not a tldraw file format problem. Codex can reliably call local stdio MCP tools and inspect generated files, but it does not currently provide the same embedded interactive MCP App canvas path used by hosts such as Cursor.
This server started as a Codex-first fallback. Instead of trying to drive a live canvas, it generates .tldr snapshots on disk through a normal stdio MCP tool call. Its stdio transport and SVG previews now make the same output usable in any MCP-compatible host, while Codex remains the primary documented setup.
This is a local filesystem tool. It reads source files from repoPath and writes .tldr and .svg files under repoPath/boards.
To restrict access to specific directories, set TLDRAW_MCP_ALLOWED_ROOTS to a path-delimited allowlist:
When the allowlist is set, repoPath must resolve inside one of those roots.
Generated .tldr files do not store absolute local repository paths in shape metadata. Trackable code graphs store repository-relative source paths.
This repo uses Bun for development:
Run the server from source:
Use a local build in Codex:
Build, test, and inspect the package contents:
Publishing is handled by .github/workflows/publish-npm.yml when a GitHub Release is published. The npm trusted publisher must allow jananadiw/codex-tldraw-mcp, workflow publish-npm.yml, with no GitHub environment and the publish action enabled. The workflow uses GitHub OIDC and does not require an npm token.
Use the workflow's dry_run dispatch option to validate a release without publishing it.
The package includes MCP Registry metadata:
package.json declares mcpName.server.json describes the npm stdio package.After the workflow publishes and the npm package version is available, authenticate and publish the registry metadata:
Verify the registry entry: