Skip to main content

LaTeX document compiler with MCP interface

Project description

TeXFlow MCP

License PyPI Python

A LaTeX document compiler with an MCP interface. AI agents operate on a structured document model — sections, paragraphs, figures, tables — while TeXFlow handles all LaTeX mechanics: packages, preamble, fonts, and compilation.

Install

pip install texflow-mcp

Or run without installing:

uvx texflow-mcp

System dependencies (optional)

TeXFlow compiles documents to PDF using XeLaTeX. Without it, you can still build and export .tex files.

# Arch
pacman -S texlive-xetex texlive-fontsrecommended texlive-fontsextra

# Debian/Ubuntu
apt install texlive-xetex texlive-fonts-recommended texlive-fonts-extra

# Fedora
dnf install texlive-xetex texlive-collection-fontsrecommended texlive-collection-fontsextra

For page preview (PNG), install poppler-utils (provides pdftoppm).

Configure with Claude Code

claude mcp add texflow -- uvx texflow-mcp

That's it. Restart Claude Code and the tools are available.

To set a workspace directory (where documents are saved):

claude mcp add texflow -- uvx texflow-mcp ~/Documents/TeXFlow

Configure with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "texflow": {
      "command": "uvx",
      "args": ["texflow-mcp"]
    }
  }
}

How it works

TeXFlow has two entry flows, both converging on the same in-memory document model:

  1. Scaffolddocument(action="create") builds an empty document skeleton. Add content with edit(action="insert").
  2. Markdown ingestdocument(action="ingest", source="paper.md") parses markdown into the model. Refine layout from there.

The model auto-saves to disk as JSON. LaTeX is only ever an output artifact — you never edit .tex directly.

Tools

Tool Purpose
document Create, ingest markdown, show outline, read sections
layout Columns, fonts, paper, margins, headers/footers, TOC
edit Insert, replace, delete, move blocks (section, paragraph, figure, table, code, equation, list, raw)
render Compile to PDF, preview page as PNG, export .tex
reference Search LaTeX commands, symbols, packages, error help
queue Batch multiple operations in one call

Every response includes a workflow state hint showing where you are and what to do next.

Example session

> document(action="create", title="My Paper", document_class="article")

> queue(operations=[
    {"tool": "edit", "action": "insert", "block_type": "section", "title": "Introduction", "level": 1},
    {"tool": "edit", "action": "insert", "content": "This paper explores...", "section": "Introduction"},
    {"tool": "edit", "action": "insert", "block_type": "section", "title": "Methods", "level": 1},
    {"tool": "layout", "font": "palatino", "columns": 2}
  ])

> render(action="compile")

Development

git clone https://github.com/aaronsb/texflow-mcp
cd texflow-mcp
uv sync
uv run pytest tests/ -v    # 222 tests
uv run texflow              # Start MCP server

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

texflow_mcp-1.6.0.tar.gz (96.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

texflow_mcp-1.6.0-py3-none-any.whl (93.9 kB view details)

Uploaded Python 3

File details

Details for the file texflow_mcp-1.6.0.tar.gz.

File metadata

  • Download URL: texflow_mcp-1.6.0.tar.gz
  • Upload date:
  • Size: 96.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for texflow_mcp-1.6.0.tar.gz
Algorithm Hash digest
SHA256 1fb902b98383f43ff76a21f0ca2bfbcbac9fb0998605765bd920427b7a6f0f3c
MD5 b9ed5f0a085b890b0ceab06174c390b3
BLAKE2b-256 2c8a2e898f7d30cbb27f7a99bc84cb76ac6f60596b332ab100b2164c1413c2b7

See more details on using hashes here.

File details

Details for the file texflow_mcp-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: texflow_mcp-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 93.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for texflow_mcp-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81ac06f7dc8b34157d53877d2d1e4dafebc40f15fba8e63cadbd375fd9682d12
MD5 44ece86b3535e58814e5b4dea7a49017
BLAKE2b-256 0d397d4b178435bd26e73c8c177ef095ffb2a6df59224a5fbd54bcb01b52eabc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page