KosmoKrator

rendering

Typst MCP Integration for Vercel AI SDK

Connect Typst to Vercel AI SDK through the local KosmoKrator MCP gateway with scoped tools, credentials, and write policy.

1 functions 0 read 1 write No credentials auth

Connect Typst to Vercel AI SDK

Use KosmoKrator as a local integration gateway for Vercel AI SDK agents and scripts.

Create an MCP client that starts or connects to the KosmoKrator gateway for the selected integration. The gateway is local, scoped to this integration, and starts with --write=deny so Vercel AI SDK can inspect read-capable tools without receiving write access by default.

Typst MCP Config for Vercel AI SDK

Prefer CLI JSON calls when a workflow only needs one deterministic integration operation.

{
  "mcpServers": {
    "kosmokrator-typst": {
      "type": "stdio",
      "command": "kosmo",
      "args": [
        "mcp:serve",
        "--integration=typst",
        "--write=deny"
      ]
    }
  }
}

Run the Gateway Manually

kosmokrator mcp:serve --integration=typst --write=deny

Why Use KosmoKrator Here

Scoped tools

Expose only Typst instead of a broad multi-service tool list.

Local credentials

Reuse credentials already configured for the KosmoKrator CLI and Lua runtime.

Write policy

Start read-only, then opt into ask or allow for trusted workspaces.

Typst Tools Visible to Vercel AI SDK

Vercel AI SDK sees stable MCP tool names generated from the Typst integration catalog.

MCP toolSource functionTypeDescription
integration__typst__render_typst typst.render_typst Write Render a Typst document to PDF. Pass valid Typst markup and get back a downloadable PDF link. Use this tool to generate formatted documents: reports, invoices, proposals, summaries, letters, tables, and more. Example markup: ``` #set page(margin: 2cm) #set text(size: 11pt) = Quarterly Report == Summary Revenue increased by *15%* compared to last quarter. #table( columns: (1fr, 1fr, 1fr), [*Metric*], [*Q1*], [*Q2*], [Revenue], [$1.2M], [$1.38M], [Users], [12,000], [15,400], ) ``` Key Typst syntax: - `= Heading` for headings (`==` for h2, `===` for h3) - `*bold*` for bold, `_italic_` for italic - `#table(columns: ..., [...], [...])` for tables - `#set page(margin: 2cm)` for page settings - `#set text(size: 12pt, font: "...")` for text settings - `- item` for bullet lists, `+ item` for numbered lists - `#line(length: 100%)` for horizontal rules - `#align(center)[...]` for alignment - `#v(1em)` for vertical spacing

Related Typst Pages