# LaTeX SafeFix

> Safe, precise LaTeX editing and automated PDF compilation via MCP.

LaTeX SafeFix is a free AI agent skill on Agensi by Alex Chen, in APIs & Backend. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Alex Chen](https://www.agensi.io/creators/alex-chen)
- Category: [APIs & Backend](https://www.agensi.io/skills/apis-backend)
- Version: 1.0
- Last updated: 2026-11-22
- Security: scan passed (2026-11-22); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/latex-safefix
- Tags: api, documentation, latex, pdf-generation, tex-engine

## About this skill

LaTeX SafeFix helps an MCP-enabled assistant inspect, precisely edit, compile, and verify LaTeX projects.

- Scan source files and check citations, labels, and figure references.
- Preview an exact replacement as a diff, apply it after confirmation, and roll it back if the file has not changed.
- Diagnose build errors and missing or malformed image assets.
- Build with latexmk, verify PDF metadata, and render a selected page as a PNG for visual inspection.

Requires the separately installed and configured latex-workspace-mcp server, Node.js 20+, latexmk, a TeX engine, and Poppler tools. Windows users can run the server and dependencies in WSL. See [installation instructions and source](https://github.com/Alexchen93/latex-workspace-mcp).

Preview and rollback IDs are session-scoped. The server is not an OS sandbox; use OS isolation for untrusted TeX. MIT licensed.

## Requires

- Node.js
- Latex Workspace MCP
- latexmk and a TeX engine (pdflatex or xelatex)
- Poppler utilities and file

## Known limitations

Requires local installation of Node.js, latexmk, and Poppler. Edits are session-bound; file changes outside the agent invalidate pending edit IDs.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the LaTeX SafeFix skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does latex-safefix prevent the compilation errors that usually happen when an AI edits LaTeX?

Preview and confirmation help review exact edits before application. Build and log checks can reveal problems, but they cannot guarantee error-free LaTeX.

### What software do I need installed on my computer to use this skill?

Install Node.js 20+, the separately configured latex-workspace-mcp server, latexmk and a TeX engine, file, and Poppler utilities. On Windows, the documented setup uses WSL.

### Does this skill support specific engines like XeLaTeX or LuaLaTeX for custom fonts?

The build tools accept pdflatex and xelatex. LuaLaTeX is not currently exposed as a selectable engine.

### Can I see a preview of the document layout before I finalize my changes?

The renderer returns a PNG image of a selected page from a previously compiled PDF. Viewing it requires an MCP client that supports image content.

### What safety measures are in place to ensure the AI doesn't break my multi-file project structure?

Previewed edits require confirmation and are rejected if the file changed since the preview. Rollback IDs are session-scoped; use version control or backups as well.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
