Skip to main content
Glama

ChatGPT MCP supported. Deploy the remote server, add its HTTPS /mcp URL 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.

NOTE

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

write_markdown

Explore a project and its files

list_projects, list_files, read_file, get_outline, read_section

Change files safely

edit_file, write_file, move_file, delete_file

Compile, get PDFs, and review comments

compile, download_pdf, get_comments, add_comment, reply_comment, resolve_comment

Prepare a Korean or English paper

setup_paper_language

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-overleaf

Claude 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-overleaf

In 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

✍️&nbsp;Write

write_markdown

Convert Markdown to LaTeX and write it to a file or replace a section

git, or web¹ (none for dry_run)

write_file

Create / overwrite a file, then save to Overleaf

git, or web¹

edit_file

Exact string replace, then save to Overleaf

git, or web¹

📖&nbsp;Read

list_projects

List your projects and their IDs

web¹

list_files

List files in a project

git, or web¹

read_file

Read a file (optionally a line range)

git, or web¹

get_outline

Section tree across \input/\included files, with file:line

git, or web¹

read_section

Source of one section by title

git, or web¹

🗂️&nbsp;Files

move_file

Rename or move a file or folder (creates target folders)

git, or web¹

delete_file

Delete a file or folder (restorable from History)

git, or web¹

🌐&nbsp;Language

setup_paper_language

Prepare a project for Korean (kotex + XeLaTeX) or English papers

git, or web¹

🛠️&nbsp;Compile

compile

Compile on Overleaf; errors and warnings with file:line

web¹

download_pdf

Compile and save the PDF locally

web¹

💬&nbsp;Review

get_comments

Review comment threads, with the commented text and location

web¹

add_comment

Start a comment thread on a passage, like highlighting it in the editor

web¹

reply_comment

Reply to a comment thread

web¹

resolve_comment

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}

![Overview of the pipeline](figs/pipeline.pdf){#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 → \section (or top_level), then \subsection, …

## Title {#sec:x} / {-}

\label{sec:x} / starred (unnumbered) heading

*it*, **bold**, `code`, ~~strike~~

\emph, \textbf, \texttt, \sout

$…$, $$…$$ {#eq:x}

kept as-is / equation with label

[@a; @b, p. 3], @a

\cite[p. 3]{a,b}, \cite{a}

@fig:x, @sec:x, @eq:x, @tbl:x

\ref{…}

![cap](img){#fig:x width=60%}

figure with \includegraphics, caption, label

pipe table + Table: cap {#tbl:x}

table + tabular

[^1] / ^[inline] footnotes

\footnote{…}

lists, task lists, > quotes, fenced code

itemize/enumerate, quote, verbatim

\anycommand{…}, \begin{env}…\end{env}

passed through untouched

Where it goes:

  • path: "sections/method.tex": create or overwrite that file (then \input it 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 \label is kept. Headings are leveled relative to that section.

  • md_path: read a local .md file 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).

CAUTION

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

WARNING

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

OVERLEAF_GIT_TOKEN

Git integration token

OVERLEAF_ENABLE_WEB

off

Set to 1 to opt in to web mode, at your own risk

OVERLEAF_SESSION_COOKIE

overleaf_session2 value, or a full name=value cookie string for other instances. Used only in web mode

OVERLEAF_PROJECT_ID

Default project when a tool call omits project

OVERLEAF_LANG

en

Language of tool responses: en or ko

OVERLEAF_BASE_URL

https://www.overleaf.com

Self-hosted / Community Edition URL

OVERLEAF_GIT_URL

https://git.overleaf.com

Git bridge URL. For Server Pro use https://<your-site>/git

OVERLEAF_MCP_CACHE_DIR

~/.mcp-overleaf

Where project copies and PDFs are kept

OVERLEAF_GIT_AUTHOR_NAME / _EMAIL

Overleaf MCP

Commit author

MCP_PUBLIC_URL

Public HTTPS origin for remote MCP (without /mcp)

AUTH0_DOMAIN / AUTH0_AUDIENCE

Auth0 settings for remote MCP users

OVERLEAF_CREDENTIALS_KEY

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 inspect

npm 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 tools
add_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 caption{#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

    A3.5/5.0

    Scored across 17 tools

    Disambiguation4/5

    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).

    Naming Consistency4/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers