Overleaf MCP Server
Overleaf MCP 服务器
一个通过 Git 集成提供对 Overleaf 项目访问的 MCP(模型上下文协议)服务器。它允许 Claude 和其他 MCP 客户端读取 LaTeX 文件、分析文档结构、提取内容,以及向 Overleaf 项目读写文件。
功能特性
📄 文件管理:从 Overleaf 项目中列出、读取和写入文件
📋 文档结构:解析 LaTeX 的章节和子章节
🔍 内容提取:按标题提取特定章节
📊 项目摘要:获取项目状态和结构的概览
🏗️ 多项目支持:管理多个 Overleaf 项目
Related MCP server: Overleaf MCP Server
快速入门(推荐)
无需克隆,无需 npm install。将此代码块添加到您的 Claude Desktop 配置文件中并重启 Claude Desktop。
配置文件位置
操作系统 | 路径 |
Windows |
|
macOS |
|
Linux |
|
macOS / Linux
{
"mcpServers": {
"overleaf": {
"command": "npx",
"args": ["-y", "@mjyoo2/overleaf-mcp"],
"env": {
"OVERLEAF_PROJECT_ID": "YOUR_OVERLEAF_PROJECT_ID",
"OVERLEAF_GIT_TOKEN": "YOUR_OVERLEAF_GIT_TOKEN"
}
}
}
}Windows — Windows 上的 Claude Desktop 需要 cmd /c 来查找 npx:
{
"mcpServers": {
"overleaf": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@mjyoo2/overleaf-mcp"],
"env": {
"OVERLEAF_PROJECT_ID": "YOUR_OVERLEAF_PROJECT_ID",
"OVERLEAF_GIT_TOKEN": "YOUR_OVERLEAF_GIT_TOKEN"
}
}
}
}重启 Claude Desktop。overleaf 工具应该会出现在 🔧 菜单中。
多项目设置
环境变量快速入门仅适用于单个项目。对于多个项目,请将 projects.json 文件放入用户配置目录,并跳过 Claude Desktop 配置中的 env 代码块。
文件位置
操作系统 | 路径 |
Windows |
|
macOS / Linux |
|
文件内容
{
"projects": {
"default": {
"name": "Main Paper",
"projectId": "...",
"gitToken": "olp_..."
},
"thesis": {
"name": "PhD Thesis",
"projectId": "...",
"gitToken": "olp_..."
}
}
}Claude Desktop 配置 — 与快速入门相同,但没有 env 代码块:
{
"mcpServers": {
"overleaf": {
"command": "cmd",
"args": ["/c", "npx", "-y", "@mjyoo2/overleaf-mcp"]
}
}
}(在 macOS / Linux 上去掉 cmd /c。)
在工具调用中通过 projectName 引用特定项目:
Use read_file with filePath: "main.tex", projectName: "thesis"如果省略 projectName,则使用 default 条目。要将 projects.json 放在标准位置之外的地方,请在 env 代码块中将其指向 OVERLEAF_PROJECTS_CONFIG=/absolute/path/projects.json。
获取 Overleaf 凭据
项目 ID — 打开您的 Overleaf 项目;ID 位于 URL 中:
https://www.overleaf.com/project/[PROJECT_ID]Git 令牌 — Overleaf → 账户设置 (Account Settings) → Git 集成 (Git Integration) → “创建令牌” (Create Token)
配置参考
服务器会选择第一个匹配的配置源:
环境变量(单个项目) —
OVERLEAF_PROJECT_ID+OVERLEAF_GIT_TOKEN。可选:OVERLEAF_PROJECT_NAME用于显示名称。来自文件的令牌 — 设置
OVERLEAF_PROJECT_ID以及OVERLEAF_GIT_TOKEN_FILE=/path/to/token.txt(代替OVERLEAF_GIT_TOKEN)。当您不想在 Claude Desktop JSON 中包含令牌时非常有用。文件在启动时读取一次,并会修剪末尾的空格/换行符。多项目文件 —
OVERLEAF_PROJECTS_CONFIG=/absolute/path/projects.json。用户配置目录 —
projects.json位于:Windows:
%APPDATA%\overleaf-mcp\projects.jsonmacOS / Linux:
$XDG_CONFIG_HOME/overleaf-mcp/projects.json(默认为~/.config/overleaf-mcp/projects.json)
工作目录 —
./projects.json包目录 — 服务器脚本旁边的
projects.json(旧版,用于基于克隆的安装)。
当设置了环境变量且同时存在文件时,环境变量优先,并会向 stderr 记录一条通知,以便可见该覆盖行为。
projects.json 架构(多项目)
{
"projects": {
"default": {
"name": "Main Paper",
"projectId": "...",
"gitToken": "olp_..."
},
"paper2": {
"name": "Second Paper",
"projectId": "...",
"gitToken": "olp_..."
}
}
}然后在工具调用中指定项目:projectName: "paper2"。
本地开发
如果您想修改服务器、在发布前测试更改,或者在没有 npm 包的情况下使用它,您有三种本地安装选项。
选项 1 — 直接运行克隆的脚本
git clone https://github.com/mjyoo2/OverleafMCP.git
cd OverleafMCP
npm install然后将 Claude Desktop 指向该脚本并通过环境变量传递凭据(与 npm 包使用的加载器路径相同):
{
"mcpServers": {
"overleaf": {
"command": "node",
"args": ["/absolute/path/to/OverleafMCP/overleaf-mcp-server.js"],
"env": {
"OVERLEAF_PROJECT_ID": "...",
"OVERLEAF_GIT_TOKEN": "olp_..."
}
}
}
}在 Windows 上,args 应使用 "C:\\Users\\you\\OverleafMCP\\overleaf-mcp-server.js"。
如果您更喜欢使用多项目文件:
cp projects.example.json projects.json # then edit it脚本旁边的 projects.json 是优先级最低的后备方案,因此即使没有环境变量,这也有效。
选项 2 — 在本地测试打包的 npm 制品
验证用户通过公共注册表访问的几乎相同的代码路径,在推送发布前很有用:
npm pack
# → mjyoo2-overleaf-mcp-<version>.tgz将 Claude Desktop 指向 tarball。注意显式的 --package= 和 bin 名称 — npx -y <tarball-path> 在 npm 10+ 中不起作用(路径被错误地检测为可执行文件):
{
"mcpServers": {
"overleaf": {
"command": "cmd",
"args": [
"/c", "npx", "-y",
"--package=C:\\absolute\\path\\to\\mjyoo2-overleaf-mcp-<version>.tgz",
"overleaf-mcp"
],
"env": {
"OVERLEAF_PROJECT_ID": "...",
"OVERLEAF_GIT_TOKEN": "olp_..."
}
}
}
}在 macOS / Linux 上去掉 cmd /c 包装器:"command": "npx", "args": ["-y", "--package=/abs/path/to/...tgz", "overleaf-mcp"]。
选项 3 — 从 shell 对 MCP 协议进行冒烟测试
无需 Claude Desktop:
OVERLEAF_PROJECT_ID=... OVERLEAF_GIT_TOKEN=... node overleaf-mcp-server.js您应该会在 stderr 上看到 Overleaf MCP server running on stdio。进程保持打开状态,等待 stdin 上的 JSON-RPC;按 Ctrl+C 退出。
可用工具
list_projects
列出所有已配置的项目。
list_files
列出项目中的文件(默认:.tex 文件)。
extension: 文件扩展名过滤器(可选)projectName: 项目标识符(可选,默认为 "default")
read_file
读取项目中的特定文件。
filePath: 文件路径(必填)projectName: 项目标识符(可选)
get_sections
获取 LaTeX 文件中的所有章节。
filePath: LaTeX 文件路径(必填)projectName: 项目标识符(可选)
get_section_content
获取特定章节的内容。
filePath: LaTeX 文件路径(必填)sectionTitle: 章节标题(必填)projectName: 项目标识符(可选)
status_summary
获取全面的项目状态摘要。
projectName: 项目标识符(可选)
write_file
将文件的完整内容写入项目。
filePath: 文件路径(必填)content: 要写入文件的内容(必填)commitMessage: 提交信息(必填)projectName: 项目标识符(可选)
write_section
将特定章节的内容写入项目。
filePath: LaTeX 文件路径(必填)sectionTitle: 章节标题(必填)newContent: 章节的替换内容,包括章节标题(必填)commitMessage: 提交信息(必填)projectName: 项目标识符(可选)
使用示例
# List all projects
Use the list_projects tool
# Get project overview
Use status_summary tool
# Read main.tex file
Use read_file with filePath: "main.tex"
# Get Introduction section
Use get_section_content with filePath: "main.tex" and sectionTitle: "Introduction"
# List all sections in a file
Use get_sections with filePath: "main.tex"
# Write the full content of a file to the project
Use write_file with filePath: "main.tex", content: "...", commitMessage: "..."
# Write the content of a specific section to the project
Use write_section with filePath: "main.tex", sectionTitle: "Introduction", newContent: "\\section{Introduction}\n...", commitMessage: "..."安全说明
Overleaf Git 令牌授予对您项目的完全读写权限 — 请像对待密码一样对待它。
如果您的配置文件已备份或同步,请优先使用
OVERLEAF_GIT_TOKEN_FILE而不是在 Claude Desktop JSON 中内联令牌。projects.json在此仓库中已被.gitignore忽略。切勿提交真实的项目 ID 或 Git 令牌。通过 MCP 工具调用提供的文件路径仅限于克隆的项目目录;
..遍历和绝对路径将被拒绝。
许可证
MIT 许可证
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables access to Overleaf LaTeX projects through Git integration, allowing users to read files, analyze document structure, extract sections, and manage multiple projects through natural language commands.177MIT
- 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.517MIT
- AlicenseNot gradedqualityBmaintenanceEnables editing Overleaf projects from Claude, with tools to list, read, edit, and sync files via Git.MIT
- AlicenseBqualityBmaintenanceEnables MCP clients to manage Overleaf projects via Git sync, including listing, reading, writing, and syncing files.446MIT
Related MCP Connectors
Edit your Overleaf LaTeX projects from Claude and ChatGPT; every change is a real Git commit.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Read, edit, publish, and preview your pepita websites from Claude.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mjyoo2/OverleafMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server