Blog
hedwigaihedwigaihedwigai

Writing

A LaTeX MCP server: compile, fix and check a paper without leaving your agent

Most papers written with an AI today make the same round trip. The agent drafts LaTeX, you paste it into an editor that compiles, the compile fails, and you paste the error back. People describe chat tools that leave you to paste it somewhere and hope it builds, and the setups that avoid it ask you to install a full TeX distribution on your own machine first.

hedwigai’s MCP server now has a tool, render_document, that compiles where the agent already is. The agent sends its LaTeX, with the .bib and any chapters and figures; real TeX compiles it; and the agent gets back either a link to the PDF or the line that failed, which it fixes before it calls again. It also takes Typst and Markdown. Compiling is free.

The top of an IEEE conference paper compiled by render_document: title, author, abstract, a numbered equation, a booktabs table and a formatted reference.
An IEEEtran paper and its BibTeX file, compiled by render_document on 15 October 2026: the class’s own layout, a numbered equation with a working reference, and the bibliography built.

What the agent does

  1. Writes the paper, or edits the one you gave it.
  2. Calls render_document with the main .tex, and the rest of the project as files: the .bib, chapters, a class file, figures.
  3. Reads what comes back. A failure is the compiler’s own account of it, cut to the line that broke; on our test paper, sent first without its bibliography, that was main.bbl:24: LaTeX Error: Something’s wrong--perhaps a missing \item.
  4. Fixes the source and calls again, until it compiles.
  5. Hands you a link to the PDF, kept in your own storage for about six days.

The compiler is Tectonic 0.17, released in July 2026: XeTeX and TeX Live packages underneath, so a journal’s class file sets the page as it would on the author’s machine, and BibTeX runs as often as the document needs. Packages are kept warm on the server; the first compile of a rarely used one can take a minute while it is fetched.

How it compares

Overleaf is still the place to write a paper with co-authors: live editing, track changes and full history are what it is for, and none of that is here. What changes is who compiles. Overleaf’s free plan cut its compile limit to 10 seconds in 2025, a thesis or a figure-heavy paper can run past that, and its API does not compile for an agent. OpenAI’s Prism is a whole editor, but one you work in, not a tool your own agent can call.

Ways to get from LaTeX to a PDF with an AI, read 15 October 2026
OptionWhere you writeWho fixes a failed compileCompile limitTo installWorking togetherPrice
render_document (hedwigai)In your agent: Claude Code, Claude, Codex, Cursor, Hermes, any MCP clientThe agent reads the failing line and fixes it4 minutesNone: one URLShare the PDF link; no co-editingFree to compile
Overleaf FreeOverleaf's web editorYou, with 5 AI uses a day10 secondsNone1 collaborator a project$0
Overleaf StandardOverleaf's web editorYou, with the AI assistant, 10 uses a day4 minutesNone10 collaborators, track changes, Git$25 a month or $199 a year
OpenAI PrismPrism's web editor, inside ChatGPTIts built-in AINot publishedNoneUnlimited collaboratorsFree with a ChatGPT account at launch
Local LaTeX or Overleaf MCP serversIn your agent, on your machineThe agent, once you wire up the loopYour machine'sA TeX distribution and latexmk, or Tectonic; Overleaf ones need a Git token (paid plans)Through Overleaf or GitFree, plus your setup

Overleaf from its plans page and AI features (prices in US dollars; they differ by country). Prism from its launch coverage in January 2026 (Hacker News); check OpenAI for its current terms. Local servers such as OverleafMCP and WebLatexMCP run on your own machine.

What it does not do

  • No live co-editing, track changes or history: share the PDF, or keep the source in Git or Overleaf.
  • No shell escape, so minted does not run; listings does the same job. It stays off because a document must not run commands on our servers; Overleaf allows it inside its own sandbox, so minted works there.
  • BibTeX, not biber: a biblatex document with the biber backend needs switching to BibTeX.
  • No LuaLaTeX: the engine is XeTeX, which compiles pdfLaTeX and XeLaTeX documents.
  • The package set is TeX Live 2022’s, older than Overleaf’s default; almost every paper is unaffected.

