Skip to content

Anu2711/overleaf-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overleaf MCP

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.

Demo

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.

Tools

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

How It Works

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.

Setup

Prerequisites

Install

git clone https://github.com/yourusername/overleaf-mcp
cd overleaf-mcp
uv sync
.venv/bin/playwright install chromium

Get your Overleaf session cookie

  1. Open overleaf.com in Chrome while logged in
  2. Open DevTools → Network tab → refresh the page
  3. Click any request to www.overleaf.comRequest Headers → find Cookie:
  4. 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.

Configure Claude Desktop

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.

Example Workflow

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 ✓

Tech Stack

  • Python 3.13
  • MCP — Model Context Protocol via fastmcp
  • Playwright — headless Chromium for authenticated write operations
  • requests + BeautifulSoup — lightweight HTTP reads
  • uv — dependency management

Notes

  • 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

About

An MCP to read, write, compile and download overleaf projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages