MCP Server

July 2, 2026 · View on GitHub

@aloth/olcli ships an MCP (Model Context Protocol) server so AI assistants like Claude Desktop, Cursor, and Windsurf can interact with your Overleaf projects directly.

MCP Tools

ToolDescription
list_projectsList all Overleaf projects
get_project_infoGet file tree and metadata for a project
pull_projectDownload and extract a project to a local directory
push_fileUpload a local file to a project
compileCompile a project and get the PDF URL
download_pdfCompile a project and save the PDF locally
list_commentsList review comments (filter: all / open / resolved)
get_entitiesGet a flat list of all files in a project
download_fileDownload a specific file by its remote path
add_commentAdd a review comment to a document
reply_to_commentReply to an existing comment thread
resolve_commentMark a comment thread as resolved
delete_entityDelete a file or document by path
rename_entityRename a file or document
compile_with_outputsCompile and return all output files (PDF, BBL, logs…)

Authentication

The MCP server reads credentials in this order:

  1. OVERLEAF_SESSION environment variable — set in your MCP config (recommended)
  2. OVERLEAF_EMAIL + OVERLEAF_PASSWORD environment variables — for password login (self-hosted)
  3. .olauth file in cwd — written by olcli auth
  4. Stored config — written by olcli auth (including saved password credentials)

When a session cookie expires and password credentials are available, the MCP server automatically re-authenticates.

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "overleaf": {
      "command": "npx",
      "args": ["-y", "@aloth/olcli-mcp"],
      "env": {
        "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
      }
    }
  }
}

Or if you have olcli installed globally (npm install -g @aloth/olcli):

{
  "mcpServers": {
    "overleaf": {
      "command": "olcli-mcp",
      "env": {
        "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
      }
    }
  }
}

Cursor

Add to your Cursor MCP settings (~/.cursor/mcp.json or project .cursor/mcp.json):

{
  "mcpServers": {
    "overleaf": {
      "command": "npx",
      "args": ["-y", "@aloth/olcli-mcp"],
      "env": {
        "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
      }
    }
  }
}

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "overleaf": {
      "command": "npx",
      "args": ["-y", "@aloth/olcli-mcp"],
      "env": {
        "OVERLEAF_SESSION": "<your-overleaf-session-cookie>"
      }
    }
  }
}
  1. Open Overleaf in your browser and log in
  2. Open DevTools → Application (Chrome) or Storage (Firefox) → Cookies
  3. Find overleaf_session2 (or sharelatex.sid for self-hosted)
  4. Copy the value — that's your OVERLEAF_SESSION

Or run olcli auth and then the MCP server will pick it up automatically.

Self-hosted Overleaf

Set OVERLEAF_BASE_URL in your MCP env:

"env": {
  "OVERLEAF_SESSION": "<cookie>",
  "OVERLEAF_BASE_URL": "https://overleaf.yourcompany.com"
}