overleaf-mcp-server
Provides read, write, compile, and project-management access to Overleaf projects, including file operations, LaTeX compilation with diagnostics, PDF export, and project archiving or deletion.
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-server compile my latest project and show the LaTeX errors"
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-server
An MCP server that gives an AI agent read, write, compile, and project-management access to your Overleaf projects.
Unofficial. This project is not affiliated with, endorsed by, or supported by Overleaf. It uses Overleaf's undocumented internal web API, which may change or break without notice. If it stops working, that is expected — please open an issue rather than assuming data loss.
Targets MCP specification revision 2026-07-28.
Install
No install needed — npx fetches it on demand. Add this to your MCP client config:
{
"mcpServers": {
"overleaf": {
"command": "npx",
"args": ["-y", "overleaf-mcp-server"],
"env": { "OVERLEAF_SESSION_COOKIE_FILE": "/Users/you/.overleaf-session" }
}
}
}Getting your session cookie
Log in to Overleaf in your browser.
Open DevTools → Application → Cookies →
https://www.overleaf.com.Copy the value of the
overleaf_session2cookie.Save it to a file, e.g.
echo 'PASTE_VALUE_HERE' > ~/.overleaf-session && chmod 600 ~/.overleaf-session
The cookie grants full access to your Overleaf account — treat it like a password. A file is preferred over inlining it, since MCP config files are often synced or backed up.
Cookies expire after roughly a few weeks. When that happens, tools fail with a message telling you to re-copy it.
Related MCP server: Unofficial Overleaf MCP Server
Configuration
Variable | Required | Purpose |
| yes* | Value of the |
| yes* | Path to a file containing it (preferred) |
| no | Defaults to |
| no |
|
| no |
|
| no | Comma-separated project-ID allowlist |
| no |
|
* exactly one of the two cookie variables.
Tools
Tool | What it does |
| List projects (archived/trashed excluded by default) |
| List documents, files, and folders in a project |
| Read a document, including collaborators' unsaved edits |
| Write the whole project to disk as a ZIP |
| Create or overwrite a text document |
| Upload or overwrite a binary file |
| Create a folder |
| Move a file or folder |
| Delete a file or folder — confirmation required |
| Compile and return structured LaTeX diagnostics |
| Return the raw LaTeX log |
| Compile and write the PDF to disk |
| Create a new project |
| Rename a project |
| Archive a project — confirmation required |
| Permanently delete a project — confirmation required |
Safety
Destructive tools (delete_entity, archive_project, delete_project) never act on the
model's say-so. They return an input_required result so you confirm, and they ignore
any confirm argument the model supplies. If your MCP client cannot answer such requests,
they refuse until you set OVERLEAF_ALLOW_DESTRUCTIVE=1, which is your standing consent
given out-of-band in your own config.
Set OVERLEAF_READ_ONLY=1 and mutating tools are not registered at all — the agent cannot
see them, let alone call them.
Troubleshooting
"Overleaf session is not valid (redirected to login)" — your cookie expired. Re-copy
overleaf_session2 and update your config.
"Overleaf returned an unexpected shape for …" — Overleaf changed their undocumented API. This error is deliberate: the server refuses to return a plausible-but-wrong answer. Please open an issue with the message.
Compile rate limits — get_compile_log and get_pdf each trigger a fresh compile.
Free Overleaf accounts limit compiles aggressively; prefer compile_project's structured
diagnostics over repeatedly fetching the raw log.
Development
npm install
npm test # offline; uses injected fakes, no Overleaf account needed
npm run build
OVERLEAF_SESSION_COOKIE=<real cookie> npm run test:live # optional, hits real OverleafLicense
MIT
Available Tools
16 toolsarchive_projectArchive a projectADestructiveIdempotent
Archive an Overleaf project, removing it from the active list. Requires human confirmation.
Inputs: projectId (required).
compile_projectCompile an Overleaf projectAIdempotent
Compile the project on Overleaf and return structured LaTeX diagnostics (file, line, level, message). Compiles typically take 10-60 seconds.
Inputs: projectId (required), engine, rootDoc.
create_folderCreate a folderC
Create a folder inside an Overleaf project.
Inputs: name (required), projectId (required), parentPath.
create_projectCreate a projectC
Create a new, empty Overleaf project and return its id.
Inputs: name (required), template.
delete_entityDelete a file or folderADestructiveIdempotent
Permanently delete a document, file, or folder from an Overleaf project. Requires human confirmation.
Inputs: path (required), projectId (required).
delete_projectDelete a projectADestructiveIdempotent
Permanently delete an entire Overleaf project. Requires human confirmation.
Inputs: projectId (required).
export_projectExport project as ZIPARead-onlyIdempotent
Download the whole Overleaf project as a ZIP archive written to outputPath.
Inputs: projectId (required), outputPath (required).
get_compile_logGet the raw compile logCIdempotent
Return the full raw LaTeX log from a compile. Use when structured diagnostics are insufficient.
Inputs: projectId (required).
get_pdfDownload the compiled PDFAIdempotent
Compile the project and write the resulting PDF to outputPath on disk.
Inputs: projectId (required), outputPath (required).
list_filesList project filesARead-onlyIdempotent
List every document, binary file, and folder in an Overleaf project.
Inputs: projectId (required).
list_projectsList Overleaf projectsARead-onlyIdempotent
List projects in the account. Archived and trashed projects are excluded by default.
Inputs: includeTrashed, includeArchived.
move_entityMove a file or folderBIdempotent
Move a document, file, or folder to a different folder in the project.
Inputs: path (required), projectId (required), destinationPath (required).
read_fileRead a project fileARead-onlyIdempotent
Read a text document from an Overleaf project, including collaborators' unsaved edits. Binary files and documents over the size cap require outputPath.
Inputs: path (required), projectId (required), outputPath.
rename_projectRename a projectCIdempotent
Change the name of an Overleaf project.
Inputs: name (required), projectId (required).
upload_fileUpload a binary fileBIdempotent
Upload or overwrite a binary file (image, PDF, data) in an Overleaf project.
Inputs: path (required), projectId (required), contentBase64 (required).
write_fileWrite a text fileAIdempotent
Create or overwrite a text document in an Overleaf project. Overwriting records a new version in Overleaf history.
Inputs: path (required), content (required), projectId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Each tool targets a distinct resource-action pair: projects, files/folders, and compilation outputs are clearly separated. Even closely related tools like write_file vs upload_file and compile_project vs get_compile_log are differentiated by explicit text/binary and structured/raw output descriptions.
All tool names follow a consistent snake_case verb_noun pattern (list_projects, create_folder, move_entity, compile_project). The use of list, get, create, write, upload, move, delete, etc. is predictable and maps cleanly to CRUD and domain actions.
16 tools is one above the typical 15-tool sweet spot, but each tool covers a meaningful project, file, or compile operation without redundancy. The count feels slightly heavy but remains well-scoped for a full Overleaf workflow.
The surface covers project lifecycle, file/folder management, and compilation well. Minor gaps exist: there is no unarchive/restore operation, no rename for files/folders, and no single-file download, but these are workaroundable via export_project or move_entity.
Maintenance
Related MCP Connectors
Project management shared by people and AI agents, with persistent project state through MCP.
Project management MCP for AI agents with safe task reads and writes.
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.
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
- FlicenseBqualityDmaintenanceEnables AI agents to interact with Overleaf projects directly, including creating projects, managing files, and editing documents in real-time using Overleaf's native Operational Transformation protocol.101-
- AlicenseNot gradedqualityCmaintenanceEnables coding agents to read, write, compile, and download LaTeX projects on a self-hosted Overleaf instance.1MIT
- 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