Skip to main content
Glama

Overleaf Direct MCP

A self-hosted MCP server for synchronizing LaTeX answers into Overleaf cloud projects. Everyday operations send direct network requests and do not drive a browser.

This is an UNOFFICIAL integration using overleaf-sync and Overleaf web endpoints. It is not affiliated with Overleaf or OpenAI. Endpoints may change.

Tools

  • overleaf_status: local session and sync dependency diagnostics.

  • list_projects: list projects from the Overleaf cloud account.

  • list_files: list LaTeX files in a selected project.

  • read_file: fetch current source as file_content, sha256, and answer_slots.

  • update_answer: update a selected answer environment with SHA-256 check, backup, cloud write and readback verification.

  • compile_and_download: request Overleaf cloud compilation and save PDF with project URL and engine diagnostics.

The AI assistant reads handwriting and produces LaTeX. This server handles authenticated Overleaf synchronization rather than OCR.

Related MCP server: overtex

Requirements and setup

Python 3.11+, an Overleaf account, and the dependencies in requirements.txt. The supplied one-click setup scripts target Windows.

py -3 -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
.\LOGIN_OVERLEAF.cmd

Sign in locally when the login helper prompts. It stores a private session at .state/.olauth, which Git ignores. Never share this session or tunnel keys.

For a stdio MCP client, run the repository's server.py with the Python executable from its virtual environment.

To connect a ChatGPT MCP Tunnel, obtain the official OpenAI tunnel-client binary using:

.\.venv\Scripts\python.exe scripts\install_tunnel_client.py

Create your OWN dedicated Tunnel through OpenAI Platform, associate your ChatGPT workspace, create a runtime key with the appropriate Tunnel permissions, then run SETUP_OVERLEAF_TUNNEL.cmd. The secret key is DPAPI-encrypted for the current Windows account. Start the service with RUN_OVERLEAF_TUNNEL.cmd. Do not reuse another person's tunnel ID or private profiles.

Safe editing workflow

  1. Call list_projects, list_files and read_file. Confirm the project and source text.

  2. Match the intended question to the answer slot, which counts answer environments from 1 (not textbook exercise numbers).

  3. Prepare LaTeX from the source material and call update_answer with the latest expected_sha256.

  4. Read back the document from Overleaf, then compile_and_download and inspect the PDF.

The read_file text field is named file_content, to avoid a naming collision with some ChatGPT MCP result envelopes. The upstream upload mechanism still has a brief revision-check-to-upload race; avoid simultaneous edits by others.

Tests

.\.venv\Scripts\python.exe -m unittest discover -s tests -v

Optional cloud acceptance scripts are in scripts/. They create or modify a DEDICATED test project on your logged-in Overleaf account. They must never be pointed at real homework projects. Fixture records and credentials are excluded via .gitignore.

License

MIT. Contributions are welcome.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Enables collaborative LaTeX editing on Overleaf with tracked changes, review comments, compilation, file management, and downloads via a single MCP connection.
    26
    1
    AGPL 3.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI assistants and agents to explore, read, live-edit, patch, create, and delete files across projects on a self-hosted Overleaf Community Edition deployment, with OT-safe edits that sync instantly to open browser tabs. It also triggers server-side LaTeX compilations, returns parsed errors and warnings from the log for auto-debugging, and delivers authenticated PDF download links.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Works with Overleaf projects from an MCP client: list projects, read and edit files, compile and download the PDF, diff, comments and tracked changes. Supports overleaf.com and self-hosted Overleaf; authenticates with an Overleaf session cookie.
    21
    1,189 npm
    238
    MIT