DietSense LaTeX MCP Server
Provides an optional Git bridge exposing tools to inspect sync status, fetch a configured remote without auto-merging, and push approved changes to an Overleaf Git remote.
Tools navigate, read, search, preview, and apply edits to LaTeX paper sections in main.tex, then compile with pdfLaTeX and surface diagnostics.
Provides an optional bridge via Overleaf's official Git integration to fetch from and, with explicit consent, push to an Overleaf project's Git remote, without private API access.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
DietSense LaTeX MCP Server
Local-first LaTeX editing through Claude Desktop, Claude Code and Codex. Inspired by the workflow of community Overleaf MCP servers, but independently implemented for a controlled, GitHub-ready Python project.
輸出的pdf: An Evidence-Grounded AI Agent for Natural-Language Nutrition and Exercise Tracking A Verifiable System Design.pdf
Status: Working local MCP project scaffold. Tested Python editing core and LaTeX compilation. Claude Desktop/remote Overleaf interactions require configuration on your own machine. This is not an official Overleaf product, and does not access Overleaf private APIs.
Interaction model
Claude conversation → MCP tools → read → preview diff → human approval → edit+backup → pdfLaTeX build → diagnostics → optional git fetch / approved push
Features
MCP tool | Purpose |
| Navigate |
| Locate exact phrases |
| View a unified diff without writing |
| Edit with SHA-256 concurrency guard and backup |
| Run pdfLaTeX twice without shell escape; show warnings |
| Return to an earlier version |
| Inspect safe project text assets |
| Optional Git Bridge with explicit push consent |
Related MCP server: overleaf-multi-mcp
OpenSpec (spec-driven development)
This repository includes an openspec/ specification scaffold and a proposed (not yet implemented) add-pdf-layout-inspection change.
OpenSpec is a development-planning layer, not a replacement for the Python MCP server. Install the OpenSpec CLI with a compatible Node.js version, then run openspec init in the repository root to configure your supported coding assistant (e.g., Claude Code or Codex). Claude Desktop MCP configuration remains separate.
Read Windows OpenSpec instructions, baseline specifications, and the PDF layout inspection proposal.
Quick start (Windows)
Prerequisites: Python 3.11+, a TeX distribution (MiKTeX / TeX Live), optionally Git.
cd D:\DietSense-LaTeX-MCP
py -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements.txt
.venv\Scripts\python.exe -m unittest discover -s tests -vEdit configs/claude-desktop-config.json to replace C:/PATH/TO/... with absolute paths. Paste the mcpServers object into Claude Desktop MCP configuration, usually %APPDATA%\Claude\claude_desktop_config.json on Windows, then restart Claude Desktop. The process launches with stdio; do not run server.py in a terminal and type chat messages into it.
Codex: use configs/codex-config.toml and place it into your Codex config as documented for your client.
Example prompts
「列出 DietSense 的所有論文章節並讀取 Abstract」
「把 Related Work 改成學術英文,但先預覽 diff,不要直接修改」
「我確認這次差異,套用並重新編譯」
「檢查第三頁表格超出欄寬的 LaTeX warning,先指出可能原因」
「查看目前 Git 同步狀態;不要 push」
GitHub upload
Create an empty repository named DietSense-LaTeX-MCP, then run in this extracted folder:
git init
git add .
git commit -m "Initial commit: DietSense LaTeX MCP"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/DietSense-LaTeX-MCP.git
git push -u origin mainA GitHub repository does not automatically make the MCP server run in Claude. Claude Desktop must separately start the local Python server.
Optional Overleaf bridge
Official Overleaf Git Integration is plan/owner dependent. If enabled, use your Overleaf project's Git URL to clone its LaTeX working tree separately, point LATEX_PROJECT_ROOT at that local clone and configure the Git remote name overleaf. Authenticate using Git Credential Manager, not token literals in tracked configs. The git_fetch_remote tool fetches only: it does not auto-merge. Pushing requires both a clean working tree and explicit user permission. See docs/OVERLEAF.md.
Safety and known limits
Editing tools work on
main.tex; other text files can be inspected but not modified through these MCP tools.Section matching assumes ordinary
\section{...}headings in onemain.tex. Duplicate headings and nested section replacement should be reviewed carefully.Compilation needs
pdflatexon PATH. No automatic PDF screenshot vision/layout repair is supplied.An LLM client proposes replacement LaTeX; the server itself does not call GPT/Gemini.
Only document projects you trust should be compiled; TeX can read local files despite disabled shell escape. Run this server under a low-privilege user, never on untrusted projects with secrets nearby.
main.pdfis included only as the original sample if present, not generated by the MCP on every GitHub commit.
References
Licensed MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Edit your Overleaf LaTeX projects from Claude and ChatGPT; every change is a real Git commit.
Persistent AI LaTeX workspace: edit and compile multi-file projects, export publication-ready PDFs.
Search arXiv/Semantic Scholar/OpenAlex + medical evidence (PubMed/Europe PMC) + LaTeX/PDF tools.
A hosted LaTeX editor your assistant can actually use. Search 1,019 free templates, create and edit projects, and compile them to PDF on a real TeX Live farm, getting back the PDF or the compile log when a build fails. Thirteen tools behind OAuth 2.1, with nothing to install and nothing to run locally.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceConnects Claude/ChatGPT to Overleaf projects via the Git integration, enabling read, edit, write, and file management through natural language commands.2AGPL 3.0
- AlicenseAqualityDmaintenanceEnables Claude Code to manage Overleaf projects by auto-discovering them and reading/editing files across all projects, with a review-before-push local-workspace workflow.17MIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude, Cursor, or any MCP client to pull an Overleaf project, edit .tex files, check references, compile when a TeX binary is installed, and push changes back.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants such as Gemini, Claude, and ChatGPT to read, search, edit, compile, and review LaTeX files in your actual Overleaf projects, with versioned and atomic multi-file changes. Edits are published straight to Overleaf, so changes appear in the browser within seconds.MIT