Overleaf Mcp Server

io.github.YounesBensafiav0.1.0更新於 Oct 11, 2026

MCP server for managing Overleaf projects through Git synchronization.

已驗證STDIO僅桌面Files & StorageDeveloper Tools

概覽

AI 產生的概覽

讓助理透過 Git 同步列出、讀取、寫入與編輯 Overleaf LaTeX 專案中的檔案。

功能
透過 Git 將 MCP 用戶端連接到 Overleaf 專案,並在本機保留專案鏡像。工具包括 list_files、read_file(可用 offset 與 limit 分段讀取大型文件)、write_file、edit_file 與 sync_project。寫入操作會在本機提交並推送回 Overleaf,因此助理的修改會出現在專案中。
適用情境
適合希望助理直接讀取或修改 Overleaf 專案 LaTeX 原始檔、而不必手動複製貼上的情境,例如起草章節、修改文字或審閱論文。前提是專案已啟用 Git,且你接受助理提交並推送變更。
執行需求
以 stdio 方式在本機執行;需要 Python 3.13+ 與 uv 套件管理工具。需要支援 Git 整合的 Overleaf 方案、專案 ID,以及透過 OVERLEAF_TOKEN 與 PROJECT_ID 提供的 Git 整合權杖(project_id 也可在每次呼叫時傳入)。需要連線到 Overleaf 的 Git 遠端儲存庫。
安裝前請注意
Overleaf Git 權杖(OVERLEAF_TOKEN)是帳號層級憑證,應只存放在受保護的 .env 或用戶端環境中,外洩後需輪換。write_file 與 edit_file 會覆寫內容、提交並推送至 Overleaf,變更會進入真實專案。專案檔案屬於不可信輸入,可能包含針對模型的指令,應視為資料。請將 OVERLEAF_ALLOWED_PROJECTS 限制在需要存取的專案。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Overleaf Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Overleaf MCP Server

[PyPI version] [MCP Registry]

An MCP server for managing Overleaf projects through Git synchronization.

PyPI Package · MCP Registry

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.

Architecture

mermaid
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| C

Tool Workflow

mermaid
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 + metadata

Requirements

  • Python 3.13+
  • uv package manager
  • An 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

  1. Enable Git - open your project on Overleaf → Menu → enable Git under Integrations.
  2. Copy project ID - from the browser URL (e.g. https://www.overleaf.com/project/69a4f7cc4eaf13bd56de5b04 → 69a4f7cc4eaf13bd56de5b04).
  3. Generate a Git token - Account Settings → Git integration authentication tokens → Generate new token.
  4. Configure .env - copy .env.example to .env and fill in:
env
OVERLEAF_TOKEN=your_git_tokenPROJECT_ID=your_project_id

project_id can also be passed per tool call, but PROJECT_ID is 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:

env
OVERLEAF_ALLOWED_PROJECTS=project_id_a,project_id_b

The default allowlist contains only PROJECT_ID.

Quick Start

bash
git clone https://github.com/younesbensafia/overleaf-mcp-server.gitcd overleaf-mcp-serveruv synccp .env.example .env   # then edit with your token/project iduv run overleaf-mcp

Without a checkout, run the Git version directly with:

bash
uvx --from git+https://github.com/younesbensafia/overleaf-mcp-server overleaf-mcp

Plain 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

ToolDescription
list_filesPull and list files from Overleaf project
read_fileRead file content
write_fileOverwrite a complete text file, commit, and push to Overleaf
edit_fileReplace one exact text match, commit, and push to Overleaf
sync_projectForce 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:

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_ID in .env.
    • Or pass project_id explicitly in tool calls.
  • Sync conflicts:
    • Run sync_project before write_file if the remote changed.
  • Server not starting:
    • Ensure dependencies are installed with uv sync.
    • Verify Python 3.13+ is available.

License

MIT - See LICENSE

來源:README.md,提交 6235b52

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v0.1.0最新Oct 11, 2026