Skip to main content
Glama

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.cmd

macOSまたはLinuxの場合:

./setup.sh

セットアップは5つのステップを実行し、それぞれを表示します:

  1. 依存関係をインストール

  2. dist/ にビルド

  3. 有効なOverleafセッションを確認。ない場合はブラウザウィンドウがOverleafのログインページで開きます

  4. 実際のプロジェクトの1つを読み戻し、接続が機能することを確認

  5. 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 list

overleaf が接続済みとして表示されるはずです。Claude Codeセッション内では、/mcp でも同じものが表示されます。

ステップ5: 使用する

自然言語で依頼するだけです。Claudeがツールを自動的に選択します。

List my Overleaf projects
Select the Efficient Reasoning project
Read sections/methodology.tex
In sections/results.tex, change "Table 1" to "Table~\ref{tab:main}"
Compile it and tell me what the LaTeX errors are
Show me figures/fig1.png
Save the compiled PDF to C:/tmp/paper.pdf

プロジェクトを一度選択すると、それが保持されます。選択内容は ~/.overleaf-claude-mcp/state.json に保存され、再起動後も維持されるため、以降のすべてのリクエストは切り替えるまでそのプロジェクトに適用されます。切り替えずに1つのリクエストで別のプロジェクトを操作するには、名前を指定してください:「私の論文プロジェクトからmain.texを読んで」。


Related MCP server: claudeleaf

トリガーの方法

スラッシュコマンドや入力するものはありません。Claudeがツールの説明を読み、リクエストが一致したときに呼び出します。Overleaf、または選択済みのプロジェクトやファイルに言及するだけで十分です。

Claudeがツールを使わない場合、よくある原因は、登録後に再起動していないか、プロジェクトがまだ選択されていないことです。「どのOverleafプロジェクトが選択されていますか?」と聞いて確認してください。

ツール

ツール

目的

overleaf_list_projects

プロジェクト一覧を表示し、選択中のものをマーク

overleaf_select_project

IDまたは名前でアクティブなプロジェクトを選択

overleaf_current_project

どのプロジェクトが選択されているかを表示

overleaf_list_files

完全なファイル・フォルダツリー

overleaf_read_file

LaTeXまたはその他のテキストファイルを読み取り

overleaf_read_image

図をインラインで表示

overleaf_download_file

PDFを含む任意のファイルをローカルに保存

overleaf_grep

プロジェクト全体を正規表現で検索

overleaf_write_file

テキストファイルを作成または上書き

overleaf_edit_file

ファイル内の文字列を正確に置換

overleaf_upload_file

図などのローカルファイルをアップロード

overleaf_create_folder

フォルダを作成し、欠落している親フォルダも作成

overleaf_rename

ファイルまたはフォルダの名前を変更

overleaf_move

ファイルまたはフォルダを移動

overleaf_delete

エントリを削除。confirm: true が必要

overleaf_compile

サーバーサイドでコンパイル

overleaf_compile_log

コンパイルして解析済みのLaTeXエラーを返す

overleaf_download_pdf

コンパイルしてPDFを保存

overleaf_word_count

コンパイル済みの単語数

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の履歴やドキュメント内の他の共同編集者は影響を受けません。欠落している親フォルダは先に作成されます。

検証済みエンドポイント

推測ではなく、実在のアカウントに対してライブで確認済み:

操作

呼び出し

備考

プロジェクト一覧

GET /project

ol-prefetchedProjectsBlob メタタグ

CSRF

GET /project

ol-csrfToken メタタグ、x-csrf-token として再送

新規プロジェクト

POST /project/new

project_id を返す

ファイルツリー

GET /socket.io/1/?projectId= の後にwebsocket

joinProjectResponse

パスのみ

GET /project/:id/entities

安価、IDなし

ドキュメント読み取り

GET /project/:id/doc/:docId/download

プレーンテキスト

バイナリ読み取り

GET /project/:id/blob/:hash

ハッシュはツリーから取得

アーカイブ

GET /project/:id/download/zip

grepに使用

作成または上書き

POST /project/:id/upload?folder_id=

multipart、フィールド qqfile

ドキュメントまたはフォルダ作成

POST /project/:id/doc、POST /project/:id/folder

ボディ {name, parent_folder_id}

名前変更

POST /project/:id/:type/:entityId/rename

204

移動

POST /project/:id/:type/:entityId/move

204、ボディ {folder_id}

削除

DELETE /project/:id/:type/:entityId

204

コンパイル

POST /project/:id/compile

outputFiles と clsiServerId を返す

単語数

GET /project/:id/wordcount

:type は doc、file、folder のいずれかです。

スクリプト

コマンド

機能

setup.cmd / ./setup.sh

ゼロからの完全セットアップ

npm run setup

依存関係がインストール済みの場合と同じ

npm run login

再認証のみ

npm run read -- "<project>"

ターミナルからプロジェクトを検査

npm run recon

すべてのエンドポイントの読み取り専用プローブ

npm run smoke

使い捨てプロジェクトでのエンドツーエンド書き込みテスト

npm run build

dist/ にコンパイル

npm run smoke は claude-mcp-smoketest というプロジェクトを作成し、書き込み、上書き、画像アップロード、名前変更、移動、削除、コンパイルを実行します。確認用にプロジェクトはアカウントに残ります。確認が終わったら削除してください。

設定

すべてオプションです。.env.example を参照してください。

変数

デフォルト

OVERLEAF_BASE_URL

https://www.overleaf.com

OVERLEAF_HOME_DIR

~/.overleaf-claude-mcp

OVERLEAF_SESSION_FILE

$OVERLEAF_HOME_DIR/session.json

OVERLEAF_CACHE_DIR

$OVERLEAF_HOME_DIR/cache

OVERLEAF_TREE_TTL_MS

15000

OVERLEAF_SOCKET_TIMEOUT_MS

20000

OVERLEAF_LOGIN_TIMEOUT_MS

600000

制限事項

これはサポート対象のAPIではなく、Overleafはいつでも変更できます。自分のアカウントに対してのみ使用してください。リアルタイム共同編集は実装されていません。書き込みは文字レベルの操作を送信するのではなくドキュメント全体を置き換えるため、他の誰かが入力している間にファイルへの書き込みは避けてください。

Available Tools

19 tools
overleaf_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

    B3.3/5.0

    Scored across 19 tools

    Disambiguation4/5

    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.

    Naming Consistency4/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers