mcp-overleaf
Provides tools for securely editing Overleaf projects, including synchronized edit sessions, file read/write with hash checks, preview and publication workflows, and remote compilation with PDF download.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-overleaf Start an edit session and show me the current report files."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-overleaf
Secure, transactional MCP server for editing Overleaf projects through AI coding agents.
mcp-overleaf combines the programmatic API from @aloth/olcli with a constrained local workspace, Git history, three-way conflict detection, resumable publication, and structured MCP tools. It is designed for agents that should not be trusted to remember a fragile sequence of shell commands.
Why this server exists
The upstream olcli project already provides a CLI, a library, and a general MCP server. This project adds a deliberately narrower workflow:
one configured Overleaf project per server instance;
a mandatory edit session before report files can be accessed;
SHA-256 preconditions for text writes;
a persisted local/remote synchronization baseline;
preview tokens and revalidation before publication;
blocking three-way conflicts and all deletions;
Git commits before Overleaf uploads;
optional private GitHub mirrors;
structured results with explicit next actions;
no delete or rename tools.
Overleaf is the collaborative editor and compiler. Git is the recoverable history. The MCP server is the policy boundary presented to the agent.
Related MCP server: overleaf-mcp
Requirements
Node.js 22 or 24 LTS
Git
An Overleaf account with access to the target project
Optional: GitHub CLI (
gh) for a private GitHub mirror
Linux, macOS, and native Windows are supported. Continuous integration runs on all three systems.
Install
git clone https://github.com/GomFal/mcp-overleaf.git
cd mcp-overleaf
npm ci
npm run buildOpen the target Overleaf project in your browser and obtain the value of its session cookie from the browser developer tools. Do not put that value in chat, Git, a command argument, or an MCP configuration file.
Configure a project:
node dist/cli.js configure \
--project-url https://www.overleaf.com/project/PROJECT_ID \
--workspace /absolute/path/to/report-workspaceThe command prompts for the cookie without echoing it. To use a private GitHub mirror, add:
--github OWNER/REPOSITORY --create-github--create-github is required before the setup command may create a missing repository. Existing report mirrors must be private.
PowerShell example:
node dist/cli.js configure `
--project-url https://www.overleaf.com/project/PROJECT_ID `
--workspace 'C:\Users\YOU\Documents\Overleaf\MyReport'Run a health check after setup:
node dist/cli.js doctorRegister the MCP server
Use absolute paths in client configuration.
Codex project configuration (.codex/config.toml):
[mcp_servers.overleaf]
command = "node"
args = ["/absolute/path/to/mcp-overleaf/dist/server.js"]
enabled = true
default_tools_approval_mode = "writes"On Windows, TOML literal strings avoid backslash escaping:
[mcp_servers.overleaf]
command = "node"
args = ['C:\Users\YOU\src\mcp-overleaf\dist\server.js']
enabled = true
default_tools_approval_mode = "writes"Clients using the common JSON configuration shape can register the same STDIO process:
{
"mcpServers": {
"overleaf": {
"command": "node",
"args": ["/absolute/path/to/mcp-overleaf/dist/server.js"]
}
}
}If configure used a non-default config path, set MCP_OVERLEAF_CONFIG in the server environment. Never set the session cookie in a committed client configuration.
Agent workflow
The server enforces this order and returns nextActions after every call:
connector_status
-> begin_edit_session
-> list_report_files / read_report_file / write_report_file
-> preview_publish
-> confirm_publish
-> compile_reportbegin_edit_sessionsynchronizes Git and Overleaf and returnssessionId.read_report_filereturns the file content and SHA-256 digest.write_report_filerequires the session and that digest. Any write invalidates an older preview.preview_publishcompares the session baseline, local workspace, and a fresh Overleaf snapshot. It returnspreviewTokenonly when publication is safe.confirm_publishrechecks the preview, commits and pushes Git first, uploads only planned files, and verifies Overleaf afterward.compile_reportcompiles remotely and saves the resulting PDF locally.
If the same file changed locally and remotely, publication stops. Remote conflict copies are preserved in the connector state directory. The server never resolves a conflict by timestamp and never propagates a deletion.
Available tools
Tool | Purpose |
| Configuration, authentication, Git, and active session health |
| Current state, conflict paths, journal, and permitted next steps |
| Establish a synchronized editing baseline |
| List files and hashes within an active session |
| Read an allowed UTF-8 source file |
| Perform an atomic, hash-checked source update |
| Perform the three-way safety check |
| Publish the exact preview and verify it |
| Close only an unchanged session |
| Compile on Overleaf and download the PDF |
See Architecture, Security model, client setup, and the Spanish guide.
Development
npm ci
npm run checkThe server uses the current MCP TypeScript SDK, typed input and output schemas, and STDIO negotiation for legacy and current MCP clients.
Important limitation
olcli communicates with browser-session-backed internal Overleaf endpoints. The cookie can expire, and Overleaf may change those endpoints. Reauthentication or a dependency update may therefore be required. Overleaf also provides no project-wide transaction lock, so the connector verifies immediately before and after upload but cannot eliminate a collaborator edit that occurs after the final verification.
License
MIT © 2026 Javier Gómez. See LICENSE and THIRD_PARTY_NOTICES.md.
Available Tools
10 toolsabort_edit_sessionAbort an unchanged edit sessionA
Close a session only when it has no pending local edits. This tool never reverts or deletes files.
Inputs: session_id (required). Returns: ok, nextActions, workflowState
begin_edit_sessionBegin a safe report editA
Synchronize Git and Overleaf, detect baseline conflicts, and return the sessionId required by report tools.
Inputs: no named parameters. Returns: ok, nextActions, workflowState
compile_reportCompile and download the Overleaf PDFBIdempotent
Compile the configured remote project and save its PDF inside the configured workspace.
Inputs: root_document. Returns: ok, nextActions, workflowState
confirm_publishConfirm the reviewed publicationB
Revalidate the preview, commit and push Git first, upload only approved files, and verify Overleaf afterward.
Inputs: summary (required), changelog (required), session_id (required), validation (required), +1 more. Returns: ok, nextActions, workflowState
connector_statusInspect connector statusARead-onlyIdempotent
Check configuration, Overleaf access, Git state, and the active workflow without revealing credentials.
Inputs: no named parameters. Returns: ok, nextActions, workflowState
list_report_filesList synchronized report filesARead-onlyIdempotent
List report files in an active synchronized edit session.
Inputs: session_id (required). Returns: ok, nextActions, workflowState
preview_publishPreview a safe publicationAIdempotent
Perform a three-way comparison and return a previewToken, or block on same-file conflicts and deletions.
Inputs: session_id (required). Returns: ok, nextActions, workflowState
read_report_fileRead a report source fileARead-onlyIdempotent
Read a UTF-8 report source and return the SHA-256 precondition required for a safe write.
Inputs: path (required), session_id (required). Returns: ok, nextActions, workflowState
workflow_statusInspect workflow stateARead-onlyIdempotent
Return the active edit session, allowed next actions, preview, conflicts, and recovery journal.
Inputs: no named parameters. Returns: ok, nextActions, workflowState
write_report_fileWrite a report source safelyA
Write UTF-8 content only inside an active session and only when expected_sha256 matches. Use "new" for a new file.
Inputs: path (required), content (required), session_id (required), expected_sha256 (required). Returns: ok, nextActions, workflowState
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools target clearly distinct actions across session, file, compile, and publish workflows. The only minor ambiguity is between connector_status and workflow_status, both of which report state but from different perspectives.
The majority of tool names follow a clear verb_noun pattern like begin_edit_session, read_report_file, and confirm_publish. The exceptions are connector_status and workflow_status, which use an object_status pattern, creating a small inconsistency.
Ten tools is well-scoped for a Git-to-Overleaf synchronization and publishing workflow. Each tool contributes a distinct step in the lifecycle without unnecessary redundancy.
The core workflow is well covered: session lifecycle, file read/write, compilation, preview, and publish confirmation are all present. Minor gaps include no explicit delete-file or conflict-resolution tool, though the write tool and status reporting partially mitigate this.
Maintenance
Related MCP Connectors
Overleaf alternative online LaTeX editor. AI agents edit, comment, and chat. Keep or revert edits.
Edit your Overleaf LaTeX projects from Claude and ChatGPT; every change is a real Git commit.
Persistent AI LaTeX workspace: edit and compile multi-file projects, export publication-ready PDFs.
The team layer for AI coding agents: shared contracts, collision alerts, E2EE sessions.
Related MCP Servers
- FlicenseBqualityDmaintenanceEnables AI agents to interact with Overleaf projects directly, including creating projects, managing files, and editing documents in real-time using Overleaf's native Operational Transformation protocol.101-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to read, edit, and compile LaTeX documents in Overleaf projects with tracked changes via the Model Context Protocol.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to read and precisely edit LaTeX projects, review diffs, sync with Overleaf and GitHub, and compile locally or online with returned PDFs and diagnostics.2MIT
- AlicenseNot gradedqualityBmaintenanceConnects an AI agent to an Overleaf project so it can read review comments and selected text, propose edits as tracked changes, revise pending suggestions, and reply in comment threads. The user stays in control, accepting or rejecting each proposal themselves.46 npm1Apache 2.0