Skip to main content
Glama

LaTeX MCP Server

A small Model Context Protocol server that compiles LaTeX documents and serves the resulting PDFs. It also exposes a handful of document templates and reusable snippets.

The project is usable but lightly maintained: I am not currently developing new features for it.

Tools

  • compile_latex compiles a complete document with pdfLaTeX, XeLaTeX or LuaLaTeX.

  • list_templates and get_template expose the bundled document templates.

  • list_snippets, get_snippet_info and render_snippet work with the bundled equation, figure and multiple-choice snippets.

Compiled files are cached by source and engine, then removed after a configurable period.

Related MCP server: PDF Processor MCP Server

Run with Docker

Build from the repository root:

docker build -f deployment/docker/Dockerfile -t latex-mcp .
docker run --rm -p 8083:8080 latex-mcp

The MCP HTTP endpoint is then available at http://localhost:8083/mcp.

Docker Compose configuration is under deployment/docker/:

docker compose -f deployment/docker/docker-compose.yml up --build

Run directly

This requires Python 3.11+ and a TeX distribution providing pdflatex, xelatex or lualatex.

python -m pip install .
python server.py

Configuration is available through three environment variables:

  • PORT — HTTP port, defaulting to 8080.

  • LATEX_BASE_URL — public base URL used in PDF and log links.

  • LATEX_MAX_FILE_AGE_HOURS — compiled-file retention, defaulting to 24 hours.

Security boundary

LaTeX is a programmable language, and rejecting a short list of commands does not make arbitrary documents safe. Shell escape is disabled and the server performs some basic source validation, but this is not a hardened multi-tenant sandbox.

Use it with trusted inputs, preferably inside a disposable container with no secrets, restricted resources and no unnecessary network or filesystem access. Do not expose the HTTP service publicly without adding authentication and further isolation.

Maintained alternatives

If this server no longer fits your workflow, these more active projects cover adjacent use cases:

  • mcp-latex-server — LaTeX file creation, editing and project management.

  • latex-mcp — LaTeX compilation inside Docker.

  • texflow-mcp — structured document authoring with an MCP compiler.

Development

python -m pip install -e ".[dev]"
pytest

Deployment examples for Docker, systemd and Nginx live under deployment/.

Licence

MIT

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TheTailorRetailored/latex-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server