Labsco
mjyoo2 logo

Overleaf

โ˜… 186

from mjyoo2

Access and analyze Overleaf projects and LaTeX files through Git integration.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

Overleaf MCP Server

An MCP (Model Context Protocol) server that provides access to Overleaf projects via Git integration. This allows Claude and other MCP clients to read LaTeX files, analyze document structure, extract content, and write files from and to Overleaf projects.

Features

  • ๐Ÿ“„ File Management: List, read, and write files from and to Overleaf projects
  • ๐Ÿ“‹ Document Structure: Parse LaTeX sections and subsections
  • ๐Ÿ” Content Extraction: Extract specific sections by title
  • ๐Ÿ“Š Project Summary: Get overview of project status and structure
  • ๐Ÿ—๏ธ Multi-Project Support: Manage multiple Overleaf projects

Getting Overleaf Credentials

  1. Project ID โ€” open your Overleaf project; the ID is in the URL: https://www.overleaf.com/project/[PROJECT_ID]
  2. Git Token โ€” Overleaf โ†’ Account Settings โ†’ Git Integration โ†’ "Create Token"

Local Development

If you want to hack on the server, test changes before publishing, or use it without the npm package being available, you have three local-install options.

Option 1 โ€” Run the cloned script directly

Copy & paste โ€” that's it
git clone https://github.com/mjyoo2/OverleafMCP.git
cd OverleafMCP
npm install

Then point Claude Desktop at the script and pass credentials via env vars (the same loader path the npm package uses):

Copy & paste โ€” that's it
{
  "mcpServers": {
    "overleaf": {
      "command": "node",
      "args": ["/absolute/path/to/OverleafMCP/overleaf-mcp-server.js"],
      "env": {
        "OVERLEAF_PROJECT_ID": "...",
        "OVERLEAF_GIT_TOKEN": "olp_..."
      }
    }
  }
}

On Windows, args should use "C:\\Users\\you\\OverleafMCP\\overleaf-mcp-server.js".

If you'd rather use a multi-project file:

Copy & paste โ€” that's it
cp projects.example.json projects.json   # then edit it

projects.json next to the script is the lowest-priority fallback, so this still works without env vars.

Option 2 โ€” Test the packed npm artifact locally

Validates almost the same code path users hit through the public registry, useful before pushing a release:

Copy & paste โ€” that's it
npm pack
# โ†’ mjyoo2-overleaf-mcp-<version>.tgz

Point Claude Desktop at the tarball. Note the explicit --package= and bin name โ€” npx -y <tarball-path> does not work in npm 10+ (the path is mis-detected as an executable):

Copy & paste โ€” that's it
{
  "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_..."
      }
    }
  }
}

On macOS / Linux drop the cmd /c wrapper: "command": "npx", "args": ["-y", "--package=/abs/path/to/...tgz", "overleaf-mcp"].

Option 3 โ€” Smoke-test the MCP protocol from the shell

No Claude Desktop required:

Copy & paste โ€” that's it
OVERLEAF_PROJECT_ID=... OVERLEAF_GIT_TOKEN=... node overleaf-mcp-server.js

You should see Overleaf MCP server running on stdio on stderr. The process stays open waiting for JSON-RPC on stdin; Ctrl+C to exit.

Available Tools

list_projects

List all configured projects.

list_files

List files in a project (default: .tex files).

  • extension: File extension filter (optional)
  • projectName: Project identifier (optional, defaults to "default")

read_file

Read a specific file from the project.

  • filePath: Path to the file (required)
  • projectName: Project identifier (optional)

get_sections

Get all sections from a LaTeX file.

  • filePath: Path to the LaTeX file (required)
  • projectName: Project identifier (optional)

get_section_content

Get content of a specific section.

  • filePath: Path to the LaTeX file (required)
  • sectionTitle: Title of the section (required)
  • projectName: Project identifier (optional)

status_summary

Get a comprehensive project status summary.

  • projectName: Project identifier (optional)

write_file

Write the full content of a file to the project.

  • filePath: Path to the file (required)
  • content: Content to write to the file (required)
  • commitMessage: Commit message (required)
  • projectName: Project identifier (optional)

write_section

Write the content of a specific section to the project.

  • filePath: Path to the file (required)
  • sectionTitle: Title of the section (required)
  • newContent: Replacement content for the section, including the section heading (required)
  • commitMessage: Commit message (required)
  • projectName: Project identifier (optional)

Security Notes

  • The Overleaf Git token grants full read/write access to your project โ€” treat it like a password.
  • Prefer OVERLEAF_GIT_TOKEN_FILE over inlining the token in the Claude Desktop JSON if your config file is backed up or synced.
  • projects.json is .gitignored in this repo. Never commit real project IDs or Git tokens.
  • File paths supplied through MCP tool calls are restricted to the cloned project directory; .. traversal and absolute paths are rejected.

License

MIT License