JT

johannesbrandenburger/typst-mcp

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

186 stars 20 forks Качество 67 Тренд 17MIT

johannesbrandenburger/typst-mcp — это кандидат на сервер MCP, импортированный из https://github.com/johannesbrandenburger/typst-mcp.

Обзор

johannesbrandenburger/typst-mcp — это кандидат на сервер MCP, импортированный из https://github.com/johannesbrandenburger/typst-mcp.

Обзор (машинный перевод)

Typst MCP Server — это реализация MCP (Model Context Protocol), которая помогает моделям ИИ взаимодействовать с Typst, системой набора на основе разметки. Сервер предоставляет инструменты для конвертации между LaTeX и Typst, проверки синтаксиса Typst и генерации изображений из кода Typst.

Доступные инструменты

⚠️ В настоящее время вся функциональность реализована как tools, потому что Cursor и VS Code пока не могут обрабатывать другие примитивы.

Сервер предоставляет следующие инструменты:

  1. list_docs_chapters(): Перечисляет все главы в документации Typst.
  • Позволяет LLM получить обзор документации и выбрать главу для прочтения.
  • LLM должен выбрать соответствующую главу для чтения в зависимости от поставленной задачи.
  1. get_docs_chapter(route): Получает конкретную главу из документации Typst.
  • На основе главы, выбранной LLM, этот инструмент получает содержание главы.
  • Также доступно как get_docs_chapters(routes: list) для одновременного извлечения нескольких глав.
  1. latex_snippet_to_typst(latex_snippet): Преобразует код LaTeX в Typst с помощью Pandoc.
  • LLM лучше пишут LaTeX, чем Typst, поэтому этот инструмент помогает преобразовать код LaTeX в Typst.

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального 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

Local Installation

Execute the server script:

python server.py

Or install it in Claude Desktop with MCP:

mcp install server.py

Or use the new agent mode in VS Code:

Открыть полный README на GitHub

Установка

docker run --rm -i ghcr.io/johannesbrandenburger/typst-mcp:latest
Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "typst": { "command": "docker", "args": [ "run", "--rm", "-i", "ghcr.io/johannesbrandenburger/typst-mcp:latest" ] } } }