Overleaf Direct MCP
README.md
# 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.
## 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.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues