A small FastMCP-based Microservice that renders LaTeX to PDF. The server exposes MCP tools to render raw LaTeX or templates and produces artifacts (a .tex file and .pdf) under src/artifacts/. This repository is prepared to run locally and to be loaded by Claude Desktop (via the Model Context Protocol). The default entrypoint is runserver.py. - Render raw LaTeX to .tex and (optionally) .pdf using p
Add this skill
npx mdskills install devroopsaha744/texmcpWell-documented MCP server with 5 useful LaTeX tools, comprehensive setup, and 15 templates
1[](https://mseep.ai/app/devroopsaha744-texmcp)23# FastMCP LaTeX Server (tex-mcp)45A small FastMCP-based Microservice that renders LaTeX to PDF. The server exposes MCP tools6to render raw LaTeX or templates and produces artifacts (a .tex file and .pdf)7under `src/artifacts/`.89This repository is prepared to run locally and to be loaded by Claude Desktop (via the10Model Context Protocol). The default entrypoint is `run_server.py`.1112## Demo13141516---1718## Quick features19- Render raw LaTeX to `.tex` and (optionally) `.pdf` using pdflatex20- Render Jinja2 templates and compile to PDF21- Designed to run as an MCP server for Claude Desktop and other MCP-capable clients2223Tools exposed by this MCP server24- Total tools: 525 - render_latex_document — write LaTeX and optionally compile to PDF26 - render_template_document — render a Jinja2 template and optionally compile27 - list_templates — list available templates28 - list_artifacts — list files produced in `src/artifacts/`29 - get_template — return the raw contents of a template file so clients can inspect it before rendering30---3132## Getting started (local development)3334Prerequisites35- Python 3.10+ (the project uses modern pydantic/fastapi stack)36- LaTeX toolchain (pdflatex) for PDF compilation (optional; if missing, server returns .tex only)37381) Create a project virtualenv and install deps3940Clone from GitHub4142If you want to work from the canonical repository on GitHub, clone it first:4344```powershell45git clone https://github.com/devroopsaha744/TexMCP.git46cd TexMCP47```4849After cloning you can follow the venv creation and install steps below.505152```powershell53python -m venv .venv54. .\\.venv\\Scripts\\Activate.ps155python -m pip install --upgrade pip56pip install -r requirements.txt57```58592) Run the server directly (stdio mode - used by Claude Desktop)6061```powershell62. .\\.venv\\Scripts\\Activate.ps163python .\\run_server.py64# or run the venv python explicitly if you don't activate65.# .venv\\Scripts\\python.exe run_server.py66```6768If run in stdio mode the server will speak MCP over stdin/stdout (this is what Claude Desktop69expects when it spawns the process). If you prefer HTTP, edit `run_server.py` and switch the70transport to `http` (see commented code) and run via `uv run` or `uvicorn`.71723) Artifacts7374Rendered outputs are placed in `src/artifacts/`. For each job you should see a `.tex` file and75— if `pdflatex` is available — a matching `.pdf`.7677Templates78 - Several example templates live in `src/mcp_server/templates/`. There are 15 templates included (for example `sample_invoice.tex.j2`, `sample_letter.tex.j2`, `sample_resume.tex.j2`). Use `list_templates` to get the full list programmatically. The templates are deliberately simple and ready to customize — add your own `.tex.j2` files to that folder to expand the catalog.7980Included templates (in `src/mcp_server/templates/`)8182- `default.tex.j2` (base example template)83- `sample_invoice.tex.j2`84- `sample_invoice2.tex.j2`85- `sample_letter.tex.j2`86- `sample_report.tex.j2`87- `sample_resume.tex.j2`88- `sample_presentation.tex.j2`89- `sample_certificate.tex.j2`90- `sample_coverletter.tex.j2`91- `sample_poster.tex.j2`92- `sample_thesis.tex.j2`93- `sample_receipt.tex.j2`94- `sample_recipe.tex.j2`95- `sample_poem.tex.j2`96- `sample_cv.tex.j2`9798---99100## Integration with Claude Desktop (quick)101102Recommended: use the `fastmcp` CLI installer which will set things up to run from the project directory and use the project venv.103104From your project root (with the venv already created and deps installed):105106```powershell107fastmcp install claude-desktop run_server.py --project C:\\Users\\DEVROOP\\Desktop\\tex-mcp108```109110This ensures `uv` runs inside the project directory and uses the project's environment. After the installer runs, fully quit and restart Claude Desktop.111112Manual Claude Desktop config113If you edit Claude's config yourself (Windows: `%APPDATA%\\Claude\\claude_desktop_config.json`), add a single server entry that points to the project Python executable. Example (replace paths if needed):114115```json116{117 "mcpServers": {118 "FastMCP-LaTeX-Server": {119 "command": "C:\\\\Users\\\\DEVROOP\\\\Desktop\\\\tex-mcp\\\\venv\\\\Scripts\\\\python.exe",120 "args": [121 "C:\\\\Users\\\\DEVROOP\\\\Desktop\\\\tex-mcp\\\\run_server.py"122 ],123 "cwd": "C:\\\\Users\\\\DEVROOP\\\\Desktop\\\\tex-mcp",124 "transport": "stdio"125 }126 }127}128```129130Notes131- Do NOT point Claude at the virtualenv `activate` script — it is a shell helper and not an executable. Point Claude to the `python.exe` inside the venv (or to `uv.exe` inside the venv if you installed `uv`).132- After any config changes, fully restart Claude Desktop.133134---135136## Docker137138This project includes a Dockerfile so you can run the MCP server in a container.139140Build (no LaTeX):141142```bash143docker build -t fastmcp-latex:latest .144```145146Build with LaTeX (larger image):147148```bash149docker build --build-arg INSTALL_TEX=1 -t fastmcp-latex:with-tex .150```151152Run (HTTP mode exposed on port 8000):153154```bash155docker run -p 8000:8000 --rm --name fastmcp-latex fastmcp-latex:latest156```157158Notes159- The container sets `MCP_TRANSPORT=http` by default. Inside the container the server binds to `0.0.0.0:8000`.160- If you want to run the server in `stdio` mode in a container you can override the env var:161162```bash163docker run -e MCP_TRANSPORT=stdio ...164```165166Artifact persistence167- To persist rendered artifacts on the host, bind mount the `src/artifacts` directory:168169```bash170docker run -p 8000:8000 -v $(pwd)/src/artifacts:/app/src/artifacts fastmcp-latex:latest171```172173---174175You can Use a Model Context Protocol / FastMCP client library (Like OpenAI Responses API) in your agent code to call tools programmatically. For example, in Python you can use the `mcp` or `fastmcp` client (see library docs) to connect to `http://localhost:8000/mcp` and call `render_latex_document` with arguments.176177Security notes178- If you expose the HTTP endpoint beyond localhost, secure it (TLS, firewall, or authentication) — rendering arbitrary LaTeX can pose risks (shell commands in templates, large resource use).179180---181182## Contributing183184Thanks for wanting to contribute! See `CONTRIBUTING.md` for the development workflow, commit style, and how to open issues and pull requests.185186---187188## License189190This project is released under the MIT License — see `LICENSE`.191192
Full transparency — inspect the skill content before installing.