claudeleaf
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., "@claudeleaflist my overleaf projects"
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.
Claudeleaf
Bring Claude (and any agent) into Overleaf. Claudeleaf is a reliable TypeScript bridge that drives the Overleaf web editor in real time — listing your projects, opening documents, reading them, and inserting/changing/deleting text — exactly as if a person were typing, so collaborators see the edits live. It ships as an SDK, a CLI, and an MCP server for Claude Code. One signed-in instance can work across all of your projects.
Features
Real editing, not git. Edits go through Overleaf's live collaboration channel (ShareJS over Socket.IO), so they appear instantly to everyone in the project, attributed to your user.
All your projects, one instance. List every project you can access and edit any of them by id or name — no project configured up front.
Full document control — list documents, read text, insert at a position or line/column, replace ranges or literal text, delete ranges or lines, replace a whole document, create/delete/rename files, and upload images (e.g. a local W&B plot PNG) for
\includegraphics:claudeleaf upload <project> plot.png --folder figuresor theoverleaf_upload_fileMCP tool.Review mode (track changes). Submit any edit as a tracked change (a suggestion) with
trackChangesinstead of a direct edit, so a human accepts or rejects it in Overleaf. Requires track changes on the project (a premium feature).Comments. Anchor a comment to a span of text (like selecting text and commenting in the editor) and list a document's comments with their threads.
Compile & error logs — trigger a LaTeX recompile and get back the status plus the parsed errors and warnings (with file and line), or the full raw log.
Reliable by design — automatic reconnect with document re-join, per-document edit serialization, and server-confirmed edits (no silent loss).
Zero config, easy sign-in. No credentials stored and nothing to configure: run
claudeleaf loginonce, sign in by hand in the browser that opens (handles reCAPTCHA / SSO / 2FA), and the session is cached.Three ways to use it — a TypeScript SDK, a CLI, and an MCP server so Claude Code can work on your projects autonomously.
Self-hosting friendly — point it at any Overleaf instance with one environment variable.
Related MCP server: Unofficial Overleaf MCP Server
Getting Started
You don't need to clone or install anything — just Node.js 20+ (which
provides npx). Sign in once, then run any command:
npx claudeleaf login # opens your browser; sign in by hand (handles reCAPTCHA/SSO/2FA)
npx claudeleaf doctor # checks the session and lists your projectslogin drives your installed Google Chrome (or Microsoft Edge); no browser download is
needed. The session is cached under ~/.claudeleaf, so every later command reuses it.
Recommended: sign in as a dedicated bot account. Every edit is attributed to whoever is signed in, so create a separate Overleaf account for the agent, invite it into your project as a collaborator (Share → Can edit), and run
claudeleaf loginas that account. Then every change the bot makes shows up under the bot's name in Overleaf's history — transparent, easy to review or revert, and clearly distinct from your own edits.
Tip:
npx claudeleaf@latest …always fetches the newest release. To avoid the per-run fetch, install it once withnpm install -g claudeleafand then just runclaudeleaf ….
Use the CLI
Every document command takes a project (id or name) followed by the document path:
npx claudeleaf projects # list all your projects
npx claudeleaf ls "My Paper" # list documents
npx claudeleaf cat "My Paper" main.tex # print a document
npx claudeleaf append "My Paper" main.tex "\\section{New}"
npx claudeleaf replace "My Paper" main.tex "foo" "bar"
npx claudeleaf search "My Paper" main.tex "\\section"
npx claudeleaf compile "My Paper" # recompile; print errors/warnings
npx claudeleaf compile "My Paper" --warnings --log # also show warnings + the raw logSuggest an edit instead of making it, and comment on a span of text:
# review mode: a tracked change for a human to accept or reject
npx claudeleaf replace "My Paper" main.tex "foo" "bar" --track-changes
# comment on the [start, end) character span (use `search` to find offsets)
npx claudeleaf search "My Paper" main.tex "Introduction" # -> offset 772
npx claudeleaf comment "My Paper" main.tex 772 784 "Should this be shorter?"
npx claudeleaf comments "My Paper" main.tex # list comments + threadsUse it with Claude Code (MCP)
Register the MCP server (no clone needed), then ask Claude to work on any of your projects:
claude mcp add claudeleaf -- npx -y claudeleaf mcpThe tools reuse the session from claudeleaf login (they won't pop a browser). Claude can
overleaf_list_projects, then read, edit, and compile documents in any project by id or name.
It can also work in review mode rather than editing directly — the seven tools that write
document text (insert_text, append_text, replace_text, replace_range, delete_range,
delete_lines, set_document) take trackChanges: true to leave a tracked suggestion — and
comment on the text with overleaf_add_comment / overleaf_list_comments. For example:
"Read main.tex, then suggest a tighter abstract as tracked changes and leave a comment on the title explaining why."
Use the SDK
npm install claudeleafimport { OverleafClient } from "claudeleaf";
const client = new OverleafClient(); // account-scoped; uses the cached session
for (const p of await client.listProjects()) {
console.log(p.id, p.name);
}
await client.append("My Paper", "main.tex", "\n% added by an agent\n");
await client.replaceText("My Paper", "main.tex", "Your Paper", "Our Paper");
// review mode: submit as a tracked change for a human to accept or reject
await client.replaceText("My Paper", "main.tex", "utilise", "use", 0, { trackChanges: true });
// comment on a span of text, then read the document's comments back
await client.addComment("My Paper", "main.tex", 772, 784, "Should this be shorter?");
for (const c of await client.listComments("My Paper", "main.tex")) {
console.log(c.line, c.text, c.messages.map((m) => m.content));
}
const compile = await client.compile("My Paper");
console.log(compile.status, compile.errors); // errors carry { message, file, line }Develop locally
git clone <this repo> && cd claudeleaf
npm install
npm run claudeleaf -- login # run the CLI from source via tsx
npm test # unit tests (live tests auto-skip without a session)
npm run build # compile to dist/Notes
Claudeleaf edits the live document. Use Overleaf's history to review or revert changes — or make the edit a suggestion in the first place with
--track-changes/trackChanges.Track changes is an Overleaf premium feature. On a project without it the edit still applies, just as a normal edit rather than a suggestion. Comments work on any project.
Comment threads can be created and listed, but not resolved or deleted — Overleaf does not expose those routes.
The cached session is a credential; it lives under
~/.claudeleafwith restrictive permissions.
This server cannot be deployed
Maintenance
Related MCP Connectors
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.
Overleaf alternative online LaTeX editor. AI agents edit, comment, and chat. Keep or revert edits.
A hosted LaTeX editor your assistant can actually use. Search 1,019 free templates, create and edit projects, and compile them to PDF on a real TeX Live farm, getting back the PDF or the compile log when a build fails. Thirteen tools behind OAuth 2.1, with nothing to install and nothing to run locally.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables editing Overleaf projects from Claude, with tools to list, read, edit, and sync files via Git.MIT
- FlicenseBqualityCmaintenanceEnables 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.5MIT
- AlicenseBqualityBmaintenanceConnects Claude to your Overleaf account to manage LaTeX projects, edit files, compile, and retrieve PDFs.6194MIT