SuperAPI AI Directory

TexMCP

Render LaTeX, raw or from customizable templates, into PDF documents such as reports, resumes and research papers.

Open website

About this tool

TexMCP (repository name tex-mcp) is a small microservice based on FastMCP, used to render LaTeX into PDF. The server exposes its capabilities as MCP tools, can render raw LaTeX or templates, and produces artifacts (a .tex file, and a .pdf when compilable), with output located in the src/artifacts/ directory. The project is designed for local operation and can also be loaded by Claude Desktop through the Model Context Protocol, with the default entry file being run_server.py.

Main capabilities

  • Use pdflatex to render raw LaTeX into .tex, and generate .pdf as needed
  • Render Jinja2 templates and compile them into PDFs
  • Can run as an MCP server for Claude Desktop and other MCP-supporting clients

Tools exposed by this MCP server (5 total)

  • render_latex_document: Write LaTeX, and compile to PDF as needed
  • render_template_document: Render a Jinja2 template and compile as needed
  • list_templates: List available templates
  • list_artifacts: List files produced in src/artifacts/
  • get_template: Return the raw contents of a template file, making it easy for clients to inspect before rendering

Environment requirements

  • Python 3.10+ (the project uses a relatively new pydantic/fastapi tech stack)
  • LaTeX toolchain (pdflatex) for PDF compilation; this item is optional. If missing, the server returns only the .tex file

Getting started with local development

  • Create a project virtual environment and install dependencies
  • You can clone the repository from GitHub, then create a virtual environment and install following the steps below
  • Run the server directly (stdio mode, used by Claude Desktop): in stdio mode, the server communicates via MCP through stdin/stdout (this is exactly what Claude Desktop expects when starting the process). If you prefer HTTP, you can edit run_server.py and switch transport to http (seethe commented code), then run it with uv run or uvicorn

Rendering output is located in src/artifacts/. For each task, you should see a .tex file, and when pdflatex is available, the corresponding .pdf is generated.

Templates

  • Sample templates are located in src/mcp_server/templates/, containing 15 templates in total, such as sample_invoice.tex.j2, sample_letter.tex.j2, sample_resume.tex.j2. You can use list_templates to get the full list programmatically. The templates are intentionally kept simple and easy to customize; add your own .tex.j2 files to that directory to extend the catalog
  • Built-in templates (located in src/mcp_server/templates/): default.tex.j2 (basic example template), sample_invoice.tex.j2, sample_invoice2.tex.j2, sample_letter.tex.j2, sample_report.tex.j2, sample_resume.tex.j2, sample_presentation.tex.j2, sample_certificate.tex.j2, sample_coverletter.tex.j2, sample_poster.tex.j2, sample_thesis.tex.j2, sample_receipt.tex.j2, sample_recipe.tex.j2, sample_poem.tex.j2, sample_cv.tex.j2

Integration with Claude Desktop (quick)

  • It is recommended to use the fastmcp CLI installer, which sets it up to run from the project directory and use the project virtual environment. Run this installer in the project root directory (with the virtual environment created and dependencies installed) to ensure uv runs within the project directory and uses the project environment. After the installer runs, fully quit and restart Claude Desktop
  • Manually configure Claude Desktop: if you edit the Claude configuration yourself (Windows: %APPDATA%\Claude\claude_desktop_config.json),Add a server entry pointing to the project's Python executable. Example (replace paths as needed)
  • Do not point Claude at the virtual environment's activate script—it is a shell helper script, not an executable. Instead, point Claude at python.exe in the virtual environment (or, if uv is installed, uv.exe in the virtual environment)
  • After any configuration change, fully restart Claude Desktop

Docker

  • The project includes a Dockerfile and can run the MCP server in a container
  • Build (without LaTeX)
  • Build (with LaTeX, larger image)
  • Run (HTTP mode exposed on port 8000): the container defaults to MCP_TRANSPORT=http, and inside the container the server binds to 0.0.0.0:8000
  • If you want to run the server in stdio mode inside the container, you can override this environment variable

Artifact persistence

  • To persist rendered artifacts on the host machine, you can bind-mount the src/artifacts directory

Programmatic invocation

  • You can use the Model Context Protocol / FastMCP client libraries (such as the OpenAI Responses API) in agent code to invoke tools programmatically. For example, in Python you can use the mcp or fastmcp client (see the library documentation) to connect to http://localhost:8000/mcp,并以参数调用 render_latex_document

Security notes

  • If you expose the HTTP endpoint beyond localhost, protect it properly (TLS, firewall, or authentication)—rendering arbitrary LaTeX may pose risks (shell commands in templates, heavy resource consumption)

Contributing and License

  • See CONTRIBUTING.md for how to contribute, including the development workflow, commit style, and how to submit issues and pull requests
  • This project is released under the MIT License; see LICENSE for details

Note: Complete details about specific installation commands, fees and pricing, and usage steps are not fully provided in the official text and are therefore not provided here.