typst-mcp

MCP.Pizza Chef: johannesbrandenburger

Eight tools are registered, not the five the readme numbers: browse and fetch chapters of the Typst manual, turn LaTeX into Typst one piece or many at a time, test whether a piece of Typst is valid, and render a preview picture of how it looks. That last tool is really called typst_snippet_to_image, not the shorter name the readme prints. Nothing is saved on your behalf; the preview is built in a temporary folder and handed back as a picture.

Coding
Files/PDF
Writing

Use This MCP server To

Convert my LaTeX formulas into Typst without redoing them Look up how to build a table in Typst Check that a piece of Typst is valid before using it See a preview picture of what my Typst code produces Get a working Typst layout for a two-column page

README

Typst MCP Server

Typst MCP Server is an MCP (Model Context Protocol) implementation that helps AI models interact with Typst, a markup-based typesetting system. The server provides tools for converting between LaTeX and Typst, validating Typst syntax, and generating images from Typst code.

Available Tools

⚠️ Currently all the functionality is implemented as tools, because Cursor and VS Code are not able to handle the other primitives yet.

The server provides the following tools:

  1. list_docs_chapters(): Lists all chapters in the Typst documentation.

    • Lets the LLM get an overview of the documentation and select a chapter to read.
    • The LLM should select the relevant chapter to read based on the task at hand.
  2. get_docs_chapter(route): Retrieves a specific chapter from the Typst documentation.

    • Based on the chapter selected by the LLM, this tool retrieves the content of the chapter.
    • Also available as get_docs_chapters(routes: list) for retrieving multiple chapters at once.
  3. latex_snippet_to_typst(latex_snippet): Converts LaTeX code to Typst using Pandoc.

    • LLMs are better at writing LaTeX than Typst, so this tool helps convert LaTeX code to Typst.
    • Also available as latex_snippets_to_typst(latex_snippets: list) for converting multiple LaTeX snippets at once.
  4. check_if_snippet_is_valid_typst_syntax(typst_snippet): Validates Typst code.

    • Before sending Typst code to the user, the LLM should check if the code is valid.
    • Also available as check_if_snippets_are_valid_typst_syntax(typst_snippets: list) for validating multiple Typst snippets at once.
  5. typst_to_image(typst_snippet): Renders Typst code to a PNG image.

    • Before sending complex Typst illustrations to the user, the LLM should render the code to an image and check if it looks correct.
    • Only relevant for multi modal models.

Getting Started

  • Clone this repository

    • git clone https://github.com/johannesbrandenburger/typst-mcp.git
  • Clone the typst repository

    • git clone https://github.com/typst/typst.git
  • Run the docs generation in the typst repository

    • cargo run --package typst-docs -- --assets-dir ../typst-mcp/typst-docs --out-file ../typst-mcp/typst-docs/main.json
      • Make sure to adjust the path to your local clone of the typst-mcp repository
      • This will generate the main.json and the assets in the typst-docs folder
  • Install required dependencies: uv sync (install uv if not already installed)

  • Install Typst

Running the Server

typst-mcp FAQ

Do I need an account or a key?
No, and there is nothing to pay. Everything runs on your own machine.
Will it hand me a finished PDF?
No. It builds a preview picture in a temporary folder and returns that. Producing the final document file is still your step.
How many tools are there really?
Eight. The readme numbers five because three of them are batch versions that take a list instead of a single item.
How hard is the setup?
This one is for the technically confident. The published container image is the realistic route. Installing by hand means cloning the Typst source and building its manual with the Rust toolchain first, because that file is not included in this project.
Which apps does it work in?
Claude Desktop, Claude Code, Cursor, VS Code agent mode, Roo Code and OpenCode each get their own config example.
Can I use this to convert an existing LaTeX document?
Yes, although it is aimed at snippets. Longer documents get converted piece by piece, using Pandoc underneath.
Is the manual lookup dependable?
The author warns that the format of the Typst manual it reads is not stable and can break whenever Typst changes.