FastMCP LaTeX Server (tex-mcp)
MCP server that renders LaTeX to PDF via pdflatex, supporting raw LaTeX and Jinja2 templates with artifact generation.
README
FastMCP LaTeX Server (tex-mcp)
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 run_server.py.
Demo
Quick features
- Render raw LaTeX to
.texand (optionally).pdfusing pdflatex - Render Jinja2 templates and compile to PDF
- Designed to run as an MCP server for Claude Desktop and other MCP-capable clients
Tools exposed by this MCP server
- Total tools: 5
- render_latex_document — write LaTeX and optionally compile to PDF
- render_template_document — render a Jinja2 template and optionally compile
- list_templates — list available templates
- list_artifacts — list files produced in
src/artifacts/ - get_template — return the raw contents of a template file so clients can inspect it before rendering
Getting started (local development)
Prerequisites
- Python 3.10+ (the project uses modern pydantic/fastapi stack)
- LaTeX toolchain (pdflatex) for PDF compilation (optional; if missing, server returns .tex only)
- Create a project virtualenv and install deps
Clone from GitHub
If you want to work from the canonical repository on GitHub, clone it first:
git clone https://github.com/devroopsaha744/TexMCP.git
cd TexMCP
After cloning you can follow the venv creation and install steps below.
python -m venv .venv
. .\\.venv\\Scripts\\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt
- Run the server directly (stdio mode - used by Claude Desktop)
. .\\.venv\\Scripts\\Activate.ps1
python .\\run_server.py
# or run the venv python explicitly if you don't activate
.# .venv\\Scripts\\python.exe run_server.py
If run in stdio mode the server will speak MCP over stdin/stdout (this is what Claude Desktop
expects when it spawns the process). If you prefer HTTP, edit run_server.py and switch the
transport to http (see commented code) and run via uv run or uvicorn.
- Artifacts
Rendered outputs are placed in src/artifacts/. For each job you should see a .tex file and
— if pdflatex is available — a matching .pdf.
Templates
- Several example templates live in
src/mcp_server/templates/. There are 15 templates included (for examplesample_invoice.tex.j2,sample_letter.tex.j2,sample_resume.tex.j2). Uselist_templatesto get the full list programmatically. The templates are deliberately simple and ready to customize — add your own.tex.j2files to that folder to expand the catalog.
Included templates (in src/mcp_server/templates/)
default.tex.j2(base example template)sample_invoice.tex.j2sample_invoice2.tex.j2sample_letter.tex.j2sample_report.tex.j2sample_resume.tex.j2sample_presentation.tex.j2sample_certificate.tex.j2sample_coverletter.tex.j2sample_poster.tex.j2sample_thesis.tex.j2sample_receipt.tex.j2sample_recipe.tex.j2sample_poem.tex.j2sample_cv.tex.j2
Integration with Claude Desktop (quick)
Recommended: use the fastmcp CLI installer which will set things up to run from the project directory and use the project venv.
From your project root (with the venv already created and deps installed):
fastmcp install claude-desktop run_server.py --project C:\\Users\\DEVROOP\\Desktop\\tex-mcp
This ensures uv runs inside the project directory and uses the project's environment. After the installer runs, fully quit and restart Claude Desktop.
Manual Claude Desktop config
If 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):
{
"mcpServers": {
"FastMCP-LaTeX-Server": {
"command": "C:\\\\Users\\\\DEVROOP\\\\Desktop\\\\tex-mcp\\\\venv\\\\Scripts\\\\python.exe",
"args": [
"C:\\\\Users\\\\DEVROOP\\\\Desktop\\\\tex-mcp\\\\run_server.py"
],
"cwd": "C:\\\\Users\\\\DEVROOP\\\\Desktop\\\\tex-mcp",
"transport": "stdio"
}
}
}
Notes
- Do NOT point Claude at the virtualenv
activatescript — it is a shell helper and not an executable. Point Claude to thepython.exeinside the venv (or touv.exeinside the venv if you installeduv). - After any config changes, fully restart Claude Desktop.
Docker
This project includes a Dockerfile so you can run the MCP server in a container.
Build (no LaTeX):
docker build -t fastmcp-latex:latest .
Build with LaTeX (larger image):
docker build --build-arg INSTALL_TEX=1 -t fastmcp-latex:with-tex .
Run (HTTP mode exposed on port 8000):
docker run -p 8000:8000 --rm --name fastmcp-latex fastmcp-latex:latest
Notes
- The container sets
MCP_TRANSPORT=httpby default. Inside the container the server binds to0.0.0.0:8000. - If you want to run the server in
stdiomode in a container you can override the env var:
docker run -e MCP_TRANSPORT=stdio ...
Artifact persistence
- To persist rendered artifacts on the host, bind mount the
src/artifactsdirectory:
docker run -p 8000:8000 -v $(pwd)/src/artifacts:/app/src/artifacts fastmcp-latex:latest
You 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.
Security notes
- 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).
Contributing
Thanks for wanting to contribute! See CONTRIBUTING.md for the development workflow, commit style, and how to open issues and pull requests.
License
This project is released under the MIT License — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

