A Model Context Protocol (MCP) server that connects Claude to your Overleaf account — enabling Claude to read, edit, compile, and download your LaTeX projects end-to-end.
Ask Claude things like:
- "List my Overleaf projects"
- "Read main.tex from my thesis project"
- "Add an abstract section to main.tex and save it"
- "Compile the project and download the PDF to my Desktop"
Claude will read your LaTeX, make edits, push them to Overleaf, trigger a compilation, and hand you back a PDF — all in one conversation.
| Tool | Description |
|---|---|
list_projects |
List all active Overleaf projects in your account |
list_files |
List all files in a given project |
read_file |
Read the contents of any file in a project |
write_file |
Create or overwrite a file (auto-creates parent folders) |
compile_project |
Trigger a PDF compilation on Overleaf |
download_pdf |
Download the compiled PDF to a local path |
| Operation | Approach |
|---|---|
| Read (list, read) | Direct HTTP requests + BeautifulSoup / ZIP download |
| Write | Playwright headless browser — loads your session cookie into a real Chromium context and calls Overleaf's internal upload API from within the page, bypassing external auth restrictions |
| Compile | HTTP POST to Overleaf's internal compile endpoint |
| Download | HTTP GET of the compiled PDF output |
The key insight for writes: Overleaf's load balancer blocks external WebSocket connections, making direct API writes impossible. Running a headless browser with your session cookie sidesteps this entirely — the upload happens from inside an authenticated browser context.
- Python 3.13+
- uv
- Claude Desktop
git clone https://github.com/yourusername/overleaf-mcp
cd overleaf-mcp
uv sync
.venv/bin/playwright install chromium- Open overleaf.com in Chrome while logged in
- Open DevTools → Network tab → refresh the page
- Click any request to
www.overleaf.com→ Request Headers → findCookie: - Copy the value of
overleaf_session2=...(up to the next;)
The cookie expires when you log out. Repeat this step if the server stops authenticating.
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"overleaf": {
"command": "/absolute/path/to/overleaf-mcp/.venv/bin/python",
"args": ["/absolute/path/to/overleaf-mcp/main.py"],
"env": {
"OVERLEAF_SESSION": "your_overleaf_session2_cookie_value"
}
}
}
}Restart Claude Desktop. The Overleaf tools will appear automatically.
You: Read main.tex from my "Research Paper" project
Claude: [calls list_projects, then read_file] Here's the content: ...
You: Add a \section{Related Work} after the introduction and save it
Claude: [calls write_file] Written main.tex ✓
You: Compile it and download the PDF to my Desktop
Claude: [calls compile_project, then download_pdf] PDF saved to /Users/you/Desktop/Research Paper.pdf ✓
- Python 3.13
- MCP — Model Context Protocol via
fastmcp - Playwright — headless Chromium for authenticated write operations
- requests + BeautifulSoup — lightweight HTTP reads
- uv — dependency management
- Works on the free Overleaf tier (no Git integration required)
- Read operations are fast (direct HTTP, no browser needed)
- Write operations launch a headless Chromium instance per call
- The session cookie is stored only in your local Claude Desktop config