Then check what it cites

A paper that compiles can still cite a work that does not exist, or a real one for a claim it does not make. The same server checks both: every entry looked up in Crossref and OpenAlex, and each sentence that cites one read against what was found. They are the checks behind the free reference checker and claim checker; from your agent they run on the draft it just compiled. Those checks, and research with a source for every claim, are what hedwigai’s prepaid credits pay for.

Connect it

One URL, in whichever agent you write with. A new account starts with $1 of credit and no card.

Claude Code, then type /mcp, choose hedwigai and Authenticate:

claude mcp add --transport http --scope user hedwigai https://mcp.hedwigai.com

Codex:

codex mcp add hedwigai --url https://mcp.hedwigai.com
codex mcp login hedwigai

Hermes Agent, in ~/.hermes/config.yaml, then hermes mcp login hedwigai (Hermes’s MCP docs):

mcp_servers:
  hedwigai:
    url: "https://mcp.hedwigai.com"
    auth: oauth

Claude on the web or desktop: Settings, Connectors, Add custom connector, and paste https://mcp.hedwigai.com. Cursor: add it under mcpServers in ~/.cursor/mcp.json and click Connect.

Then ask your agent to write the paper, compile it, and send you the PDF.

More head-to-head evals

Ten models plan a change to a spreadsheet: which do it in under a minute, traced call by callTen models drive one agent harness through the same spreadsheet request; six write the plan, timed and traced call by call.
MeasureQwen3 235BGLM-5.2Gemini 3.8 FlashClaude Opus 5
Seconds to the plan, median27485794
Plans written, of three runs2333
Read the comparison
SubQ, jev, Perplexity's Decider and Bespoke's Nimble on biotech diligence memos: finding the sentences a column is aboutFour decision models judge every sentence of ten biotech diligence memos for five columns, scored against sentences a person marked.
MeasureSubQjevDeciderNimble
Found, mean of five columns at section length64%65%66%68%
Mechanism of action, found at section length57%51%61%54%
Read the comparison
Leads with a reason to write: hedwigai ask, Apollo and treg on one brief40 leads each, every one checked: the right person, an inbox that accepts, and a dated reason to write.
MeasureaskApollotreg
Usable leads13 of 407 of 406 of 28
Cost per usable lead$0.037$0.27$0.23
Read the comparison
Self-hosted decisions for ask: Perplexity's open Decider in place of jev on 92 company questionsThe decisions inside hedwigai ask made by Perplexity's open Decider on two NVIDIA RTX 3090s, against jev.
Measureask with jevask with Decider
Questions right, of 928989
Wrong answers12
Read the comparison
Clinical decisions: jev and ask on System One, PubMedQA, SciFact and a 370-decision setEdgeEvals' System One board, PubMedQA, SciFact, and a clinical set built to System One's rules.
Measurejevask
Our 370 clinical decisions, right94.6%93.0%
PubMedQA, right (best EdgeEvals scored: 62.2%)77.0%74.4%
Read the comparison
Executive lookup for US-listed companies: Claude Opus 5.5 and ask on 95 questionsWho runs a public company, and how to email them: a frontier model from memory against hedwigai ask.
MeasureaskClaude Opus 5.5
Questions right, of 955963
Small companies right, of 20139
Read the comparison
Rental comps: floor-plan rents and amenities on 14 listings, five assistants comparedRent per floor plan and amenities for US rentals: hedwigai realestate-us against Claude, GPT, Gemini and Perplexity with web search.
Measurerealestate-usBest of four assistants
Floor-plan rents right, of 262623
Amenities claimed the listing doesn't state12129
Read the comparison
Company screening from SEC filings: jev, Vela 2.0 and ask on 92 yes/no questionsYes-or-no questions about public companies, answered by two decision models alone and by hedwigai ask.
Measureaskjev
Right, of the questions answered98%79%
Wrong answers, of 92219
Read the comparison
Defect localization in industrial images: four frontier models and a trained localizerFour frontier models asked to put a box around what they just described.
MeasureTrained localiserBest of four frontier models
Mean overlap with the defect (IoU, 0 to 1)0.4210.109
Read the comparison