Overleaf MCP Server
Connects to Overleaf projects via Git sync, providing tools to list, read, write, and sync files in an Overleaf project.
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., "@Overleaf MCP Server list files in my Overleaf project"
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.
Overleaf MCP Server
An MCP server for managing Overleaf projects through Git synchronization.
What This Server Does
Connects MCP-compatible clients to your Overleaf project through Git sync.
Exposes file-level tools to list, read, write, and sync project content.
Keeps workflow simple: pull latest files, edit, then push back to Overleaf.
Related MCP server: Overleaf MCP Server
Architecture
flowchart LR
C[MCP Client\nClaude Desktop / other MCP host] -->|Tool Call| S[Overleaf MCP Server]
S -->|Git Sync| O[Overleaf Git Remote]
S -->|Read / Write| L[Local Repo Mirror]
L -->|Commit + Push| O
O -->|Pull / Fetch| L
S -->|Tool Result| CTool Workflow
sequenceDiagram
participant Client as MCP Client
participant Server as Overleaf MCP Server
participant Local as Local Mirror
participant Overleaf as Overleaf Git
Client->>Server: list_files / read_file
Server->>Local: Ensure local clone
Server->>Overleaf: git pull
Overleaf-->>Server: latest content
Server-->>Client: file list / file content
Client->>Server: write_file(path, content)
Server->>Local: update file
Server->>Local: git commit
Server->>Overleaf: git push
Server-->>Client: success + metadataRequirements
Python 3.13+
uvpackage managerAn Overleaf plan with Git integration (individual, group, or institution license). Check if your institution provides free access at Overleaf for Institutions - use your institutional email. If your institution is not listed, upgrade your plan.
Git Setup
Enable Git - open your project on Overleaf → Menu → enable Git under Integrations.
Copy project ID - from the browser URL (e.g.
https://www.overleaf.com/project/69a4f7cc4eaf13bd56de5b04→69a4f7cc4eaf13bd56de5b04).Generate a Git token - Account Settings → Git integration authentication tokens → Generate new token.
Configure
.env- copy.env.exampleto.envand fill in:
OVERLEAF_TOKEN=your_git_token
PROJECT_ID=your_project_id
project_idcan also be passed per tool call, butPROJECT_IDis still required by the server configuration.
The Overleaf Git token is account-wide credential material. Store it only in
the MCP client's environment or a protected .env file, and rotate it if it
is exposed.
Safety Notes
Files in an Overleaf project are untrusted input. A .tex file or project
configuration can contain instructions aimed at the model; treat file contents
as data, not as commands. Keep OVERLEAF_ALLOWED_PROJECTS restricted to the
projects the server should be able to access:
OVERLEAF_ALLOWED_PROJECTS=project_id_a,project_id_bThe default allowlist contains only PROJECT_ID.
Quick Start
git clone https://github.com/younesbensafia/overleaf-mcp-server.git
cd overleaf-mcp-server
uv sync
cp .env.example .env # then edit with your token/project id
uv run overleaf-mcpWithout a checkout, run the Git version directly with:
uvx --from git+https://github.com/younesbensafia/overleaf-mcp-server overleaf-mcpPlain uvx overleaf-mcp is appropriate only after the project is published to
PyPI.
The server listens on stdio - connect your MCP client (Claude Desktop, etc.) to it.
For a large project, call sync_project first. The initial Git clone can take
longer than an MCP client's individual tool request timeout.
Available Tools
Tool | Description |
| Pull and list files from Overleaf project |
| Read file content |
| Overwrite a complete text file, commit, and push to Overleaf |
| Replace one exact text match, commit, and push to Overleaf |
| Force a pull/sync from Overleaf |
read_file accepts optional zero-based offset and bounded limit line
parameters for reading large documents in chunks.
Claude Desktop Setup
Add to ~/.config/Claude/claude_desktop_config.json:
{
"mcpServers": {
"overleaf": {
"command": "uv",
"args": ["--directory", "/path/to/overleaf-mcp-server", "run", "overleaf-mcp"],
"env": {
"OVERLEAF_TOKEN": "your_git_token",
"PROJECT_ID": "your_project_id"
}
}
}
}Troubleshooting
403 Forbidden on git operations:
Your plan doesn't include Git integration - follow the Git Setup section.
Or the Git token is wrong - regenerate it at Account Settings → Git integration authentication tokens.
Wrong project content:
Set the correct
PROJECT_IDin.env.Or pass
project_idexplicitly in tool calls.
Sync conflicts:
Run
sync_projectbeforewrite_fileif the remote changed.
Server not starting:
Ensure dependencies are installed with
uv sync.Verify Python 3.13+ is available.
License
MIT - See LICENSE
Available Tools
4 toolslist_filesA
List all files in the Overleaf project
Inputs: project_id.
read_fileB
Read the content of a file in the Overleaf project
Inputs: file_path (required), project_id.
sync_projectC
Pull latest changes from Overleaf
Inputs: project_id.
write_fileC
Create or update a file in the Overleaf project
Inputs: file_path (required), content (required), project_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool targets a distinct action: listing, reading, syncing, or writing files. No overlap in functionality, enabling clear agent selection.
All tool names follow the consistent verb_noun pattern in snake_case (e.g., list_files, write_file), making them predictable and easy to parse.
With 4 tools covering file listing, reading, writing, and syncing, the scope is narrow but sufficient for basic project management. Slightly minimal but not undercutting usability.
Core file operations (list, read, write, sync) are present, but deletion and renaming are missing. This gap could force agents to work around limitations in file lifecycle management.
Maintenance
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
Notes, files, GitHub, and Drive through one MCP connection.
Notes, files, GitHub, and Drive through one MCP connection.
Notes, files, GitHub, and Drive through one MCP connection.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides access to Overleaf projects via Git integration, allowing Claude and other MCP clients to read LaTeX files, analyze document structure, and extract content.6190 npm362MIT
- AlicenseAqualityDmaintenanceIntegrates with Overleaf's Git feature to manage LaTeX projects directly from MCP-enabled environments, enabling cloning, syncing, and pushing changes between local machine and Overleaf.5MIT
- AlicenseAqualityCmaintenanceEnables AI agents to read, write, compile, and manage Overleaf projects through MCP, including file operations, project administration, and LaTeX compilation diagnostics.16MIT
- AlicenseAqualityBmaintenanceEnables AI clients to read and edit Overleaf projects through the official git bridge, with local staging of changes and conflict detection before publishing.23358 npm1MIT