overleaf-mcp

overleaf-mcp

Enables AI agents to read, edit, and compile LaTeX documents in Overleaf projects with tracked changes via the Model Context Protocol.

Category
访问服务器

README

<p align="center"> <img src="docs/overleafmcp-logo.png" alt="Overleaf MCP" width="220"> </p>

Overleaf MCP

Overleaf MCP lets an AI agent work with your Overleaf projects through the Model Context Protocol. The agent can find and read LaTeX, suggest edits, compile the project, inspect errors, and view the rendered PDF without leaving its normal coding environment.

Every source edit is submitted as a tracked-change suggestion. You remain in control and accept or reject the changes in Overleaf.

[!IMPORTANT] The project owner needs an Overleaf plan that supports tracked changes. The MCP never falls back to direct editing when tracked changes are unavailable.

What it can do

  • List and switch between projects.
  • Search and read live LaTeX sources without downloading whole files.
  • Read review comment threads together with their source anchors.
  • Add, replace, revise, or withdraw tracked suggestions.
  • Follow concurrent human edits through Overleaf's live document channel.
  • Compile in draft or clean mode and report errors and warnings.
  • Render PDF pages and download project assets to local artifact paths.
  • Route document tasks to multiple named agents.

Reviewer accounts cannot create files or accept suggestions. If an agent needs a new file, create_file tells it to ask you to create the empty file first.

Install

Python 3.11 or newer is required. pipx is recommended because it exposes the MCP commands globally while keeping their dependencies isolated:

pipx install --include-deps "overleaf-mcp[login]"
playwright install chromium

The Playwright dependency is used only for the one-time browser login. The MCP server itself runs headlessly.

To install from a source checkout instead:

git clone https://github.com/ayghri/overleaf-mcp.git
cd overleaf-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e ".[login]"
python -m playwright install chromium

On Windows, activate the environment with .venv\Scripts\activate.

Authenticate with Overleaf

Run the login command once on a machine with a display:

overleaf-mcp-login

A Chromium window opens. Sign in and complete any captcha. The session is saved under ~/.local/state/overleaf-mcp/auth/ and reused by the MCP server. Run the login command again when the session expires.

No configuration file is required for overleaf.com. For a self-hosted instance or optional login-form prefill, create ~/.config/overleaf-mcp/config.toml:

base_url = "https://www.overleaf.com"
email = "bot@example.com"
password = "optional-login-prefill"

A dedicated Overleaf account invited as a reviewer is recommended. The MCP still forces tracked suggestions if the account has broader permissions.

Connect an agent

Overleaf MCP is a standard local stdio server. Give each running agent a unique --agent-id so its cursor, suggestions, and assigned tasks are identifiable.

Claude Code

claude mcp add overleaf -s user -- overleaf-mcp --agent-id writer
claude mcp list

OpenAI Codex CLI

Add this to ~/.codex/config.toml:

[mcp_servers.overleaf]
command = "overleaf-mcp"
args = ["--agent-id", "writer"]

OpenCode

Add this to opencode.json or ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "overleaf": {
      "type": "local",
      "command": ["overleaf-mcp", "--agent-id", "writer"],
      "enabled": true
    }
  }
}

Other MCP clients

Claude Desktop, Cursor, Cline, Windsurf, and similar clients accept the usual local-server JSON:

{
  "mcpServers": {
    "overleaf": {
      "command": "overleaf-mcp",
      "args": ["--agent-id", "writer"]
    }
  }
}

If the client cannot find overleaf-mcp, use the executable's absolute path. Restart the client after changing its MCP configuration.

Start using it

Ask the agent to initialize the workflow and select a project:

Use the Overleaf MCP. Call workflow_help, list my projects, and select the project named KATA.

After selection, ordinary requests are enough:

  • “Find the expressivity section and tighten the first paragraph.”
  • “Compile cleanly and show me the remaining warnings.”
  • “Render page 4 so we can inspect the table.”
  • “Show my pending suggestions in main.tex.”

The usual edit flow is search, a bounded read_file, goto_text, and an edit operation. Suggestions stay pending until you accept them in Overleaf.

The selected project persists for that agent. You can optionally pin a default project in ~/.config/overleaf-mcp/agents/writer.toml:

project_id = "your-overleaf-project-id"

Use overleaf-mcp --list-agents to see live agent ids and their selected projects.

Optional document task inbox

An agent can wait for work addressed to its id in LaTeX comments:

%%bot: writer
%%todo: rewrite this paragraph
Text the agent should work on.
%%end bot: writer

The agent uses wait_for_command, claim_command, and complete_command to move the task from todo to doing to done. These comments do not appear in the compiled PDF.

Docker

Perform the browser login on the host, then build the runtime image:

overleaf-mcp-login
docker build -t overleaf-mcp .

Run the image as the MCP client's stdio command, mounting the saved session:

docker run -i --rm \
  -v ~/.config/overleaf-mcp:/config:ro \
  -v ~/.local/state/overleaf-mcp/auth:/session:ro \
  overleaf-mcp --agent-id writer

Use absolute mount paths in clients that do not perform shell expansion.

Troubleshooting

  • Authentication expired: run overleaf-mcp-login again.
  • No project selected: ask the agent to call list_projects and select_project.
  • Agent id already running: choose another --agent-id or inspect overleaf-mcp --list-agents.
  • Client cannot start the server: run overleaf-mcp --agent-id test in a terminal to expose the startup error.
  • A non-BMP character is rejected: the legacy Overleaf editing endpoint does not safely preserve characters such as emoji in source mutations.

Development and design

poetry install --with dev
poetry run ruff check overleaf_mcp tests
poetry run pytest

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选