Provides LaTeX compilation services using various engines (pdflatex, xelatex, lualatex), manages templates, and offers pre-defined snippets for common LaTeX elements
LaTeX MCP Server
A Model Context Protocol (MCP) server for LaTeX compilation and document generation.
Features
- LaTeX Compilation: Compile LaTeX source to PDF using various engines (pdflatex, xelatex, lualatex)
- Template System: Manage reusable LaTeX templates
- Snippets/Macros: Use predefined LaTeX components (equations, figures, multiple choice questions, etc.)
- Automatic Cleanup: Old files are automatically cleaned up during compilation
- Caching: Compiled documents are cached to avoid recompilation
- Security: Dangerous LaTeX commands are blocked
MCP Tools
Core Tools
compile_latex
- Compile LaTeX source to PDFlist_templates
- List available LaTeX templatesget_template
- Get template source code
Snippets System
list_snippets
- List available LaTeX snippets/macrosget_snippet_info
- Get detailed info about a snippet including parametersrender_snippet
- Render a snippet with provided parameters
Available Snippets
- multiple_choice - Creates multiple choice questions with 4 options
- equation - Creates numbered equations with optional labels
- figure - Creates figures with captions and optional labels
Installation
Docker (Recommended)
- Build the image:
- Run the container:
Manual Installation
- Install system dependencies:
- Run the server:
Configuration
Set environment variables:
PORT
- Server port (default: 8080)LATEX_BASE_URL
- Base URL for compiled filesLATEX_MAX_FILE_AGE_HOURS
- File cleanup age in hours (default: 24)
Usage with Claude
Configure Claude Desktop to connect to your MCP server:
- URL:
https://your-domain.com/
- Transport: HTTP
API
The server exposes a Model Context Protocol interface on the configured port and path.
Security
- Dangerous LaTeX commands are blocked
- File system access is restricted
- No shell escapes allowed during compilation
- Automatic cleanup prevents disk space issues
Development
See the included configuration files:
docker-compose-standalone.yml
- Docker Compose setupmcp-latex.service
- Systemd servicenginx-include.conf
- Nginx configuration
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A server that enables compilation of LaTeX documents to PDF and management of reusable templates and snippets through the Model Context Protocol.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that provides tools for code modification and generation via Large Language Models, allowing users to create, modify, rewrite, and delete files using structured XML instructions.Last updated -121PythonMIT License
- -securityAlicense-qualityA server that provides document processing capabilities using the Model Context Protocol, allowing conversion of documents to markdown, extraction of tables, and processing of document images.Last updated -13PythonMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables LLMs to extract and use content from unstructured documents across a wide variety of file formats.Last updated -6Python
- AsecurityAlicenseAqualityA Model Context Protocol server that helps large language models process code repositories by providing file tree generation, code merging, and code analysis capabilities.Last updated -321JavaScriptMIT License