Typst Web MCP
Provides tools for interacting with typst.app cloud projects, enabling AI agents to manage projects and files, perform real-time Yjs CRDT document editing, upload binary assets, run Typst compiler diagnostics, export PDFs, and capture high-DPI preview screenshots.
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., "@Typst Web MCPcheck my typst project for errors"
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.
Typst Web MCP (typst-web-mcp)
Model Context Protocol (MCP) Server for https://typst.app Cloud Collaboration, Real-Time Yjs CRDT Editing & Compiler Diagnostics
Overview
typst-web-mcp connects AI coding and writing agents directly to collaborative typst.app cloud projects. Instead of relying on brittle browser DOM scraping, it implements the native typst.app client protocol:
Native Yjs CRDT Text Sync: Decodes and mutates multiplayer
Y.Doc(doc.getText("text")) state vectors so surgical edits preserve collaborator cursors and version history.Binary
/editing/v3WebSocket Wire Protocol: Encodes and decodeslib0variable-length binary frames (Subscribe,TextUpdate,Pong,Refresh,Presence,Cursor,Leave) with REST/v1/files/:projectId/:fileId/yjspersistence.GraphQL & REST Project Management: Full project CRUD, file tree inspection, rename/move, delete, and binary figure/asset uploads (
PNG,JPG,SVG,PDF, fonts).Direct Authentication + Fallback: Authenticates via
GET /v1/to-signin+POST /v1/auth/signin(__Http-typst-session), with persistent session caching and automatic cookie/Playwright fallback on challenge.Compiler Diagnostics, Preview Screenshots & PDF Export: Synchronizes cloud Yjs text and binary assets into an isolated workspace and runs the Typst compiler to return structured line/column diagnostics, high-DPI PNG preview screenshots (
typst_capture_screenshot), and compiled PDFs (typst_export_pdf).
Related MCP server: GoLatex MCP Server
Architecture
flowchart LR
Agent["AI Agent\n(Pi / Claude / Cursor)"] <-->|"JSON-RPC (stdio)"| MCP["typst-web-mcp\n(Bun / TypeScript)"]
MCP <-->|"GraphQL (/v1/graphql)\n+ X-Typst-Preflight"| API["https://api.typst.app"]
MCP <-->|"REST Yjs & Blobs\n(/v1/files/:pid/:fid/yjs)"| API
MCP <-->|"Binary lib0 WebSocket\n(wss://api.typst.app/editing/v3)"| WS["typst.app Real-Time Sync"]
MCP -->|"Workspace Sync + Compile"| TypstCLI["Typst Compiler\n(Diagnostics & PDF)"]See docs/PROTOCOL.md for the complete reverse-engineered protocol specification.
MCP Tools (16 Tools)
Category | Tool Name | Description |
Auth |
| Authenticate with |
Auth |
| Check active authentication state, login method, and stored session cookies. |
Projects |
| List all owned and shared/external projects in the user's |
Projects |
| Retrieve full project metadata, access permissions, pinned compiler version, and file tree ( |
Projects |
| Create a new |
Projects |
| Permanently delete a |
Files & CRDT |
| List all multiplayer Yjs text files and binary asset blobs in a project. |
Files & CRDT |
| Read any project file — decodes binary Yjs CRDT state ( |
Files & CRDT |
| Create or overwrite a |
Files & CRDT |
| Apply non-overlapping surgical |
Assets & Tree |
| Upload or replace binary assets ( |
Assets & Tree |
| Rename or move a file inside a |
Assets & Tree |
| Delete a file or binary asset from a project ( |
Compiler |
| Sync all cloud files and run |
Compiler |
| Sync all cloud text & binary assets, compile the project to PDF, and save to |
Preview |
| Capture high-DPI PNG preview screenshots ( |
Quick Start
Prerequisites
Installation
git clone https://github.com/caphefalumi/typst-web-mcp.git
cd typst-web-mcp
bun installMCP Client Configuration
Add typst-mcp to your MCP client configuration (.pi/agent/mcp-adapter.json, claude_desktop_config.json, or .cursor/mcp.json):
{
"mcpServers": {
"typst-mcp": {
"command": "bun",
"args": ["/absolute/path/to/typst-web-mcp/src/index.ts"],
"env": {
"TYPST_EMAIL": "your-email@example.com",
"TYPST_PASSWORD": "your-password"
}
}
}
}Session Persistence: Once authenticated via
typst_auth_login(or environment variables), the__Http-typst-sessioncookie is cached locally at~/.pi/agent/typst-mcp-session.jsonso subsequent tool calls authenticate automatically without re-signing in.
Development & Verification
# Typecheck with strict TypeScript
bun run typecheck
# Run full unit, mock server, and live api.typst.app protocol test suite
bun testProject Structure
typst-web-mcp/
├── docs/
│ └── PROTOCOL.md # Reverse-engineered typst.app REST, GraphQL, Yjs & WS v3 spec
├── src/
│ ├── protocol/
│ │ ├── ws-codec.ts # Binary lib0 /editing/v3 WebSocket encoder & decoder
│ │ ├── yjs-doc.ts # Yjs CRDT text decoding, replacement & surgical patching
│ │ └── graphql.ts # GraphQL queries, mutations, fragments & types
│ ├── client/
│ │ ├── auth.ts # Direct /v1/auth/signin login, cookie jar & Playwright fallback
│ │ └── typst-client.ts # TypstCloudClient (REST, GraphQL, WebSocket v3, Compiler)
│ └── index.ts # MCP stdio server entrypoint (16 tools)
├── test/
│ └── typst-mcp.test.ts # 7 test suites (57 assertions) covering codecs, CRDTs & E2E
├── LICENSE # MIT License
└── package.jsonLicense
Released under the MIT License. Copyright (c) 2026 Dang Duy Toan (caphefalumi).
This server cannot be deployed
Maintenance
Related MCP Connectors
Persistent cloud workspaces for AI agents: run commands, edit files, use git and a browser.
- OneLoreOAuthai.onelore
Shared project context for AI agents and teams: docs, tasks, and messages that stay current.
Deploy and manage Jade Hosting projects from AI clients. Jade account and OAuth required.
- AurentiaOAuthfr.aurentia
Your Aurentia workspace — projects, CRM, tasks, deliverables — in Claude, Cursor or any MCP client.
Related MCP Servers
- FlicenseBqualityCmaintenanceEnables AI agents to interact with Overleaf projects directly, including creating projects, managing files, and editing documents in real-time using Overleaf's native Operational Transformation protocol.10-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to read, write, and compile LaTeX projects locally, view PDF pages as images, and manage project files, with live updates reflected in a web-based editor.-
- AlicenseAqualityBmaintenanceEnables AI assistants to manage Typst and LaTeX projects on self-hosted Typleaf instances, including reading and editing documents, compiling to PDF, analyzing structure and page layout, checking citations, and reviewing git history.29MIT
- AlicenseAqualityBmaintenanceEnables AI agents to read, write, compile, and manage Overleaf projects through MCP, including file operations, project administration, and LaTeX compilation diagnostics.162 npmMIT