mcp-latex
Provides tools for checking LaTeX documents (static analysis for undefined references, duplicate/unused labels, unbalanced environments), parsing compiler logs, and compiling .tex files, enabling AI assistants to detect and fix LaTeX issues.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-latexCheck my thesis for undefined references and unbalanced environments."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Tools
Tool | Description |
| Static analysis: undefined refs, duplicate/unused labels, unbalanced environments; lists labels/refs/citations. No TeX needed. |
| Turns a |
| Compiles a |
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-latexLicense
MIT © Marcelo Domingues
Available Tools
3 toolscheck_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.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to a .tex file (used if source is omitted) | |
| source | No | LaTeX source to analyze |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the behavioral disclosure burden. It explicitly labels the operation as 'static analysis', signaling no side effects or compilation, and lists what it finds. It does not detail the exact output format or whether any files are written, but 'static analysis' strongly implies read-only behavior, which is adequately transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two concise sentences with no redundancy. It front-loads the core purpose ('static analysis of LaTeX source'), then efficiently enumerates specific findings and a key practical detail (no TeX install required). Every word earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose, capabilities, and operating constraints for a simple 2-parameter tool. It omits an explicit return format, but no output schema exists, and the listed outputs ('lists labels, references and citations') give adequate context for an agent to understand what to expect.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, with clear descriptions for both 'path' and 'source'. The tool description adds no extra details about parameter semantics or relationships beyond what the schema already provides, so the baseline score of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool performs static analysis of LaTeX source, listing specific checks (undefined references, duplicate/unused labels, unbalanced environments) and outputs (labels, references, citations). It distinguishes itself from siblings 'parse_log' and 'compile' by focusing on source analysis rather than log parsing or compilation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use the tool (for checking LaTeX source without compiling) and adds a useful constraint ('works without a TeX install'). However, it does not explicitly compare with sibling tools or state when not to use it, missing a stronger usage guideline.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to the .tex file to compile | |
| engine | No | Preferred engine (default latexmk) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It discloses fallback behavior (available:false) and error parsing, but omits potential file system side effects of compilation and any permission requirements.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with purpose, no wasted words. The description is concise yet informative.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and no annotations, the description covers core behavior and the no-engine fallback. The return value beyond 'parsed errors' is somewhat vague, but adequate for a straightforward compile tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so both parameters are already documented. The description adds no significant parameter semantics beyond what the schema provides; it merely references the engines already enumerated.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states the tool compiles .tex files with latexmk/pdflatex and returns parsed errors. It clearly distinguishes from sibling tools check_document and parse_log, which cover different stages.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies use for compiling TeX files and notes the conditional behavior based on engine availability, but does not explicitly state when to prefer this over siblings or when not to use it. Still, the context is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
parse_logParse LaTeX logA
Parses a LaTeX .log file into structured errors, warnings, undefined references/citations, and over/underfull box counts.
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to a .log file (used if logContent is omitted) | |
| logContent | No | Contents of a .log file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must carry the transparency burden. It clearly indicates a read-only parsing operation, which is safe and non-destructive. However, it does not disclose behavior for invalid input, missing files, or other edge cases, limiting transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, front-loaded sentence with no wasted words. It efficiently conveys the tool's action and expected outcomes.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple: two parameters, no output schema. The description covers the input source and the high-level result categories. It avoids detailing the exact output structure, which is acceptable for a parser, but it could mention error handling or prerequisites for full completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%—both parameters (path and logContent) have descriptions. The tool description adds no extra parameter-level meaning, so the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Parses a LaTeX .log file') and the specific outputs (errors, warnings, undefined references/citations, over/underfull box counts). This distinguishes it from sibling tools like compile (which builds documents) and check_document (which likely checks structure).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit when-to-use or alternatives are provided, but the purpose implies this should be used when you have a .log file and need structured diagnostics. The guidance is implied, not explicit, and there are no exclusions or prerequisites mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.0- First observed
check_document - First observed
compile - First observed
parse_log
TDQS
Scored across 3 tools
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.
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.
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.
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
Related MCP Connectors
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
An MCP server that integrates with Discord to provide AI-powered features.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that enables MCP clients to directly access and process arXiv papers by fetching the LaTeX source, improving mathematical content understanding.4145MIT
- AlicenseNot gradedqualityCmaintenanceA real-time MCP server that enables AI coding agents to read, write, and compile LaTeX projects in self-hosted Overleaf instances via native OT protocol.5 npm5AGPL 3.0
- AlicenseAqualityDmaintenanceAn MCP server that exposes LaTeX compilation, log parsing, dependency inspection, and citation checking as tools for AI agents, using latexmk under the hood.1111 npm1MIT
- AlicenseNot gradedqualityBmaintenanceAn 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.MIT