Skip to main content
Glama

mcp-latex

A Model Context Protocol (MCP) server for LaTeX. Give an AI assistant (Claude Desktop, Claude Code, Cursor…) the ability to check your LaTeX document, parse compiler logs, and compile — so it can actually fix your thesis or paper instead of guessing. Static analysis works with no TeX install required.

🌍 English · Português · 📚 Documentation

CI npm License: MIT MCP

Tools

Tool

Description

check_document

Static analysis: undefined refs, duplicate/unused labels, unbalanced environments; lists labels/refs/citations. No TeX needed.

parse_log

Turns a .log into structured errors, warnings, undefined refs/citations, over/underfull boxes.

compile

Compiles a .tex with latexmk/pdflatex if installed; returns parsed errors (graceful if no engine).

Related MCP server: Overleaf MCP

Use with Claude Desktop / Claude Code

{
  "mcpServers": {
    "latex": { "command": "npx", "args": ["-y", "mcp-latex"] }
  }
}

Then ask: "Check my thesis for undefined references and unbalanced environments," or "Compile main.tex and fix the first error."

Why

Writing a thesis in LaTeX means fighting cryptic compiler errors, dangling \refs and \begin/\end mismatches. An AI assistant is great at fixing these — if it can see the actual errors. This server gives it structured eyes on your document. Built from the pain of writing a real master's thesis.

Run locally

npm install
npm start          # stdio server
npm test           # unit + stdio integration tests
npm run build      # tsc -> dist/

Try it with the MCP Inspector:

npx @modelcontextprotocol/inspector npx -y mcp-latex

License

MIT © Marcelo Domingues

Available Tools

3 tools
check_documentCheck LaTeX documentA

Static analysis of LaTeX source: finds undefined references, duplicate/unused labels, and unbalanced environments. Lists labels, references and citations. Works without a TeX install.

Inputs: path, source.

compileCompile LaTeXA

Compiles a .tex file with latexmk/pdflatex if a TeX engine is installed, and returns parsed errors. Returns available:false with guidance if no engine is found.

Inputs: path (required), engine.

parse_logParse LaTeX logA

Parses a LaTeX .log file into structured errors, warnings, undefined references/citations, and over/underfull box counts.

Inputs: path, logContent.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 3 tools

    Disambiguation4/5

    The three tools are largely distinct: check_document performs static analysis, parse_log consumes a log file, and compile invokes an external engine. There is minor overlap in that both check_document and parse_log can report undefined references/citations, but the input source (source file vs. log file) clarifies the intended use.

    Naming Consistency4/5

    Two tools use the verb_noun pattern (check_document, parse_log), while compile uses a bare verb. This is a minor deviation from an otherwise consistent naming style, but the intent is still clear.

    Tool Count5/5

    With only 3 tools, the server is well-scoped for LaTeX document validation and compilation. Each tool serves a distinct and necessary function without redundancy or bloat.

    Completeness4/5

    The toolset covers the core workflow of checking source, compiling, and parsing logs. Minor gaps exist, such as no tool for cleaning auxiliary files or managing bibliographies, but these are not essential for the server's stated purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that exposes LaTeX compilation, log parsing, dependency inspection, and citation checking as tools for AI agents, using latexmk under the hood.
      11
      24 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that enables LLMs to compile LaTeX documents and inspect the resulting PDF, supporting an autonomous write-compile-check-revise loop via a self-hosted Overleaf CLSI instance.
      1
      MIT