overleaf-claude-mcp
overleaf-claude-mcp
ClaudeをOverleafアカウントに接続します。Claudeはプロジェクトの一覧表示、選択、LaTeXや図の読み取り、ファイルの編集、コンパイル、PDFの取得まで行えます。
Overleafには無料プラン向けの公開APIがありません。GitブリッジとDropbox同期はPremium機能です。そのため、このサーバーはOverleaf Webアプリが使用しているのと同じ内部HTTPおよびソケットエンドポイントを、一度作成したブラウザセッションで認証して利用します。すべてのエンドポイントはOverleaf自身のJavaScriptバンドルから読み出し、実在のアカウントに対して動作確認済みです。検証済みエンドポイントを参照してください。
チュートリアル
必要なもの
Node 20以降(
node -v)ChromeまたはEdgeがインストールされていること
Overleafアカウント(無料プランで可)
Claude Code(
claude --version)またはClaude Desktop
ステップ1: セットアップを実行
このフォルダから、Windowsの場合:
setup.cmdmacOSまたはLinuxの場合:
./setup.shセットアップは5つのステップを実行し、それぞれを表示します:
依存関係をインストール
dist/にビルド有効なOverleafセッションを確認。ない場合はブラウザウィンドウがOverleafのログインページで開きます
実際のプロジェクトの1つを読み戻し、接続が機能することを確認
Claude Codeへのサーバー登録を提案
ステップ2: ブラウザが開いたらサインイン
ブラウザウィンドウは実際のChromeです。2FAを含め、通常どおりにサインインしてください。パスワードを自動入力することはなく、パスワードが読み取られたり保存されたりすることもありません。
プロジェクト一覧に到達すると、ウィンドウは自動的に閉じ、セットアップが続行します。セッションCookieは ~/.overleaf-claude-mcp/session.json に保存されます。
このファイルはOverleafアカウントへの完全なアクセス権と同等です。gitignoreされており、0600 パーミッションで書き込まれます。共有したりコミットしたりしないでください。
ステップ3: セットアップにサーバーを登録させる
ステップ5でプロンプトが表示されます:
Register this server with Claude Code now? [y/N]y と答えてください。次のコマンドが実行されます:
claude mcp add overleaf -- node C:/CoolYEAH/overleaf-claude-mcp/dist/index.jsスキップした場合、または別のクライアントを使用する場合は、手動で登録してください。Claude Codeの場合は上記のコマンドを実行します。Claude Desktopの場合は、Windowsでは %APPDATA%\Claude\claude_desktop_config.json を、macOSでは ~/Library/Application Support/Claude/claude_desktop_config.json を編集します:
{
"mcpServers": {
"overleaf": {
"command": "node",
"args": ["C:/CoolYEAH/overleaf-claude-mcp/dist/index.js"]
}
}
}ステップ4: Claudeを再起動
MCPサーバーは起動時にのみ認識されます。Claude CodeまたはClaude Desktopを終了して再度開いてください。
読み込まれたことを確認:
claude mcp listoverleaf が接続済みとして表示されるはずです。Claude Codeセッション内では、/mcp でも同じものが表示されます。
ステップ5: 使用する
自然言語で依頼するだけです。Claudeがツールを自動的に選択します。
List my Overleaf projectsSelect the Efficient Reasoning projectRead sections/methodology.texIn sections/results.tex, change "Table 1" to "Table~\ref{tab:main}"Compile it and tell me what the LaTeX errors areShow me figures/fig1.pngSave the compiled PDF to C:/tmp/paper.pdfプロジェクトを一度選択すると、それが保持されます。選択内容は ~/.overleaf-claude-mcp/state.json に保存され、再起動後も維持されるため、以降のすべてのリクエストは切り替えるまでそのプロジェクトに適用されます。切り替えずに1つのリクエストで別のプロジェクトを操作するには、名前を指定してください:「私の論文プロジェクトからmain.texを読んで」。
Related MCP server: claudeleaf
トリガーの方法
スラッシュコマンドや入力するものはありません。Claudeがツールの説明を読み、リクエストが一致したときに呼び出します。Overleaf、または選択済みのプロジェクトやファイルに言及するだけで十分です。
Claudeがツールを使わない場合、よくある原因は、登録後に再起動していないか、プロジェクトがまだ選択されていないことです。「どのOverleafプロジェクトが選択されていますか?」と聞いて確認してください。
ツール
ツール | 目的 |
| プロジェクト一覧を表示し、選択中のものをマーク |
| IDまたは名前でアクティブなプロジェクトを選択 |
| どのプロジェクトが選択されているかを表示 |
| 完全なファイル・フォルダツリー |
| LaTeXまたはその他のテキストファイルを読み取り |
| 図をインラインで表示 |
| PDFを含む任意のファイルをローカルに保存 |
| プロジェクト全体を正規表現で検索 |
| テキストファイルを作成または上書き |
| ファイル内の文字列を正確に置換 |
| 図などのローカルファイルをアップロード |
| フォルダを作成し、欠落している親フォルダも作成 |
| ファイルまたはフォルダの名前を変更 |
| ファイルまたはフォルダを移動 |
| エントリを削除。 |
| サーバーサイドでコンパイル |
| コンパイルして解析済みのLaTeXエラーを返す |
| コンパイルしてPDFを保存 |
| コンパイル済みの単語数 |
overleaf_select_project はプロジェクトIDまたはプロジェクト名の一部を受け取ります。名前が複数のプロジェクトに一致する場合は、推測せずに候補を一覧表示します。overleaf_delete は confirm がtrueでない限り実行を拒否するため、Claudeが誤ってファイルを削除することはありません。
トラブルシューティング
「No Overleaf session at ...」 — まだサインインしていないか、セッションが期限切れです。npm run login または setup.cmd を再度実行してください。
Claudeがツールを認識しない — 登録後にClaudeを再起動していません。claude mcp list で確認してください。
ツールが突然失敗する — Overleafがエンドポイントを変更した可能性があります。npm run recon を実行すると、各エンドポイントを読み取り専用でプローブし、どの呼び出しが壊れたかを正確に教えてくれます。
Claudeを使わずにターミナルからセットアップを確認:
npm run read -- "Efficient Reasoning"一致するプロジェクトのファイルツリーとすべてのセクション見出しを表示します。パスを追加すると単一のファイルを出力します:
npm run read -- "Efficient Reasoning" sections/methodology.texセットアップはいつでも再実行できます。 有効なセッションを再利用して接続を再検証するため、ヘルスチェックも兼ねます。
仕組み
ファイルツリーはOverleafのソケット接続から取得します。エンティティIDを運ぶ唯一の情報源であり、書き込みにはIDが必要だからです。ハンドシェイクは GET /socket.io/1/?projectId=<id> で、これはsocket.io 0.9フレーミングです。その後サーバーは joinProjectResponse をプッシュし、rootFolder、ドキュメントID、ファイルハッシュを含むプロジェクト全体が送られます。ツリーは OVERLEAF_TREE_TTL_MS(デフォルト15秒)の間キャッシュされ、書き込みのたびに無効化されます。
テキストファイルはドキュメントごとに読み取られるため、読み取りは常に現在の状態を反映します。overleaf_grep は代わりにプロジェクトアーカイブを読み取るため、プロジェクト全体の検索がファイルごとに1リクエストではなく1リクエストで済みます。
書き込みはアップロードエンドポイントを通じて行われます。既存の名前へのアップロードはインプレース更新です。エンティティIDが保持されるため、Overleafの履歴やドキュメント内の他の共同編集者は影響を受けません。欠落している親フォルダは先に作成されます。
検証済みエンドポイント
推測ではなく、実在のアカウントに対してライブで確認済み:
操作 | 呼び出し | 備考 |
プロジェクト一覧 |
|
|
CSRF |
|
|
新規プロジェクト |
|
|
ファイルツリー |
|
|
パスのみ |
| 安価、IDなし |
ドキュメント読み取り |
| プレーンテキスト |
バイナリ読み取り |
| ハッシュはツリーから取得 |
アーカイブ |
| grepに使用 |
作成または上書き |
| multipart、フィールド |
ドキュメントまたはフォルダ作成 |
| ボディ |
名前変更 |
| 204 |
移動 |
| 204、ボディ |
削除 |
| 204 |
コンパイル |
|
|
単語数 |
|
:type は doc、file、folder のいずれかです。
スクリプト
コマンド | 機能 |
| ゼロからの完全セットアップ |
| 依存関係がインストール済みの場合と同じ |
| 再認証のみ |
| ターミナルからプロジェクトを検査 |
| すべてのエンドポイントの読み取り専用プローブ |
| 使い捨てプロジェクトでのエンドツーエンド書き込みテスト |
|
|
npm run smoke は claude-mcp-smoketest というプロジェクトを作成し、書き込み、上書き、画像アップロード、名前変更、移動、削除、コンパイルを実行します。確認用にプロジェクトはアカウントに残ります。確認が終わったら削除してください。
設定
すべてオプションです。.env.example を参照してください。
変数 | デフォルト |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
制限事項
これはサポート対象のAPIではなく、Overleafはいつでも変更できます。自分のアカウントに対してのみ使用してください。リアルタイム共同編集は実装されていません。書き込みは文字レベルの操作を送信するのではなくドキュメント全体を置き換えるため、他の誰かが入力している間にファイルへの書き込みは避けてください。
Available Tools
19 toolsoverleaf_compileCompile the projectB
Run a server-side LaTeX compile and report status plus output files.
Inputs: draft, projectId, stopOnFirstError.
overleaf_compile_logCompile and read the logB
Compile the project and return parsed LaTeX errors and warnings.
Inputs: projectId.
overleaf_create_folderCreate a folderC
Create a folder, including any missing parents.
Inputs: folderPath (required), projectId.
overleaf_current_projectShow active projectA
Report which Overleaf project is currently selected.
Inputs: no named parameters.
overleaf_deleteDelete an entryB
Delete a file or folder from the project. Requires confirm to be true.
Inputs: confirm (required), filePath (required), projectId.
overleaf_download_fileDownload a fileC
Save any project file, including PDFs and images, to a local path.
Inputs: destPath (required), filePath (required), projectId.
overleaf_download_pdfDownload the compiled PDFA
Compile the project and save the resulting PDF locally.
Inputs: destPath (required), projectId.
overleaf_edit_fileEdit a text fileC
Replace an exact string inside a project file.
Inputs: filePath (required), newString (required), oldString (required), projectId, +1 more.
overleaf_grepSearch the projectA
Regex search across every text file in the project.
Inputs: pattern (required), flags, projectId, maxMatches.
overleaf_list_filesList project filesC
List every file and folder in the project.
Inputs: refresh, projectId.
overleaf_list_projectsList Overleaf projectsB
List projects on the signed-in Overleaf account.
Inputs: includeArchived.
overleaf_moveMove an entryB
Move a file or folder into another folder.
Inputs: filePath (required), destFolder (required), projectId.
overleaf_read_fileRead a text fileA
Read a LaTeX or other text file. Long files are truncated; use startLine and endLine to page through them.
Inputs: filePath (required), endLine, projectId, startLine.
overleaf_read_imageView an imageA
Fetch an image from the project so it can be viewed directly.
Inputs: filePath (required), projectId.
overleaf_renameRename an entryB
Rename a file or folder in place.
Inputs: newName (required), filePath (required), projectId.
overleaf_select_projectSelect active projectA
Choose the project every other tool works on. Accepts a project id or part of a project name.
Inputs: query (required).
overleaf_upload_fileUpload a local fileB
Upload a local file, such as a figure, into the project.
Inputs: filePath (required), localPath (required), projectId.
overleaf_word_countWord countC
Return the compiled word count for the project.
Inputs: projectId.
overleaf_write_fileWrite a text fileA
Create or overwrite a text file in the project. Missing parent folders are created.
Inputs: content (required), filePath (required), projectId.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools have distinct purposes (listing, reading, writing, compiling), but the three compile-related tools (overleaf_compile, overleaf_compile_log, overleaf_download_pdf) overlap in that they all trigger a compile, differing only in output handling. Similarly, read_file/read_image/download_file are distinct but share a 'get content' theme, though descriptions clarify their intended use.
All tools share the overleaf_ prefix and most follow a clear verb_noun pattern (e.g., list_projects, write_file, create_folder). Minor deviations exist: overleaf_current_project uses an adjective, overleaf_grep is just a verb, and overleaf_compile_log compounds nouns, but the overall style remains coherent and predictable.
With 19 tools, the set is slightly above the ideal 3-15 range but remains well-scoped for Overleaf's functionality, covering project selection, file operations, compilation, and reporting. Each tool adds value for typical LaTeX workflows, so the count feels justified rather than bloated.
The toolset covers the core workflow of selecting a project, editing files, uploading/downloading, and compiling with log and PDF output. Obvious gaps include lack of project creation or deletion (only listing/selecting existing projects), which may limit full lifecycle management but is not fatal for editing-focused use.
Maintenance
Related MCP Connectors
Edit your Overleaf LaTeX projects from Claude and ChatGPT; every change is a real Git commit.
Persistent AI LaTeX workspace: edit and compile multi-file projects, export publication-ready PDFs.
A hosted LaTeX editor your assistant can actually use. Search 1,019 free templates, create and edit projects, and compile them to PDF on a real TeX Live farm, getting back the PDF or the compile log when a build fails. Thirteen tools behind OAuth 2.1, with nothing to install and nothing to run locally.
- platform7nDeprecatedtech.p7n
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables editing Overleaf projects from Claude, with tools to list, read, edit, and sync files via Git.21 PyPIMIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude and AI agents to read and edit Overleaf documents in real time, with support for project listing, document manipulation, LaTeX compilation, and live collaboration.445 npm49MIT
- AlicenseNot gradedqualityBmaintenanceConnects Claude/ChatGPT to Overleaf projects via the Git integration, enabling read, edit, write, and file management through natural language commands.2AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables Claude, Cursor, or any MCP client to pull an Overleaf project, edit .tex files, check references, compile when a TeX binary is installed, and push changes back.MIT