nantex v0.1.5
Python ≥ 3.11 MIT MCP server

LaTeX live preview in your browser. No LaTeX install.

Write .tex, save, see the PDF. nantex watches your file, compiles it remotely, and refreshes the browser for you. One command, no toolchain.

$ uvx nantex main.tex
View on PyPI
main.tex · localhost:7474
Compiled in 1.8s pdflatex
\documentclass{article}
\usepackage{amsmath}
\title{Maxwell's Equations}
\begin{document}
\maketitle

In differential form:
\begin{align}
  \nabla \cdot \mathbf{E} &= \frac{\rho}{\varepsilon_0} \\
  \nabla \cdot \mathbf{B} &= 0 \\
  \nabla \times \mathbf{E} &= -\frac{\partial \mathbf{B}}{\partial t}
\end{align}

\input{sections/discussion}
\end{document}
How it works

Three moving parts. None of them are a TeX distribution.

01

Watch

A file watcher tracks your root .tex and every \input{} / \include{} it discovers. A fast local lint runs before each compile — unclosed environments, missing files, stray braces.

02

Compile

Sources are bundled and posted to a latex-on-http endpoint — public by default, or your own with --api. pdflatex, xelatex or lualatex.

03

Serve

The PDF is written atomically and served on localhost:7474. Server-Sent Events push a reload to the browser the moment a build finishes — or surface the error inline.

Install

Zero-install with uvx, or keep it on your path.

Requires Python 3.11+. That's the whole dependency list — no TeX Live, no MacTeX, no 4 GB download.

uvx nantex main.tex

Runs the latest release in an isolated env. Nothing installed permanently.

Usage

Every flag.

Persist any of these in a .nantex.toml next to your project; CLI flags always win.

FlagDefaultDescription
--compilerpdflatexLaTeX compiler: pdflatex, xelatex, lualatex
--apihttps://latex.ytotech.com/builds/syncCompile API endpoint — point at a self-hosted latex-on-http
--output<file>.pdfOutput PDF path
--port7474Preview server port
--onceoffCompile once and exit
--shareoffPrint a LAN URL so collaborators can open the preview
--snippetoffCompile a label (fig:x) or line range (10-25) in isolation
--mcpoffRun as an MCP server for AI agents
--version—Print the installed version and exit
For AI agents

Let your agent compile LaTeX.

nantex --mcp runs a Model Context Protocol server that exposes two tools. Claude Code, Cursor or any MCP client can write a document, compile it, and read back structured errors — no shell juggling.

compile_latexcontent, compiler, api_url → success, pdf_path, errors
get_compile_statusstate of the last compile
.mcp.json
{
  "mcpServers": {
    "nantex": {
      "command": "uvx",
      "args": ["nantex", "--mcp"]
    }
  }
}
Examples

Ready-to-run .tex files.

Clone the repo and point nantex at any of them.

nantex examples/01-hello-world.texminimal quickstart
nantex examples/02-math.texequations, Maxwell's laws, matrices
nantex examples/03-resume.texCV / resume template
nantex examples/04-report.textable of contents + tables