overleaf-mcp
Allows AI assistants to read, edit, and compile LaTeX projects on Overleaf, providing tools to list projects, pull/download, push/upload files, compile, download PDF, and delete files using Overleaf's web endpoints and session cookie authentication.
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., "@overleaf-mcp List my projects"
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.
overleaf-mcp
An MCP server for Overleaf that lets AI assistants (Claude, Cursor, etc.) read, edit, and compile your LaTeX projects directly — no more copy-pasting between the editor and your terminal.
No paid plan required. Overleaf's official Git integration is locked behind a paid subscription. This project instead authenticates the same way your browser does — with a session cookie — and drives the same HTTP and realtime endpoints the Overleaf web app itself uses. It works on the free plan.
⚠️ Before you use this
This talks to undocumented, unofficial endpoints, including Overleaf's legacy Socket.IO realtime channel (used to resolve folder ids for uploads/deletes). It can break without notice if Overleaf changes its backend.
Your session cookie is as powerful as your password for the duration of the session. Treat it like a secret: it's read from an environment variable and never leaves your machine, but don't paste it anywhere else.
This is not affiliated with or endorsed by Overleaf/Writefull. Use it at your own risk and in line with Overleaf's Terms of Service.
Related MCP server: overleaf-mcp
Install
git clone https://github.com/NiccoloSalvini/overleaf-mcp
cd overleaf-mcp
uv syncGet your session cookie
Log into overleaf.com in your browser.
Open devtools → Application (Chrome) or Storage (Firefox) → Cookies →
https://www.overleaf.com.Copy the value of
overleaf_session2(andGCLBif present).Build a
Cookie:header string:overleaf_session2=<value>; GCLB=<value>Easiest way in Chrome: open the Network tab, reload the dashboard, click any request to overleaf.com, and copy the full
Cookierequest header from Headers → Request Headers.
The cookie expires (Overleaf sessions typically last a few weeks). When tools start failing with an authentication error, repeat these steps and update the environment variable.
Configure
Set the cookie as an environment variable:
export OVERLEAF_COOKIE="overleaf_session2=...; GCLB=..."Claude Code
claude mcp add overleaf --env OVERLEAF_COOKIE="overleaf_session2=...; GCLB=..." -- uv --directory /path/to/overleaf-mcp run overleaf-mcpClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"overleaf": {
"command": "uv",
"args": ["--directory", "/path/to/overleaf-mcp", "run", "overleaf-mcp"],
"env": {
"OVERLEAF_COOKIE": "overleaf_session2=...; GCLB=..."
}
}
}
}Tools
Tool | Description | Status |
| Check whether | ✅ verified live |
| List your projects (id, name, owner, last updated) | ✅ verified live |
| Download a project and extract it into a local directory | ✅ verified live |
| Trigger a compile, return status and error log | ✅ verified live |
| Compile and download the resulting PDF | ✅ verified live |
| Upload/overwrite a single file, creating remote folders as needed | ✅ verified live |
| Diff a local directory against the project and push changed files | ✅ verified live (calls push_file) |
| Delete a file from a project | ✅ verified live |
Every tool that takes a project argument accepts either the 24-character
project id or the exact project name.
All eight tools were live-tested 2026-07-19 against a real account, including
create/upload/verify/delete round trips on disposable test projects.
overleaf_list_projects/overleaf_pull needed a fix (Overleaf renamed a
meta tag). overleaf_push_file needed a bigger one: black-box guessing at
the upload request shape (field names, folder_id vs parent_folder_id,
with/without qqtotalfilesize) consistently got 422 invalid_filename, even
with a correct folder id read out of Overleaf's own React state. The actual
cause, found by reading Overleaf's own source
(services/web/app/src/Features/Uploads/ProjectUploadController.mjs in
overleaf/overleaf, AGPL): the
filename comes from a multipart form field name, not from a
qqfilename query string param the way the legacy Fine Uploader-era
endpoint mapping (and every third-party client that copied it, including the
original version of this one) assumed. folder_id and _csrf genuinely are
query params — only the filename field was wrong. Fixed in client.py.
overleaf_push_file, overleaf_push_dir, and overleaf_delete_file first
join Overleaf's realtime channel to resolve folder ids (the only way to get
them without the paid Git API) — expect these to take a few seconds longer,
and to be the first thing that breaks if Overleaf changes its backend.
How it works
List / pull: the Overleaf dashboard (
GET /project) embeds the project list as JSON in a<meta name="ol-prefetchedProjectsBlob">tag, and a CSRF token in<meta name="ol-csrfToken">. Projects download as a zip fromGET /project/{id}/download/zip. Both are plain HTTP + HTML parsing.Push / delete: uploading or deleting a file requires the internal folder id, which Overleaf only exposes over its realtime channel (a
joinProjectSocket.IO event, using Overleaf's legacy pre-1.0 Socket.IO protocol). This project joins that channel, reads the returned folder tree, and then calls the same REST upload/delete endpoints the editor uses.Compile:
POST /project/{id}/compilewith a CSRF token, same as the in-browser editor's build button.
Endpoint mapping originally traced from
moritzgloeckl/overleaf-sync
(MIT licensed), reimplemented here with httpx and typed models.
Development
uv sync --group dev
uv run pytest
uv run ruff check .License
MIT — see LICENSE.
Available Tools
8 toolsoverleaf_compileA
Trigger a compile and return its status (and the error log on failure).
Inputs: project (required). Returns: object
overleaf_delete_fileB
Delete a file from an Overleaf project.
Inputs: project (required), remote_path (required). Returns: object
overleaf_download_pdfB
Compile an Overleaf project and download the resulting PDF to dest_path.
Inputs: project (required), dest_path (required). Returns: object
overleaf_list_projectsA
List your Overleaf projects (id, name, owner, last-updated timestamp).
Inputs: include_trashed, include_archived. Returns: result
overleaf_pullA
Download an Overleaf project and extract it into dest_dir (overwrites existing files).
Inputs: project (required), dest_dir (required). Returns: object
overleaf_push_dirA
Push every locally-changed file under local_dir into an Overleaf project.
Diffs local files against the current remote content (byte-for-byte) and uploads only what differs or is new locally. Does not delete remote files that were removed locally — use overleaf_delete_file for that.
Inputs: project (required), local_dir (required), dry_run. Returns: object
overleaf_push_fileA
Upload or overwrite a single file in an Overleaf project.
Creates any missing remote folders in remote_path. Joins the realtime channel to resolve folder ids, so this is slower than overleaf_pull.
Inputs: project (required), local_path (required), remote_path. Returns: object
overleaf_whoamiA
Check whether OVERLEAF_COOKIE is set and still a valid, logged-in session.
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools serve distinct purposes, but overleaf_compile and overleaf_download_pdf both involve compilation, and overleaf_push_file / overleaf_push_dir are closely related. Descriptions clarify the differences, so ambiguity is low.
All tools share the overleaf_ prefix and use lowercase snake_case, but the pattern is not perfectly uniform: some are verb_object (delete_file, list_projects) while others are just verbs (compile, pull). This is mostly consistent and predictable.
With 8 tools, the server is well-scoped for its purpose, covering essential Overleaf operations without unnecessary redundancy. The count is appropriate for a focused integration.
Core workflows like pulling, pushing, compiling, and downloading PDFs are covered, but there is no way to create or delete projects, and no direct file listing (only via pull). These gaps may require workarounds.
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 gradedqualityBmaintenanceEnables 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.445 npm49MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to read, edit, and compile LaTeX documents in Overleaf projects with tracked changes via the Model Context Protocol.6MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to read, edit, and compile Overleaf LaTeX projects via the Overleaf web API using a browser session cookie.-
- FlicenseAqualityBmaintenanceEnables agents to create, duplicate, read, write, and edit Overleaf projects, compile them, and download the resulting PDFs using a session cookie.11-