Skip to main content
Glama

LaTeX MCP Server

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 PDF
  • list_templates - List available LaTeX templates
  • get_template - Get template source code

Snippets System

  • list_snippets - List available LaTeX snippets/macros
  • get_snippet_info - Get detailed info about a snippet including parameters
  • render_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

  1. Build the image:
docker build -f Dockerfile.simple -t mcp-latex-simple .
  1. Run the container:
docker run -d --name mcp-latex-server --restart unless-stopped -p 8083:8080 mcp-latex-simple

Manual Installation

  1. Install system dependencies:
# Install LaTeX sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-latex-extra # Install Python dependencies pip install fastmcp jinja2 pydantic pyyaml uvicorn
  1. Run the server:
python server.py

Configuration

Set environment variables:

  • PORT - Server port (default: 8080)
  • LATEX_BASE_URL - Base URL for compiled files
  • LATEX_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 setup
  • mcp-latex.service - Systemd service
  • nginx-include.conf - Nginx configuration
-
security - not tested
F
license - not found
-
quality - not tested

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.

  1. Features
    1. MCP Tools
      1. Core Tools
      2. Snippets System
    2. Available Snippets
      1. Installation
        1. Docker (Recommended)
        2. Manual Installation
      2. Configuration
        1. Usage with Claude
          1. API
            1. Security
              1. Development

                Related MCP Servers

                • A
                  security
                  A
                  license
                  A
                  quality
                  A 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 -
                  12
                  1
                  Python
                  MIT License
                  • Linux
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A 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 -
                  13
                  Python
                  MIT License
                  • Linux
                  • Apple
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that enables LLMs to extract and use content from unstructured documents across a wide variety of file formats.
                  Last updated -
                  6
                  Python
                  • Apple
                • A
                  security
                  A
                  license
                  A
                  quality
                  A 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 -
                  3
                  21
                  JavaScript
                  MIT License

                View all related MCP servers

                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/LachlanBridges/latex-mcp'

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