overleaf-mcp

overleaf-mcp

Enables AI assistants to read, edit, and compile LaTeX projects on Overleaf using session cookie authentication, bypassing the need for a paid plan.

Category
访问服务器

README

overleaf-mcp

An MCP server for Overleaf that lets AI assistants (Claude, Cursor, etc.) read, edit, and compile your LaTeX projects directly — no more copy-pasting between the editor and your terminal.

No paid plan required. Overleaf's official Git integration is locked behind a paid subscription. This project instead authenticates the same way your browser does — with a session cookie — and drives the same HTTP and realtime endpoints the Overleaf web app itself uses. It works on the free plan.

⚠️ Before you use this

  • This talks to undocumented, unofficial endpoints, including Overleaf's legacy Socket.IO realtime channel (used to resolve folder ids for uploads/deletes). It can break without notice if Overleaf changes its backend.
  • Your session cookie is as powerful as your password for the duration of the session. Treat it like a secret: it's read from an environment variable and never leaves your machine, but don't paste it anywhere else.
  • This is not affiliated with or endorsed by Overleaf/Writefull. Use it at your own risk and in line with Overleaf's Terms of Service.

Install

git clone https://github.com/NiccoloSalvini/overleaf-mcp
cd overleaf-mcp
uv sync

Get your session cookie

  1. Log into overleaf.com in your browser.

  2. Open devtools → Application (Chrome) or Storage (Firefox) → Cookies → https://www.overleaf.com.

  3. Copy the value of overleaf_session2 (and GCLB if present).

  4. Build a Cookie: header string:

    overleaf_session2=<value>; GCLB=<value>
    

    Easiest way in Chrome: open the Network tab, reload the dashboard, click any request to overleaf.com, and copy the full Cookie request header from Headers → Request Headers.

The cookie expires (Overleaf sessions typically last a few weeks). When tools start failing with an authentication error, repeat these steps and update the environment variable.

Configure

Set the cookie as an environment variable:

export OVERLEAF_COOKIE="overleaf_session2=...; GCLB=..."

Claude Code

claude mcp add overleaf --env OVERLEAF_COOKIE="overleaf_session2=...; GCLB=..." -- uv --directory /path/to/overleaf-mcp run overleaf-mcp

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "overleaf": {
      "command": "uv",
      "args": ["--directory", "/path/to/overleaf-mcp", "run", "overleaf-mcp"],
      "env": {
        "OVERLEAF_COOKIE": "overleaf_session2=...; GCLB=..."
      }
    }
  }
}

Tools

Tool Description Status
overleaf_whoami Check whether OVERLEAF_COOKIE is set and still valid ✅ verified live
overleaf_list_projects List your projects (id, name, owner, last updated) ✅ verified live
overleaf_pull Download a project and extract it into a local directory ✅ verified live
overleaf_compile Trigger a compile, return status and error log ✅ verified live
overleaf_download_pdf Compile and download the resulting PDF ✅ verified live
overleaf_push_file Upload/overwrite a single file, creating remote folders as needed ✅ verified live
overleaf_push_dir Diff a local directory against the project and push changed files ✅ verified live (calls push_file)
overleaf_delete_file Delete a file from a project ✅ verified live

Every tool that takes a project argument accepts either the 24-character project id or the exact project name.

All eight tools were live-tested 2026-07-19 against a real account, including create/upload/verify/delete round trips on disposable test projects. overleaf_list_projects/overleaf_pull needed a fix (Overleaf renamed a meta tag). overleaf_push_file needed a bigger one: black-box guessing at the upload request shape (field names, folder_id vs parent_folder_id, with/without qqtotalfilesize) consistently got 422 invalid_filename, even with a correct folder id read out of Overleaf's own React state. The actual cause, found by reading Overleaf's own source (services/web/app/src/Features/Uploads/ProjectUploadController.mjs in overleaf/overleaf, AGPL): the filename comes from a multipart form field name, not from a qqfilename query string param the way the legacy Fine Uploader-era endpoint mapping (and every third-party client that copied it, including the original version of this one) assumed. folder_id and _csrf genuinely are query params — only the filename field was wrong. Fixed in client.py.

overleaf_push_file, overleaf_push_dir, and overleaf_delete_file first join Overleaf's realtime channel to resolve folder ids (the only way to get them without the paid Git API) — expect these to take a few seconds longer, and to be the first thing that breaks if Overleaf changes its backend.

How it works

  • List / pull: the Overleaf dashboard (GET /project) embeds the project list as JSON in a <meta name="ol-prefetchedProjectsBlob"> tag, and a CSRF token in <meta name="ol-csrfToken">. Projects download as a zip from GET /project/{id}/download/zip. Both are plain HTTP + HTML parsing.
  • Push / delete: uploading or deleting a file requires the internal folder id, which Overleaf only exposes over its realtime channel (a joinProject Socket.IO event, using Overleaf's legacy pre-1.0 Socket.IO protocol). This project joins that channel, reads the returned folder tree, and then calls the same REST upload/delete endpoints the editor uses.
  • Compile: POST /project/{id}/compile with a CSRF token, same as the in-browser editor's build button.

Endpoint mapping originally traced from moritzgloeckl/overleaf-sync (MIT licensed), reimplemented here with httpx and typed models.

Development

uv sync --group dev
uv run pytest
uv run ruff check .

License

MIT — see LICENSE.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选