Skip to main content

Largefile MCP Server

Navigate, search, and edit large codebases, logs, and data files that exceed AI context limits.

CI PyPI version Python 3.10+ License: MIT

Why Largefile?

  • Go beyond context limits - Read, search, and edit files too large to fit in AI context windows
  • Semantic code navigation - Tree-sitter extracts functions/classes for Python, JS/TS, Rust, Go, Java, C#, PowerShell, Bash, C/C++, Ruby, PHP, Kotlin
  • Fewer LLM errors - Search/replace editing eliminates line number mistakes common with line-based edits
  • Smart search - Fuzzy matching, regex, case-insensitive, inverted, and count-only modes
  • No size limits - Handles multi-GB files via tiered memory strategy (RAM → mmap → streaming)

Quick Start

Prerequisite: Install uv for the uvx command.

{
  "mcpServers": {
    "largefile": {
      "command": "uvx",
      "args": ["--from", "largefile", "largefile-mcp"]
    }
  }
}

Alternative: install with pip and run the server directly (largefile package, largefile-mcp command):

pip install largefile
largefile-mcp

Windows tip: uvx has a slow cold start there. Prefer installing the tools once instead:

uv tool install largefile
uv tool install diffchunk

Tools

Tool Use For
get_overview File structure and semantic outline before diving in
search_content Finding patterns, counting occurrences, regex matching
read_content Reading specific sections; tail/head modes for logs
read_enclosing Full function/class containing a given line
edit_content Safe search/replace with automatic backups
revert_edit Recovering from bad edits
list_directory Browse directory trees with recursive depth control
search_directory Search patterns across all files in a directory
find_files Find files by name, honoring .gitignore rules

When to Use Largefile

Use when:

  • File exceeds ~1000 lines or 100KB (supports multi-GB files)
  • Navigating large codebases with semantic structure
  • Analyzing log files (especially recent entries with tail mode)
  • Making search/replace edits across large files
  • Counting occurrences without loading full content

Don't use for:

  • Small files that fit in context (AI doesn't need help with those)
  • Binary files (images, executables, compressed)

Usage Examples

Large Codebase Navigation

# Get semantic structure of a large Python file
overview = get_overview("/path/to/large_module.py")
# Returns: 2,847 lines, 15 classes, function outline via Tree-sitter

# Find all class definitions
classes = search_content("/path/to/large_module.py", "class ", fuzzy=False)

# Read the class containing a specific line
code = read_enclosing("/path/to/large_module.py", line=412)

Batch Refactoring

# Preview rename across file
preview = edit_content(
    "/path/to/api.py",
    changes=[
        {"search": "process_data", "replace": "transform_data"},
        {"search": "old_endpoint", "replace": "new_endpoint"},
    ],
    preview=True,
)

# Apply changes (creates automatic backup)
result = edit_content("/path/to/api.py", changes=[...], preview=False)

# Undo if needed
revert_edit("/path/to/api.py")

Log Analysis

# Get log file overview
overview = get_overview("/var/log/app.log")
# Returns: 150,000 lines, 2.1GB

# Read last 500 lines efficiently
recent = read_content("/var/log/app.log", limit=500, mode="tail")

# Count errors without loading content
error_count = search_content("/var/log/app.log", "ERROR", count_only=True, fuzzy=False)

# Find errors with regex
errors = search_content("/var/log/app.log", r"ERROR.*timeout", regex=True)

Supported Languages

Tree-sitter semantic analysis for: Python, JavaScript/JSX, TypeScript/TSX, Rust, Go, Java, C#, PowerShell, Bash, C/C++, Ruby, PHP, Kotlin

Other file types use text-based analysis with graceful fallback.

File Size Handling

Size Strategy
< 50MB Full memory loading with AST caching
50-500MB Memory-mapped access
> 500MB Streaming (tail/head modes recommended)

Configuration

Environment variables for tuning (see the Configuration Guide for the full list):

LARGEFILE_MEMORY_THRESHOLD_MB=50      # RAM loading limit
LARGEFILE_MMAP_THRESHOLD_MB=500       # Memory mapping limit
LARGEFILE_FUZZY_THRESHOLD=0.8         # Match sensitivity (0.0-1.0)
LARGEFILE_MAX_OUTPUT_TOKENS=4000      # Response token budget per tool call
LARGEFILE_BACKUP_DIR=~/.largefile/backups
LARGEFILE_MAX_BACKUPS=10              # Backups kept per file
LARGEFILE_SEARCH_TIMEOUT=5            # Regex search time budget (seconds)

Documentation

Metadata

Release files for largefile 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for largefile 1.0.0
File Size Uploaded Provenance Actions
largefile-1.0.0.tar.gz 2.8 MB Without provenance Details for largefile-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for largefile 1.0.0
File Interpreter ABI Platform Actions
largefile-1.0.0-py3-none-any.whl Python 3 none any Details for largefile-1.0.0-py3-none-any.whl

Total release size: 2.9 MB

Release files / largefile-1.0.0.tar.gz

Download URL largefile-1.0.0.tar.gz
Size 2.8 MB
Tags Source
SHA-256 checksum
How to use checksums
240d6bf37ae312627c2481b4c9c4c2db38e5216aea200e7d1f13226cb597d7b3
BLAKE2b-256 checksum
How to use checksums
a0f8bd02841e339187b6417fc445da4bd909b844acfa4b40fcfca1afe267aa4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / largefile-1.0.0-py3-none-any.whl

Download URL largefile-1.0.0-py3-none-any.whl
Size 58.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ece25199694e6c903f8542e3369531fe2587378e703c61d5d0d9c347a573c72
BLAKE2b-256 checksum
How to use checksums
e412cde0cb1cf025b36898927bdbd52590ac1c66afd2e711ea0f55fd9cd0935d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for largefile 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page