typst-mcp
v1.3.1Model Context Protocol (MCP) server for https://typst.app/ cloud projects, Yjs real-time text editing, asset management, and Typst compiler diagnostics
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
typst_auth_login
Authenticate with https://typst.app using direct email/password API login (POST /v1/auth/signin) or a session cookie (__Http-typst-session), with automatic cookie/browser fallback on challenge.
| Parameter | Type | Description |
|---|---|---|
email | string | Typst account email (falls back to TYPST_EMAIL env var) |
password | string | Typst account password (falls back to TYPST_PASSWORD env var) |
sessionCookie | string | Optional __Http-typst-session cookie value or full Cookie header string (falls back to TYPST_SESSION_COOKIE) |
useBrowserFallback | boolean | Enable automatic fallback if Turnstile/CAPTCHA challenge blocks direct HTTP login (default: true) |
typst_auth_status
Check current https://typst.app authentication status, active session cookies, and login method.
typst_list_projects
List all owned and shared/external projects in the authenticated user's https://typst.app dashboard.
typst_get_project
Get detailed metadata, access permissions, pinned compiler version, and full file tree for a https://typst.app project.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID |
typst_create_project
Create a new project on https://typst.app with optional initial .typ/.bib files and pinned Typst compiler version.
| Parameter | Type | Description |
|---|---|---|
name * | string | Project title |
files | array | Optional initial text files (defaults to main.typ) |
folder | string | Optional folder ID |
owner | string | Optional owner user/team ID |
pinnedVersion | string | Typst compiler version (default: 0.15.1) |
typst_delete_project
Permanently delete a project on https://typst.app by ID.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID to delete |
typst_list_files
List all files (multiplayer Yjs text files and binary asset blobs) inside a https://typst.app project.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID |
typst_read_file
Read project text in bounded pages (default 200 lines/16 KiB) or images as native image blocks. content contains source only; use nextOffset for continuation. contentHash covers the entire raw text file: pass it as expectedHash to typst_edit_file. Compact file metadata by default; output='full' adds metadata, not extra source lines. Use grep to locate relevant lines before reading large files.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | File path/name (e.g. 'main.typ') or file ID |
projectId * | string | The Typst project ID |
limit | integer | Maximum complete lines to read (default: 200). Use nextOffset to continue. |
lineNumbers | boolean | Whether to prefix each line with its 1-indexed line number (e.g. '1 | ') |
maxBytes | integer | Maximum returned source bytes, including line number prefixes (default: 16384, maximum: 1 MiB). Increase for unusually long lines. |
offset | integer | Line number to start reading from (1-indexed) |
output | string | compact (default): minimal file metadata; full: all file metadata. Both use offset/limit/maxBytes pagination. |
typst_write_file
Create or overwrite a text file (.typ, .bib, .toml, etc.) in a https://typst.app project, synchronizing the Yjs CRDT update via WebSocket (/editing/v3) and REST (/v1/files/:projectId/:fileId/yjs).
| Parameter | Type | Description |
|---|---|---|
content * | string | Full UTF-8 text content to write |
filePath * | string | File path/name (e.g. 'main.typ') or file ID |
projectId * | string | The Typst project ID |
preferWebSocket | boolean | Also push real-time TextUpdate over /editing/v3 WebSocket before REST persistence (default: true) |
typst_edit_file
Apply all targeted edits against one original file snapshot, with one save. Prefer short unique oldText anchors and expectedHash from typst_read_file to reject stale edits. Exact matching by default (LF/CRLF resilient); matchMode='fuzzy' opts into Unicode/whitespace fallback. Malformed, ambiguous, or overlapping edits fail without saving. Summary output by default; dryRun previews a bounded diff. Unchanged characters and BOM are preserved.
| Parameter | Type | Description |
|---|---|---|
dryRun | boolean | Validate and preview edits without saving (default: false). Returned contentHash still identifies unchanged cloud text. |
edits | array | One or more targeted non-overlapping replacements. Each oldText must be unique in the original file. |
expectedHash | string | Recommended: contentHash from the latest read. Checked against fresh downloaded text inside the file mutation queue; stale files fail without saving. |
filePath | string | File path/name (e.g. 'main.typ') or file ID |
matchMode | string | exact (default) matches source with newline normalization. fuzzy enables Unicode quote/dash/space/NFKC fallback only when an exact match is absent. |
maxDiffBytes | integer | Byte budget per diff/patch field (default: 8192). Each also has a 100-line cap. Truncation is explicit; read affected ranges for full details. |
newText | string | Optional replacement text for single replacement shorthand |
oldText | string | Optional shorthand for a single replacement (used if edits is omitted) |
output | string | summary (default): counts, new contentHash, firstChangedLine; diff: also a bounded display diff; full: also bounded patch and full metadata. dryRun defaults to diff. |
preferWebSocket | boolean | Push real-time TextUpdate over /editing/v3 WebSocket in addition to REST persistence (default: true) |
projectId | string | The Typst project ID |
typst_upload_asset
Upload or replace a binary asset (PNG, JPG, SVG, PDF, font, etc.) in a https://typst.app project from a local file path or base64 data.
| Parameter | Type | Description |
|---|---|---|
fileName * | string | Destination path inside the Typst project (e.g. 'figures/plot.png') |
projectId * | string | The Typst project ID |
base64Data | string | Base64-encoded binary payload (used if localFilePath is not provided) |
convert | boolean | Whether typst.app should convert the uploaded file |
localFilePath | string | Local filesystem path to read binary asset bytes from |
typst_delete_file
Delete a file or asset from a https://typst.app project via DeleteFilesMutation.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | File path/name or file ID to delete |
projectId * | string | The Typst project ID |
typst_rename_file
Rename or move a file inside a https://typst.app project via UpdatesFileMutation.
| Parameter | Type | Description |
|---|---|---|
filePath * | string | Existing file path/name or file ID |
newName * | string | New destination path/name inside the project |
projectId * | string | The Typst project ID |
typst_get_diagnostics
Retrieve compiler diagnostics (errors, warnings, line/column numbers, and hints) for a https://typst.app project. Supports both local Typst CLI compilation (fastest) and Typst Web cloud diagnostics (zero-binary fallback using typst.app cloud compiler).
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID |
mainFile | string | Optional main .typ entry file override (defaults to project previewed file or main.typ) |
mode | string | Diagnostics mode: 'auto' (prefers local Typst CLI if installed, falls back to Typst Web cloud compiler), 'cli' (requires local typst binary), or 'web' (uses Typst Web cloud compiler). Defaults to 'aut… |
typst_export_pdf
Synchronize all text and binary files from a https://typst.app project, compile the document to PDF, and save it to outputPath.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID |
mainFile | string | Optional main .typ entry file override |
outputPath | string | Optional local filesystem path to save the compiled PDF |
typst_capture_screenshot
Capture high-resolution PNG preview screenshots to verify the visual status of a https://typst.app project (mode='pages' renders compiled PNG pages via Typst; mode='browser' captures the live typst.app web editor & preview pane via Playwright).
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID |
includeBase64 | boolean | Include screenshots as image blocks for direct vision inspection (default: true; set false to return paths and metadata only) |
mainFile | string | Optional main .typ entry file override |
mode | string | 'pages' (default) compiles high-DPI PNG pages from synced project files; 'browser' captures the live https://typst.app/project/:id UI |
outputDir | string | Optional directory path to save the rendered PNG screenshot files |
pages | string | Page range to capture, e.g. '1', '1-3', '1,4', or 'all' (default: 'all') |
ppi | number | Pixels per inch resolution for rendered PNGs (default: 144) |
typst_grep_project
Search for text or regular expressions across files in a https://typst.app project. Returns matching lines with file paths, line numbers, and optional surrounding context lines.
| Parameter | Type | Description |
|---|---|---|
pattern * | string | Search pattern (regular expression or literal string) |
projectId * | string | The Typst project ID |
context | number | Number of lines to show before and after each match (default: 0) |
glob | string | Optional glob pattern to filter files (e.g. '*.typ' or '*.bib') |
ignoreCase | boolean | Case-insensitive search (default: false) |
limit | number | Maximum number of matches to return (default: 100) |
literal | boolean | Treat pattern as literal string instead of regex (default: false) |
path | string | Optional directory or file path to restrict search (e.g. 'chapters/' or 'main.typ') |
typst_find_and_replace
Find and replace text or regex in one file or project-wide. Use replacements to batch mappings (e.g. Sep → September, Oct → October) in one call with one save per file. Rules run sequentially; later rules see earlier results. Batch output defaults to compact summary; request output='diff' or 'full' for previews. Supports dryRun and per-file mutation serialization. Project-wide changes are not atomic across files.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | The Typst project ID |
dryRun | boolean | If true, returns unified diffs and match counts without saving changes (default: false) |
filePath | string | Optional file path/name (e.g. 'main.typ'). If omitted, searches and replaces across all text files in the project. |
glob | string | Optional glob pattern to filter target files when searching project-wide (e.g. '*.typ') |
ignoreCase | boolean | Case-insensitive search (default: false) |
limit | number | Maximum number of replacements per file (default: replace all occurrences) |
output | string | summary: counts and first changed line; diff: also display diff; full: also unified patch. Defaults to summary for batches, full for legacy pattern/replacement calls. Applies to dry runs too. |
pattern | string | Search pattern to replace (literal substring or regex) |
preferWebSocket | boolean | Push real-time TextUpdate over /editing/v3 WebSocket before REST persistence (default: true) |
regex | boolean | Whether pattern is a regular expression (default: false) |
replacement | string | Replacement text (supports $1, $2 capture groups if regex is true) |
replacements | array | Ordered replacement rules instead of pattern/replacement. Each rule runs on the previous result. Set regex, ignoreCase, and limit per rule. All rules are validated before any writes; each changed file… |