claudeleaf
Enables Claude and AI agents to read and edit Overleaf documents in real time, with support for project listing, document manipulation, LaTeX compilation, and live collaboration.
README
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, and create/delete/rename files.
- 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.
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 projects
login 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 log
Use 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 mcp
The 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.
Use the SDK
npm install claudeleaf
import { 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");
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.
- The cached session is a credential; it lives under
~/.claudeleafwith restrictive permissions.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.