mcp-overleaf
mcp-overleaf lets an AI agent read, edit, compile, and review Overleaf LaTeX projects, primarily through Git with optional opt-in web mode.
List projects and files, and read file contents or line ranges.
Get a document outline across
\input/\includefiles and read a section by title.Convert Markdown to LaTeX and write it as a new/overwritten file, replacement section, or appended content, with dry-run preview and support for labels, math, citations, cross-references, figures, tables, footnotes, and raw LaTeX.
Create/overwrite files, perform exact-string edits, move/rename files or folders, and delete files or folders, saving changes to Overleaf.
Compile projects on Overleaf, report errors and warnings with file/line info, optionally include raw logs or box warnings, and download the compiled PDF (web mode only).
Manage review comments: list threads, add comments to passages, reply, and resolve/reopen threads (web mode only).
Set up Korean or English paper language, adding
kotexand switching to XeLaTeX for Korean when web mode is available.Refer to projects by ID or Overleaf URL (or name in web mode), with a default project configurable via environment.
Enables reading, editing, compiling, and reviewing Overleaf LaTeX projects via Overleaf's Git integration and (optionally) its internal web endpoints. Provides tools to list projects and files, read files and section outlines, replace exact strings or write/overwrite files with immediate save to Overleaf, compile projects and surface errors/warnings with file:line, download compiled PDFs, manage comment threads (list, add, reply, resolve), move/rename and delete files or folders, and prepare projects for Korean (kotex + XeLaTeX) or English papers. Also allows drafting in Markdown and converting/writing it into an Overleaf project as LaTeX, including replacing sections, appending content, or dry-run previews.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-overleaf write my markdown draft into sections/method.tex in my Overleaf paper"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ChatGPT MCP supported. Deploy the remote server, add its HTTPS
/mcpURL in ChatGPT Plugins, then sign in with Auth0. Set it up →
Ever asked an agent to fix one line in an introduction, only for it to rewrite the project and erase the preamble?
With mcp-overleaf:
“Replace the final paragraph of Methods with this Markdown, then check the compile errors.”It finds the section, produces the LaTeX, saves it to Overleaf, and leaves a commit when it writes through Git.
Unofficial. mcp-overleaf is an independent open-source project. It is not affiliated with, endorsed by, or supported by Overleaf or Digital Science. "Overleaf" is used only to describe what this tool works with. You are responsible for following Overleaf's Terms of Service and Acceptable Use Policy when you use it.
What it does today
Works with Claude Code, Claude Desktop, Cursor, and standard MCP clients out of the box. ChatGPT MCP is supported through remote Streamable HTTP with Auth0 sign-in; use it to read and write your own Overleaf projects from a ChatGPT conversation.
What you want to do | Tool |
Turn a Markdown draft into LaTeX |
|
Explore a project and its files |
|
Change files safely |
|
Compile, get PDFs, and review comments |
|
Prepare a Korean or English paper |
|
Every tool, with what it needs: Tools.
Related MCP server: MiLatexAI
Quick start
Requires Node.js 20+ and git. Get a Git token in Overleaf → Account Settings → Git Integration → Generate token.
Claude Code
claude mcp add overleaf -e OVERLEAF_GIT_TOKEN=olp_... -- npx -y mcp-overleafClaude Desktop / Cursor / others
{
"mcpServers": {
"overleaf": {
"command": "npx",
"args": ["-y", "mcp-overleaf"],
"env": {
"OVERLEAF_GIT_TOKEN": "olp_...",
"OVERLEAF_PROJECT_ID": "optional default project id"
}
}
}
}Then just ask:
"Show me the outline of my thesis."
"Rewrite the Method section from this Markdown draft."
"Compile and list the errors."
"Reply to the open review comments."
On Windows, if the client cannot find npx, use "command": "cmd" and "args": ["/c", "npx", "-y", "mcp-overleaf"]. To opt in to web mode, see Credentials.
ChatGPT / Codex (remote MCP, experimental)
This mode needs a public HTTPS deployment and Auth0. Each user signs in with Auth0, then registers their own Overleaf Git token through a separate trusted settings page. Never paste an Overleaf token into a chat.
docker build -t mcp-overleaf .
docker run --rm -p 3000:3000 --env-file .env -v mcp-overleaf-data:/data mcp-overleafIn ChatGPT, open Plugins → Add custom MCP server, enter https://<your-domain>/mcp, and select OAuth. See the remote MCP + Auth0 guide for Auth0 setup, environment variables, the credential-registration API, and production notes.
See it in action
Real responses from mcp-overleaf 0.1.0, run against a sample paper. Nothing in these screenshots was edited.
Tools
Tool | What it does | Needs | |
✍️ Write |
| Convert Markdown to LaTeX and write it to a file or replace a section | git, or web¹ (none for |
| Create / overwrite a file, then save to Overleaf | git, or web¹ | |
| Exact string replace, then save to Overleaf | git, or web¹ | |
📖 Read |
| List your projects and their IDs | web¹ |
| List files in a project | git, or web¹ | |
| Read a file (optionally a line range) | git, or web¹ | |
| Section tree across | git, or web¹ | |
| Source of one section by title | git, or web¹ | |
🗂️ Files |
| Rename or move a file or folder (creates target folders) | git, or web¹ |
| Delete a file or folder (restorable from History) | git, or web¹ | |
🌐 Language |
| Prepare a project for Korean (kotex + XeLaTeX) or English papers | git, or web¹ |
🛠️ Compile |
| Compile on Overleaf; errors and warnings with file:line | web¹ |
| Compile and save the PDF locally | web¹ | |
💬 Review |
| Review comment threads, with the commented text and location | web¹ |
| Start a comment thread on a passage, like highlighting it in the editor | web¹ | |
| Reply to a comment thread | web¹ | |
| Resolve or reopen a comment thread | web¹ |
¹ web = the optional web mode, which is off by default; see Overleaf's terms and web mode. With only a Git token you get reading, outlines, Markdown writing, editing, moving and deleting files.
Projects can be referred to by ID or Overleaf URL (and by name in web mode).
Writing in Markdown
Draft in Markdown (or have your assistant draft it), then let write_markdown turn it into LaTeX inside your Overleaf project:
## Method {#sec:method}
We fine-tune the model of @sec:background on our data [@smith2020; @lee2021, p. 3].
The loss is $\mathcal{L} = -\sum_i \log p(y_i)$.
$$
\theta^* = \arg\min_\theta \mathcal{L}(\theta)
$$ {#eq:opt}
{#fig:pipeline width=80%}
| Model | Acc. |
|:------|-----:|
| Ours | 91.2 |
Table: Main results {#tbl:main}becomes \section{Method}\label{sec:method}, \cite{smith2020,lee2021}, an equation with \label{eq:opt}, a figure and a table with captions and labels.
Markdown | LaTeX |
| shallowest level → |
|
|
|
|
| kept as-is / |
|
|
|
|
|
|
pipe table + |
|
|
|
lists, task lists, |
|
| passed through untouched |
Where it goes:
path: "sections/method.tex": create or overwrite that file (then\inputit from your main file). The main file is never overwritten, because that would delete the preamble.path+mode: "append": add to the end of a file, before\end{document}.section: "Method": replace an existing section. If your Markdown starts with a heading, the heading is replaced too; otherwise only the body is, and the existing\labelis kept. Headings are leveled relative to that section.md_path: read a local.mdfile instead of passing text.dry_run: true: show the LaTeX without pushing anything.
The tool warns when the output needs a package your preamble doesn't load (e.g. hyperref for links, graphicx for figures).
Korean and English
Papers. English papers need no setup. For Korean papers, run setup_paper_language with language: "ko" once. It adds \usepackage{kotex} to the main file's preamble (unless a Korean package such as kotex or xeCJK is already loaded) and switches the compiler to XeLaTeX. Switching the compiler needs web mode; without it, the tool tells you how to do it in Overleaf (Menu → Settings → Compiler).
You don't have to remember this step. write_markdown warns when you write Korean into a project without Korean support, and compile adds a hint when errors come from Korean characters (Unicode character 한 (U+D55C)). The Markdown converter also handles Korean particles written directly after references and citations, so @fig:arch를 becomes \ref{fig:arch}를 and [@kim2024]에서 becomes \cite{kim2024}에서.
Responses. Set OVERLEAF_LANG=ko to get tool results, errors and warnings in Korean (the default is en). Messages that come straight from Overleaf or git stay as they are.
Credentials
Git token (OVERLEAF_GIT_TOKEN), the default and recommended way in. It uses Overleaf's official Git integration, with real commits. Git integration requires the project owner to have a paid or institutional plan.
Overleaf → Account Settings → Git Integration → Generate token.
Web mode (optional, off by default; OVERLEAF_ENABLE_WEB=1 plus OVERLEAF_SESSION_COOKIE). This adds project listing, compiling, PDFs and review comments, and lets free-plan projects be read and written. Read Overleaf's terms and web mode before turning it on.
To get the cookie, log in to overleaf.com, open DevTools → Application (Chrome) / Storage (Firefox) → Cookies → https://www.overleaf.com, and copy the value of overleaf_session2. It expires when you log out. A cookie on its own does nothing; web mode stays off until OVERLEAF_ENABLE_WEB=1 is also set.
To opt in, add "OVERLEAF_ENABLE_WEB": "1" and "OVERLEAF_SESSION_COOKIE": "s%3A..." to env (or -e OVERLEAF_ENABLE_WEB=1 -e OVERLEAF_SESSION_COOKIE=... for Claude Code).
Both credentials give full access to your projects. Treat them like passwords and never commit them.
Overleaf's terms and web mode
Web mode talks to Overleaf's internal web endpoints and realtime editor service, the same ones the Overleaf website uses. They are not a public API. Overleaf's Acceptable Use Policy (last modified 5 May 2026) prohibits, among other things:
access "by any means other than our publicly supported interfaces"
using "automated means, including robots, scripts, or spiders" to access the service
use that is not "consistent with normal, manual human interaction", or using the service "as a processing engine or API for external systems"
reverse engineering
using content obtained by automated access in connection with machine learning
Web mode very likely falls under these rules. Overleaf monitors usage and can suspend accounts.If you turn web mode on, you do so at your own risk, with your own account. When web mode is on, the server prints a warning every time it starts.
Git mode uses an official, documented integration, so it is the safer choice. Even so, the fair-usage and machine-learning clauses can apply to any automated use. Keep usage modest, and check the current terms yourself.
All options
Variable | Default | |
| Git integration token | |
| off | Set to |
|
| |
| Default project when a tool call omits | |
|
| Language of tool responses: |
|
| Self-hosted / Community Edition URL |
|
| Git bridge URL. For Server Pro use |
|
| Where project copies and PDFs are kept |
|
| Commit author |
| Public HTTPS origin for remote MCP (without | |
| Auth0 settings for remote MCP users | |
| Base64 32-byte key that encrypts per-user Git tokens |
How it works
Git mode: each project is cloned into the cache dir. Reads pull at most every 15 s; every edit pulls, commits, and pushes immediately, rebasing once if someone else edited in the meantime. If the push still fails, the local copy is reset and the error says the change was not saved. The token is passed through environment-scoped git config, so it is never written to disk or shown in the process list.
Overleaf warns that pushes from Git can lose or displace tracked changes and comments. Avoid editing passages that have active review comments through Git.
Web mode (opt-in; used for projects without Git access): the project zip is downloaded fresh before every write, the change is applied, and the file is saved through the editor's upload endpoint (the same one as "Upload" in the Overleaf UI; missing folders are created). Overleaf applies the new content as a diff, so review comments on unchanged text stay attached (verified on overleaf.com). There are no commits; use Overleaf's History to review or undo. Projects that answer "no git access" are remembered for the session, so Git is not retried.
File paths are confined to the project;
.., absolute paths and.git/are rejected.
FAQ
Do I need a paid Overleaf plan? For Git mode, the project owner needs a paid or institutional plan; free-plan projects answer "no git access". Web mode works on free plans, but read the terms section first.
Will it mess up my collaborators' review comments? Web-mode writes keep comments on unchanged text. Git pushes can lose or move them, so avoid editing commented passages through Git.
Can I undo a change? Git mode makes a real commit for every edit. In web mode, use Overleaf's History.
Does it work with a self-hosted Overleaf?
Yes: set OVERLEAF_BASE_URL, and for Server Pro OVERLEAF_GIT_URL=https://<your-site>/git.
Is it official? No. It is an independent project, not affiliated with Overleaf.
Development
npm install
npm test
npm run inspectnpm run inspect opens the MCP Inspector against the local build.
Roadmap
Reviewing tracked changes (accept / reject)
Uploading images and other binary files
Diffs and history
Contributions are welcome.
Acknowledgements
Inspired by mjyoo2/OverleafMCP (MIT). This is an independent rewrite.
License
MIT.
Star History
Available Tools
17 toolsadd_commentAdd a review commentB
Start a new review comment thread on a passage of a .tex file, as if highlighting it in the Overleaf editor. Web mode only (opt-in, see README).
Inputs: path (required), text (required), comment (required), project, +1 more.
compileCompile projectA
Compile the project on Overleaf and report errors and warnings with file and line numbers. Web mode only (opt-in, see README).
Inputs: draft, project, raw_log_lines, include_badboxes, +1 more.
delete_fileDelete a file or folderA
Delete a file or folder from the Overleaf project. Deleted files can be restored from Overleaf's History. Uses Git; falls back to the opt-in web mode if enabled.
Inputs: path (required), project, commit_message.
download_pdfDownload compiled PDFA
Compile the project and save the PDF to a local path. Web mode only (opt-in, see README).
Inputs: project, output_path.
edit_fileEdit a fileA
Replace an exact string in a project file and save it to Overleaf. old_string must match exactly once unless replace_all is set. Uses Git; falls back to the opt-in web mode if enabled.
Inputs: path (required), new_string (required), old_string (required), project, +2 more.
get_commentsGet review commentsA
List review comment threads in the project with the commented text, file, line and replies. Web mode only (opt-in, see README).
Inputs: project, include_resolved.
get_outlineGet document outlineA
Show the section structure (\part, \chapter, \section, ...) of the document, following \input/\include from the main file, with file and line numbers.
Inputs: project, main_file.
list_filesList project filesC
List all files in an Overleaf project.
Inputs: project.
list_projectsList Overleaf projectsB
List the Overleaf projects in your account with their IDs. Web mode only (opt-in, see README).
Inputs: include_archived.
move_fileRename or move a fileA
Rename and/or move a file or folder within the project, e.g. intro.tex → sections/introduction.tex. Missing target folders are created. Remember to update \input/\include references. Uses Git; falls back to the opt-in web mode if enabled.
Inputs: path (required), new_path (required), project, commit_message.
read_fileRead a fileA
Read a text file from an Overleaf project, optionally limited to a line range.
Inputs: path (required), project, end_line, start_line.
read_sectionRead a sectionA
Read the LaTeX source of one section by its title (case-insensitive; partial titles work if unambiguous).
Inputs: title (required), file, project.
reply_commentReply to a commentA
Add a reply to an existing comment thread (thread IDs come from get_comments). Web mode only (opt-in, see README).
Inputs: content (required), thread_id (required), project.
resolve_commentResolve or reopen a commentA
Mark a comment thread as resolved, or reopen a resolved one. Web mode only (opt-in, see README).
Inputs: thread_id (required), reopen, project.
setup_paper_languageSet up the paper languageA
Prepare the project for writing in Korean or English. For "ko": adds \usepackage{kotex} to the main file's preamble (if no Korean package is loaded yet) and switches the compiler to XeLaTeX (needs the opt-in web mode; otherwise it says how to do it in Overleaf). For "en": reports that no setup is needed. Run this before writing Korean text, or when compile reports "Unicode character" errors for Korean.
Inputs: language (required), project, main_file.
write_fileWrite a fileA
Create or overwrite a file in the Overleaf project and save it to Overleaf. Prefer edit_file for changing part of an existing file. Uses Git; falls back to the opt-in web mode if enabled.
Inputs: path (required), content (required), project, commit_message.
write_markdownWrite Markdown to OverleafA
Write in Markdown, publish as LaTeX. Converts Markdown to LaTeX and writes it into the project: a new/overwritten .tex file, an existing section replaced by title, or appended to a file. Supports headings ({#sec:label}, {-} for unnumbered), $math$ and $$display$$ ({#eq:label}), citations [@key; @key2, p. 3], cross refs @fig:x/@sec:x/@eq:x/@tbl:x, figures
{#fig:x width=60%}, pipe tables with 'Table: caption {#tbl:x}', footnotes, lists, code, and raw LaTeX (\commands and \begin..\end blocks pass through). Set dry_run to preview the LaTeX first. Writing uses Git; falls back to the opt-in web mode if enabled.
Inputs: mode, path, dry_run, md_path, +5 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Tools mostly target distinct resources and actions, and descriptions clearly separate editing (write_file/create-overwrite, edit_file/string-replace, write_markdown/markdown-conversion). There is mild overlap in the reading cluster (read_file, read_section, get_outline) where a section could be read via read_file, but the descriptions distinguish their intent (whole file, one section by title, structural outline).
Names consistently use snake_case with a verb_noun pattern (list_projects, read_file, write_file, add_comment, resolve_comment, download_pdf). Minor deviations exist: retrieval verbs mix list/get/read (list_files, get_outline, read_section) and one tool is a bare verb (compile), but the overall convention is predictable and readable.
17 tools is slightly over the ideal 3-15 band, but each tool covers a distinct operation (listing, reading, editing, file ops, comments, compilation, PDF, language setup) with little redundancy. The surface is well-scoped for the breadth of Overleaf authoring and review workflows rather than inflated.
File CRUD/lifecycle (list, read, write, edit, delete, move), the full comment lifecycle (get, add, reply, resolve), and compile/PDF export are covered, giving strong end-to-end support. The notable gap is project-level management: you can list projects but cannot create or delete them, though most agents would handle project creation in the UI.
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.
Overleaf alternative online LaTeX editor. AI agents edit, comment, and chat. Keep or revert edits.
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 gradedqualityCmaintenanceEnables Claude and AI agents to read and edit Overleaf documents in real time, with support for project listing, document manipulation, LaTeX compilation, and live collaboration.128 npm41MIT
- 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
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to read, edit, and compile LaTeX documents in Overleaf projects with tracked changes via the Model Context Protocol.5MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to read, edit, upload, compile, and manage projects in a self-hosted Overleaf Community Edition via MCP, while also providing a git remote for cloning and pushing changes.1MIT