Overleaf MCP Server
Allows Claude to read and edit one Overleaf project at a time through Overleaf's Git integration. Provides tools for listing files, reading and searching project content, generating section outlines, making find/replace edits, creating or replacing files, uploading figures and bibliographies, deleting or moving files, viewing project history and diffs, and manually syncing or pushing changes.
overleaf-mcp
An MCP server that lets Claude (Claude Code and Claude Desktop) read and edit one Overleaf project at a time. Edits are pushed straight to Overleaf and appear in your browser editor within seconds.
It talks to Overleaf through Overleaf's official Git integration, which needs a paid Overleaf plan (or a self-hosted Server Pro). There is no unofficial scraping of the web editor.
How access is limited
Three layers, from loosest to tightest:
Registry. The server can only attach projects you have registered with
overleaf-mcp add. Claude cannot register projects through the MCP tools, so it cannot widen its own access.Attach. A server process holds at most one attached project. Every file path is resolved inside that project's working copy;
.., absolute paths and.gitare refused. Nothing else is reachable.Pin. Set
OVERLEAF_PROJECTin a server's config and it is locked to that one project: it auto-attaches, andattach_project/detach_projectrefuse.
Per session: Claude Code starts a separate server process for every session, so each session has its own attachment and its own working copy. Two sessions can work on two different projects (or the same one) at once. Claude Desktop starts one server for all chats, so there an attachment is shared by every chat until changed.
What this does not protect against: the Overleaf Git token is account-wide
(Overleaf has no per-project tokens), and it sits in ~/.overleaf-mcp/token.
The scoping above is enforced by this server. A Claude Code session that also
has unrestricted shell access could read the token file directly. If that
matters, deny shell reads of ~/.overleaf-mcp in your Claude Code permissions.
Related MCP server: overleaf-claude-mcp
Setup
1. Install
git clone https://github.com/rutwikg/overleaf-mcp C:\path\to\overleaf-mcp
cd C:\path\to\overleaf-mcp
uv syncThe server executable is C:\path\to\overleaf-mcp\.venv\Scripts\overleaf-mcp.exe.
Always give clients this full path; they do not inherit your shell's PATH.
2. Store your Overleaf Git token
In Overleaf: Account Settings > Git integration > Generate token. Then, in a
terminal (the token is read with hidden input and saved to ~/.overleaf-mcp/token):
C:\path\to\overleaf-mcp\.venv\Scripts\overleaf-mcp.exe login3. Register the projects Claude may use
The alias is what you will say to Claude. The URL is the one in your browser when the project is open.
C:\path\to\overleaf-mcp\.venv\Scripts\overleaf-mcp.exe add thesis https://www.overleaf.com/project/0123456789abcdef01234567add checks that the token can reach the project. Other commands: list, rename OLD NEW,
remove ALIAS, check [ALIAS].
4a. Claude Code: attach per session
Register the server once, for all your sessions:
claude mcp add --scope user overleaf -- C:\path\to\overleaf-mcp\.venv\Scripts\overleaf-mcp.exeThen, in any session, either say "attach my thesis project" or use the slash command the server provides:
/mcp__overleaf__attach thesisThat session can now edit thesis and nothing else. Another session is
unaffected until you attach something there.
4b. Claude Code: pin a folder to one project
To make every session started in a folder work on one project only, put a
.mcp.json in that folder (see examples/pinned.mcp.json):
{
"mcpServers": {
"overleaf": {
"command": "D:\\Work\\AgenticAI\\OverleafMCP\\.venv\\Scripts\\overleaf-mcp.exe",
"env": { "OVERLEAF_PROJECT": "thesis" }
}
}
}If you also registered the server at user scope, the project-scope entry of the same name takes precedence in that folder.
4c. Claude Desktop
Add to claude_desktop_config.json (Settings > Developer > Edit Config) and
restart Claude Desktop:
{
"mcpServers": {
"overleaf": {
"command": "D:\\Work\\AgenticAI\\OverleafMCP\\.venv\\Scripts\\overleaf-mcp.exe"
}
}
}Then tell Claude "attach thesis" in a chat. Add "env": {"OVERLEAF_PROJECT": "thesis"}
to lock Desktop to a single project.
Tools
Tool | What it does |
| Registered aliases and which one is attached |
| Bind / unbind this session's project |
| Attached project, sync state, push mode |
| Read the project |
| Section structure in reading order, following |
| Exact find/replace, pushed to Overleaf |
| Several find/replace edits to one file as one atomic change |
| Create a file or replace one wholesale |
| Copy a local file (figure, PDF, .bib) into the project |
| File management |
| Overleaf's version history |
| Manual sync control |
How editing works
On attach the server clones the project into ~/.overleaf-mcp/work/<alias>-<pid>-<id>/.
Before each operation it pulls if the last pull is more than 15 s old, so
edits you make in the browser are seen. Each write is committed and pushed
immediately. If you edited the same text in the browser at the same moment,
the push is rejected, the server rebases, and if the edits truly collide it
drops its own change and reports CONFLICT so Claude re-reads and redoes it.
Your browser edits always win.
The working copy is deleted when the session ends. Copies left behind by a crashed process are cleaned up on the next start, unless they hold changes that never reached Overleaf, which are kept for you.
Docker
The server needs only git and network access, so it runs fully in a container. Pass the token by environment and pin the project by id:
docker build -t overleaf-mcp .
docker run --rm -i -e OVERLEAF_GIT_TOKEN=<token> -e OVERLEAF_PROJECT=<project-id> overleaf-mcpUse docker run --rm -i ... as the command in a client config. To use a
registry of several projects instead, mount a folder holding projects.json
at /data.
Configuration
Variable | Default | Meaning |
| unset | Pin to this alias, URL or id |
|
|
|
|
| Seconds before a pull is considered stale |
|
|
|
|
| For self-hosted Server Pro |
| unset | Token via env instead of the token file |
|
| Where token, registry and working copies live |
|
| Local commit identity |
Overleaf's history attributes Git pushes to the token's owner, not to the commit name.
Limitations
Needs Overleaf's Git integration (paid plan or Server Pro).
Does not compile. Check the PDF in Overleaf.
Overleaf's main-file setting is not visible over Git; the server guesses the file containing
\documentclass, preferringmain.tex.Overleaf's Git bridge can take a few seconds per push on large projects.
Development
uv run pytest
npx @modelcontextprotocol/inspector C:\path\to\overleaf-mcp\.venv\Scripts\overleaf-mcp.exeTests run against a fake Overleaf made of bare Git repos over file://; only
the transport is faked.
Licence
AGPL-3.0-or-later. See LICENSE.
Available Tools
19 toolsapply_editsA
Apply several find/replace edits to one file as a single Overleaf change.
Inputs: path (required), edits (required), message.
attach_projectA
Attach an Overleaf project to this session. All other tools then act on this project only.
Clones the project locally, which takes a few seconds. Attaching a different project detaches the current one first.
Inputs: project.
delete_fileADestructive
Delete a file from the attached project. It stays recoverable from Overleaf's history.
Inputs: path (required), message.
detach_projectA
Detach the current project. Afterwards no project is reachable until attach_project is called again.
Inputs: no named parameters.
discard_unpushedADestructive
Throw away local commits that never reached Overleaf and reset to Overleaf's current version.
Inputs: no named parameters.
edit_fileA
Replace exact text in a file of the attached project and push it to Overleaf.
Inputs: path (required), new_text (required), old_text (required), message, +1 more.
list_filesARead-only
List files in the attached project (recursively), with sizes.
Inputs: path.
list_projectsARead-only
List the Overleaf projects the user has registered for use with Claude, and which one is attached.
Inputs: no named parameters.
move_fileA
Rename or move a file within the attached project. Does not update \input or \includegraphics references.
Inputs: path (required), new_path (required), message.
outlineARead-only
Show the document structure: sectioning commands in reading order, following \input and \include.
Inputs: path.
project_historyBRead-only
Recent versions of the project (as recorded by Overleaf's Git bridge), newest first.
Inputs: path, limit.
project_statusARead-only
Show which project is attached, whether it is in sync with Overleaf, and the push mode.
Inputs: no named parameters.
push_changesA
Push local commits that have not reached Overleaf yet (only needed when auto-push is off or a push failed).
Inputs: no named parameters.
read_fileBRead-only
Read a text file from the attached project.
Inputs: path (required), end_line, start_line, line_numbers.
search_projectARead-only
Search the text files of the attached project. Returns matching lines with file and line number.
Inputs: pattern (required), regex, file_glob, ignore_case, +1 more.
show_diffBRead-only
Show what one version of the project changed.
Inputs: commit (required), path.
sync_projectARead-only
Pull the latest changes made in Overleaf (by the user or collaborators) right now.
Inputs: no named parameters.
upload_fileA
Copy a file from this computer (figures, data, .bib) into the attached project and push it.
Inputs: path (required), local_path (required), message.
write_fileADestructive
Create a new text file, or replace a file's entire content, and push it to Overleaf.
Prefer edit_file for changes to existing files: it cannot accidentally drop text.
Inputs: path (required), content (required), message.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools have crisp, non-overlapping purposes (attach/detach/status, sync/push/discard, read/search/outline), and descriptions explicitly steer between the closest pairs. The only real friction is the edit_file / apply_edits / write_file / upload_file cluster, where an agent must read descriptions carefully to pick correctly; project_status vs list_projects also lightly overlap.
Nearly everything is consistent snake_case verb_noun (attach_project, read_file, push_changes, show_diff). A few tools invert to noun-first or bare nouns (outline, project_status, project_history), which is a minor deviation but still readable and predictable.
19 tools is at the upper end of comfortable, and a few could be merged (e.g. status into list_projects, discard_unpushed as a mode flag). Still, each tool maps to a concrete action in the attach-edit-sync-history workflow, so the surface feels earned rather than padded.
Strong coverage of the core lifecycle: project attachment, file CRUD plus move/upload, search/outline, edit/apply_edits with push, plus sync, history and diff. Gaps exist around LaTeX-specific needs such as compiling/viewing the PDF or build log, and Overleaf collaboration features like comments and creating new projects, but agents can largely work around them.
Maintenance
Related MCP Connectors
Overleaf MCP server for ChatGPT, Claude and any AI agent: list projects, read file, edit file, compile project, add comment, reply to comment, accept tracked change and invite collaborator in your own Overleaf account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Overleaf yourself; Cotlet does not store your password and you need no Overleaf API key. About the official Overleaf API: Overleaf has no public API to read or change existing projects (checked 5 Nov 2026). Its only API, Open in Overleaf, sends LaTeX in one direction to create a new project. Setup and FAQ: https://cotlet.dev/integrations/overleaf-api-mcp-server
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
MCP Server for Slima - AI Writing IDE for Novel Authors with AI Beta Reader.
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server for Overleaf that allows Claude or other agents to navigate projects, read and edit .tex files, compile, and interact with review-panel comments via Overleaf's real-time Socket.IO API, with seamless support for tracked changes as pending suggestions.33473 npm9AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceAn MCP server that lets Claude read, write, and push Overleaf LaTeX projects from the chat, with token-efficient features like sparse checkout and smart diffs.16MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides access to Overleaf projects via Git integration, enabling Claude and other MCP clients to read LaTeX files, analyze document structure, and extract content.8 npm1MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for interacting with Overleaf projects, enabling project listing, file reads, LaTeX section discovery, and revision-guarded writes through natural language.AGPL 3.0