/ 目录 / 演练场 / OverleafMCP
● 社区 mjyoo2 🔑 需要你的密钥

OverleafMCP

作者 mjyoo2 · mjyoo2/OverleafMCP

在 Claude 中读取和编辑 Overleaf LaTeX 项目——通过 Git bridge 推送章节级修改,无需打开 Web 界面。

OverleafMCP 通过 Overleaf 的 Git 集成将 Claude 与 Overleaf 连接起来。Claude 可以列出项目文件、解析 LaTeX 结构(章节、引用、图表),并将精准修改推送回去。专为那些宁愿在编辑器中迭代、也不想在 Overleaf Web 文本框里挣扎的学术研究者和技术写作者设计。

为什么要用

核心特性

实时演示

实际使用效果

overleaf-mcp.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "overleaf-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mjyoo2/overleaf-mcp"
      ],
      "env": {
        "OVERLEAF_PROJECT_URL": "https://www.overleaf.com/project/<id>",
        "OVERLEAF_GIT_TOKEN": "your_overleaf_git_token"
      }
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "overleaf-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mjyoo2/overleaf-mcp"
      ],
      "env": {
        "OVERLEAF_PROJECT_URL": "https://www.overleaf.com/project/<id>",
        "OVERLEAF_GIT_TOKEN": "your_overleaf_git_token"
      }
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "overleaf-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mjyoo2/overleaf-mcp"
      ],
      "env": {
        "OVERLEAF_PROJECT_URL": "https://www.overleaf.com/project/<id>",
        "OVERLEAF_GIT_TOKEN": "your_overleaf_git_token"
      }
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "overleaf-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@mjyoo2/overleaf-mcp"
      ],
      "env": {
        "OVERLEAF_PROJECT_URL": "https://www.overleaf.com/project/<id>",
        "OVERLEAF_GIT_TOKEN": "your_overleaf_git_token"
      }
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "overleaf-mcp",
      "command": "npx",
      "args": [
        "-y",
        "@mjyoo2/overleaf-mcp"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "overleaf-mcp": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@mjyoo2/overleaf-mcp"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add overleaf-mcp -- npx -y @mjyoo2/overleaf-mcp

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: OverleafMCP

不离开 Claude,精简论文的某个章节

👤 研究者、技术写作者 ⏱ ~20 min intermediate

何时使用: 审稿人 2 说第 3 节太冗长——你有 30 分钟来修改。

前置条件
  • 开通 Git 访问权限的 Overleaf 付费账号 — Account → Account Settings → Git authentication
步骤
  1. 定位
    Use Overleaf MCP. Find section 3 in main.tex. Show me current text.✓ 已复制
    → 返回章节文本及行范围
  2. 改写
    Tighten this 30%. Keep technical terms intact. Don't drop citations.✓ 已复制
    → 保留引用的精简改写版本
  3. 推送
    Replace section 3 with the rewrite. Commit with message 'Tighten §3 per reviewer 2'.✓ 已复制
    → Git push 成功;Overleaf 中项目重新编译

结果: 修改已落地 Overleaf;全程未触碰 Web 界面。

注意事项
  • 合著者并发编辑导致合并冲突 — 推送前先 pull;在 Claude 中结合 diff 上下文解决冲突
搭配使用: filesystem

审计论文中的所有引用

👤 正在定稿的论文作者 ⏱ ~15 min beginner

何时使用: 提交前——确保每个 \cite 都有对应的 .bib 条目。

步骤
  1. 整理清单
    List every \cite{} key in main.tex. Cross-check against refs.bib.✓ 已复制
    → 匹配表;孤立引用键被标记
  2. 修复
    For each orphan key, suggest the closest match from .bib or mark as missing.✓ 已复制
    → 每个孤立键的修复建议

结果: 点击提交前零引用错误。

注意事项
  • 注释中的引用仍会被匹配 — 正则匹配前先剥离 LaTeX 注释

有把握地调整章节顺序

👤 需要重组章节的作者 ⏱ ~30 min advanced

何时使用: 章节逻辑顺序不对;想交换第 2 节和第 4 节。

步骤
  1. 映射结构
    Show me the section tree of main.tex with line ranges.✓ 已复制
    → 层级结构树
  2. 重新排序
    Swap section 2 with section 4. Update internal references (\ref) accordingly.✓ 已复制
    → 交换完成;内部引用已更新验证

结果: 重构后的论文可以干净编译。

注意事项
  • 前向引用断链 — 重排后编译一次;Claude 可以读取错误并修复

组合

与其他 MCP 搭配,撬动十倍杠杆

overleaf-mcp + filesystem

结构性修改前在本地备份论文

Snapshot the project to /papers/backup/ before any structural changes.✓ 已复制
overleaf-mcp + github

同步镜像到 GitHub,让合著者通过 PR 评论进行审阅

Push the same commits to my GitHub mirror so co-authors can leave PR comments.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
list_files (none) 了解项目文件结构 free
read_file path 拉取 .tex / .bib 文件进行检查 free
parse_structure path 编辑前先梳理大纲 free
edit_section path, section_id, new_text 精准替换某一章节 free
git_push message 将修改持久化到 Overleaf free

成本与限制

运行它的成本

API 配额
Overleaf Git 有速率限制(适度使用)
每次调用 Token 数
500-10000,取决于文件大小
费用
MCP 本身免费;需要 Overleaf 付费套餐才能使用 Git
提示
迭代时读取章节,而非整个文件

安全

权限、密钥、影响范围

最小权限: Overleaf Git token — repo-level read/write
凭据存储: OVERLEAF_GIT_TOKEN 环境变量
数据出站: git.overleaf.com
切勿授予: Token access to other people's projects

故障排查

常见错误与修复

Authentication failed during git_push

token 可能已过期;在 Overleaf 设置中重新生成

验证: 用相同 URL+token 执行 git ls-remote
Tree-sitter LaTeX errors on parse

某些宏会让解析器报错;回退到 read_file 加手动定位

Push rejected (non-fast-forward)

合著者已推送新内容;先 pull,解决冲突后再 push

替代方案

OverleafMCP 对比其他方案

替代方案何时用它替代权衡
VimTeX / TeXShop locally完全不需要云端同步无 Overleaf 协作功能
Overleaf web editor仅做轻量修改无 agent 访问;完全手动

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills