The most comprehensive MCP server for Overleaf โ full CRUD, compile, PDF download, git history, diff, and more. (The `overleaf-mcp` name on PyPI is taken by a smaller read-only project, hence the `-plus` suffix; the CLI command is still `overleaf-mcp`.)
Project description
๐ Overleaf MCP Server
The most comprehensive Model Context Protocol (MCP) server for Overleaf.
18 tools covering full CRUD, LaTeX structure analysis, git history & diff, PDF compilation, and download โ all from your AI assistant.
Simple setup โ set two environment variables (OVERLEAF_SESSION, optional OVERLEAF_GIT_TOKEN) when registering the MCP server, and you're done.
You: "List my projects"
AI: [list_projects] You have 5 projects. Which one?
You: "Read main.tex from my thesis"
AI: [read_file] Here's the content: โฆ
You: "Rewrite the abstract to be more concise"
AI: [edit_file] โ Edited and pushed
You: "Compile and download the PDF"
AI: [compile_project + download_pdf] PDF saved to ~/Desktop/thesis.pdf โ
Note: earlier versions shipped an
overleaf_setup/overleaf_save_credentialswizard. These tools have been removed โ credentials are now read straight from environment variables.
๐ Comparison with Other Overleaf MCP Servers
| Capability | This Project | tamirsida | GhoshSrinjoy | anu2711 | Junfei-Z | mjyoo2 |
|---|---|---|---|---|---|---|
| Language | Python | Python | JS | Python | JS | JS |
| Auth | Git + Cookie | Git | Git | Cookie | Git | Git |
| list_projects | โ | โ | โ | โ | โ | โ |
| list_files | โ | โ | โ | โ | โ | โ |
| read_file | โ | โ | โ | โ | โ | โ |
| get_sections | โ | โ | โ | โ | โ | โ |
| get_section_content | โ | โ | โ | โ | โ | โ |
| create_file | โ | โ | โ | โ | โ | โ |
| create_project | โ | โ | โ | โ | โ | โ |
| edit_file (surgical) | โ | โ | โ * | โ | โ * | โ |
| rewrite_file | โ | โ | โ | โ | โ | โ |
| update_section | โ | โ | โ | โ | โ | โ |
| delete_file | โ | โ | โ | โ | โ | โ |
| list_history | โ | โ | โ | โ | โ | โ |
| get_diff | โ | โ | โ | โ | โ | โ |
| compile_project | โ | โ | โ | โ | โ | โ |
| download_pdf | โ | โ | โ | โ | โ | โ |
| download_log | โ | โ | โ | โ | โ | โ |
| sync_project | โ | โ | โ | โ | โ | โ |
| status_summary | โ | โ | โ | โ | โ | โ |
| Multi-project | โ | โ | โ | โ | โ | โ |
| Thread-safe locking | โ | โ | โ (Redis) | โ | โ | โ |
| Docker support | โ | โ | โ | โ | โ | โ |
| Free Overleaf tier | โ โ | โ | โ | โ | โ | โ |
| Total tools | 18 | 12 | 9 | 6 | 8 | 6 |
* Full file rewrite only, not surgical oldโnew replacement. โ Compile/download tools work on the free tier via session cookie; Git-based tools require Git integration.
โจ Key Advantages
- 18 tools โ the most of any Overleaf MCP server
- Zero config โ just two env vars, no config files, no per-project setup
- Dual auth โ Git tokens for read/write + session cookies for compile/download
- Surgical edits โ
edit_filedoes exact search-and-replace (likesed), not full rewrites - LaTeX-aware โ section hierarchy parsing with indented previews
- Git history & diff โ review changes, compare versions, filter by file/date
- Compilation โ trigger builds and download PDFs without leaving your AI chat
- Compilation logs โ
download_logfor debugging LaTeX errors - Thread-safe โ per-project locks prevent concurrent git corruption
- Clean Python โ modular architecture, type hints, async throughout
๐ฆ Installation
Option 1: pip (recommended)
# Core (git-based tools only)
pip install overleaf-mcp
# With compile/download support
pip install overleaf-mcp[compile]
Option 2: From source
git clone https://github.com/rangehow/overleaf-mcp.git
cd overleaf-mcp
pip install -e .
# Or with uv
uv venv && uv pip install -e .
Option 3: Docker
git clone https://github.com/rangehow/overleaf-mcp.git
cd overleaf-mcp
docker compose build
๐ง Setup
Configure credentials via environment variables. There are two credentials for two different sets of features โ you can supply either or both.
Step 1 โ Get the session cookie (required)
The overleaf_session2 cookie is HttpOnly, so it can only be read
from the browser's DevTools panel (not from JavaScript / the console).
- Log into https://www.overleaf.com.
- Press F12 โ Application tab (Firefox: Storage; Safari: Storage).
- Expand Cookies โ https://www.overleaf.com.
- Copy the Value of the row named
overleaf_session2. It starts withs%3Aโฆ.
Step 2 โ Get the git token (optional, for edit tools)
- Open https://www.overleaf.com/user/settings.
- Scroll to Git Integration โ Create Token.
- Copy the token (it starts with
olp_; shown only once).
Step 3 โ Pass them to the server
Point your MCP client at overleaf-mcp and provide the env vars. In
Claude Desktop / Claude Code (claude_desktop_config.json or .mcp.json):
{
"mcpServers": {
"overleaf": {
"command": "overleaf-mcp",
"env": {
"OVERLEAF_SESSION": "s%3A...",
"OVERLEAF_GIT_TOKEN": "olp_..."
}
}
}
}
In chatui's MCP catalog the Overleaf card prompts for these two fields at install time โ no shell setup needed.
Two credentials, different purposes
| Credential | What you can do | When you need it |
|---|---|---|
Session cookie (overleaf_session2) |
list_projects, compile, download PDF, download log, create project |
Works on the free tier. Expires ~30 days โ refresh when tools start failing with auth errors. |
Git token (olp_...) |
Read/write/edit files, commit history, diffs | Optional. Only if you want to edit files. Requires a paid plan. |
You can start with just the cookie and add the git token later.
All Environment Variables
| Variable | Description |
|---|---|
OVERLEAF_SESSION |
Session cookie. Required for list_projects / compile / pdf / create_project. |
OVERLEAF_GIT_TOKEN |
Git token. Required for read / edit / history / diff tools. |
OVERLEAF_BASE_URL |
Overleaf URL (default: https://www.overleaf.com) |
OVERLEAF_GIT_HOST |
Git host (default: git.overleaf.com) |
OVERLEAF_TEMP_DIR |
Local git cache (default: ./overleaf_cache) |
OVERLEAF_GIT_AUTHOR_NAME |
Git author name (default: Overleaf MCP) |
OVERLEAF_GIT_AUTHOR_EMAIL |
Git author email (default: mcp@overleaf.local) |
HISTORY_LIMIT_DEFAULT |
Default commit limit (default: 20) |
HISTORY_LIMIT_MAX |
Max commit limit (default: 200) |
DIFF_CONTEXT_LINES |
Diff context lines (default: 3) |
DIFF_MAX_OUTPUT_CHARS |
Max diff size (default: 120000) |
๐ Client Setup
Docker
{
"mcpServers": {
"overleaf": {
"command": "docker",
"args": ["compose", "run", "--rm", "-T", "mcp"],
"cwd": "/path/to/overleaf-mcp",
"env": {
"OVERLEAF_SESSION": "s%3A...",
"OVERLEAF_GIT_TOKEN": "olp_..."
}
}
}
}
(For Claude Desktop / Claude Code see the setup section above.)
๐ ๏ธ Tools Reference
Create
| Tool | Description |
|---|---|
create_file |
Create a new file (auto-creates folders), commit & push |
create_project |
Create a new blank Overleaf project (requires session cookie) |
Read
| Tool | Description |
|---|---|
list_projects |
List all projects in your Overleaf account |
list_files |
List files, optionally filtered by extension |
read_file |
Read file contents |
get_sections |
Parse LaTeX section hierarchy with previews |
get_section_content |
Get full content of a section by title |
list_history |
Git commit history (with date/file/limit filters) |
get_diff |
Git diff between refs or working tree |
status_summary |
Project overview: file count, structure, status |
Update
| Tool | Description |
|---|---|
edit_file |
Surgical search-and-replace (must match exactly once) |
rewrite_file |
Replace entire file contents |
update_section |
Update a LaTeX section body by title |
sync_project |
Pull latest changes from Overleaf |
Delete
| Tool | Description |
|---|---|
delete_file |
Delete a file, commit & push |
Compile & PDF
| Tool | Description |
|---|---|
compile_project |
Trigger PDF compilation on Overleaf |
download_pdf |
Download compiled PDF to local path |
download_log |
Download compilation log for debugging |
๐ก Usage Examples
"List my projects"
"List all files in project 64a1b2c3d4e5f6a7b8c9d0e1"
"Read main.tex"
"Show me the sections in chapter1.tex"
"Get the content of the Introduction section"
"Fix the typo: change 'teh' to 'the' in main.tex"
"Rewrite the abstract with: [new text]"
"Update the Methods section with: [new content]"
"Create a new file references.bib with: [content]"
"Delete the old appendix.tex file"
"Show me the last 5 commits"
"What changed in main.tex since last week?"
"Show the diff between HEAD~3 and HEAD"
"Compile my thesis and tell me if it succeeded"
"Download the PDF to ~/Desktop/thesis.pdf"
"Show me the compilation log โ I have an error"
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ MCP (stdio) โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Assistant โโโโโโโโโโโโโโโโบโ overleaf-mcp server โ
โ (Claude, etc.) โ โ โ
โโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Git Client โ โโโ Git HTTPS โโโบ git.overleaf.com
โ โ (clone/pull/push) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โ LaTeX Parser โ โ
โ โ (sections/struct) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Compile Module โ โโโ HTTPS โโโบ www.overleaf.com
โ โ (PDF/log download) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Modules:
credentials.pyโ Read session cookie + git token from environment variablesconfig.pyโ Project config + Overleaf endpointsgit_client.pyโ Git operations (clone, pull, push, diff, history)latex.pyโ LaTeX document structure parsingcompile.pyโ PDF compilation and download (uses session cookie)server.pyโ MCP server with 18 tool definitions
๐ชช Local-copy metadata sidecar
Whenever download_source extracts a project to a local directory, or
ensure_repo clones one into the git cache, the server drops a small
.overleaf-project.json file at the root of that copy:
{
"project_id": "69e46cd469c0fc49d2627320",
"name": "[้ฟๅธ] ๆฏไธ่ฎบๆ้ญๆน็",
"overleaf_url": "https://www.overleaf.com/project/69e46cd469c0fc49d2627320",
"source": "zip",
"downloaded_at": "2026-04-22T10:54:55+00:00"
}
This lets any tool (including an AI assistant) unambiguously identify
which Overleaf project a local working directory corresponds to โ no
more guessing by file names. For git-backed copies the file is added to
.git/info/exclude so it is never pushed back to Overleaf.
๐ Security
- Credentials are read only from environment variables โ nothing is persisted to disk by the server
- Path traversal protection on all file operations
- Per-project thread locks prevent concurrent git corruption
- Session cookie expiry surfaces as a clear auth error, prompting the user to refresh
OVERLEAF_SESSION
๐ณ Self-Hosted Overleaf
For self-hosted Overleaf instances:
export OVERLEAF_BASE_URL="https://your-overleaf.example.com"
export OVERLEAF_GIT_HOST="your-overleaf.example.com"
๐ License
MIT License โ see LICENSE for details.
๐ Acknowledgments
Inspired by and building upon ideas from:
- tamirsida/overleaf_mcp โ Full CRUD Python server
- GhoshSrinjoy/Overleaf-mcp โ Redis queue, history/diff
- anu2711/overleaf-mcp โ Compile/download via session cookie
- mjyoo2/OverleafMCP โ Original read-only MCP (103 โญ)
- Junfei-Z/overleaf-claude-mcp โ Write/push fork
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file overleaf_mcp_plus-0.1.4.tar.gz.
File metadata
- Download URL: overleaf_mcp_plus-0.1.4.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0bd802b6eb69f2a8a784e44e112cc85abe97dc6198c3dc0c501120af3c403b2
|
|
| MD5 |
63424cae7dd5607f5f71a33da04ec9ce
|
|
| BLAKE2b-256 |
51f5a71cd5ccef1a9359d04fd914cfccf205a715c338546d45279570fe919cf4
|
File details
Details for the file overleaf_mcp_plus-0.1.4-py3-none-any.whl.
File metadata
- Download URL: overleaf_mcp_plus-0.1.4-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c0537929a4d985084cb2847849948214d7a91921c98a5fe4e37f0b8dce8fe0d
|
|
| MD5 |
f1bbd5a04ea11ec5329fbdc0b9db09fb
|
|
| BLAKE2b-256 |
8d2534d9c25e80731399cb3b7986cd177f110ae84001f56e0e3a0e4c1b39e221
|