Skip to content

Configuration

Environment Variables

Customize Large File MCP Server behavior using environment variables:

VariableDescriptionDefaultType
CHUNK_SIZEDefault lines per chunk500number
OVERLAP_LINESOverlap between chunks10number
MAX_FILE_SIZEMaximum file size (bytes)10GBnumber
CACHE_SIZECache size (bytes)100MBnumber
CACHE_TTLCache TTL (milliseconds)5 minutesnumber
CACHE_ENABLEDEnable/disable cachingtrueboolean

Configuration Examples

Claude Desktop Configuration

json
{
  "mcpServers": {
    "large-file": {
      "command": "npx",
      "args": ["-y", "@willianpinho/large-file-mcp"],
      "env": {
        "CHUNK_SIZE": "1000",
        "OVERLAP_LINES": "20",
        "CACHE_SIZE": "209715200",
        "CACHE_TTL": "600000",
        "CACHE_ENABLED": "true"
      }
    }
  }
}

Claude Code CLI Configuration

bash
claude mcp add --transport stdio --scope user large-file-mcp \
  --env CHUNK_SIZE=1000 \
  --env OVERLAP_LINES=20 \
  --env CACHE_SIZE=209715200 \
  --env CACHE_TTL=600000 \
  --env CACHE_ENABLED=true \
  -- npx -y @willianpinho/large-file-mcp

Tuning Recommendations

For Log Files

json
{
  "env": {
    "CHUNK_SIZE": "500",
    "CACHE_ENABLED": "true",
    "CACHE_TTL": "300000"
  }
}

Best for: Analyzing rotating log files with frequent access.

For Large CSV Files

json
{
  "env": {
    "CHUNK_SIZE": "1000",
    "OVERLAP_LINES": "1",
    "CACHE_SIZE": "524288000"
  }
}

Best for: Processing large datasets with sequential access.

For Code Navigation

json
{
  "env": {
    "CHUNK_SIZE": "300",
    "OVERLAP_LINES": "15",
    "CACHE_ENABLED": "true"
  }
}

Best for: Navigating large codebases with context.

For Memory-Constrained Systems

json
{
  "env": {
    "CHUNK_SIZE": "200",
    "CACHE_SIZE": "52428800",
    "CACHE_ENABLED": "true"
  }
}

Best for: Systems with limited RAM.

For High-Performance Systems

json
{
  "env": {
    "CHUNK_SIZE": "2000",
    "CACHE_SIZE": "1073741824",
    "CACHE_TTL": "1800000"
  }
}

Best for: Servers with ample RAM and high throughput needs.

Cache Configuration

Understanding Cache Behavior

The LRU (Least Recently Used) cache stores:

  • File chunks (from read_large_file_chunk)
  • File metadata (from get_file_structure)

Cache entries are evicted when:

  • TTL expires (default 5 minutes)
  • Cache size limit is reached
  • Manually cleared

Cache Statistics

Monitor cache performance:

  • Hit rate: 80-90% for typical workloads
  • Memory usage: Tracks current usage vs. max size
  • Utilization percentage: (current / max) * 100

Disabling Cache

Disable caching for specific scenarios:

json
{
  "env": {
    "CACHE_ENABLED": "false"
  }
}

When to disable:

  • One-time file processing
  • Memory-critical environments
  • Files change frequently

Performance Tuning

Chunk Size Guidelines

File TypeRecommended SizeReasoning
Logs500-1000Balance context and performance
Code200-400Preserve function context
CSV1000-5000Data rows are typically small
JSON50-200JSON objects can be large
Text500-1000General purpose

Memory Usage Estimation

Approximate memory usage:

Memory = (CACHE_SIZE) + (Active chunk size * concurrent operations)

Example:
CACHE_SIZE = 100MB
CHUNK_SIZE = 500 lines
Average line = 100 bytes
Concurrent ops = 3

Memory ≈ 100MB + (500 * 100 * 3) = ~100.15MB

Troubleshooting

Out of Memory

Reduce CACHE_SIZE and CHUNK_SIZE:

json
{
  "env": {
    "CHUNK_SIZE": "200",
    "CACHE_SIZE": "52428800"
  }
}

Slow Performance

Increase CACHE_SIZE and enable caching:

json
{
  "env": {
    "CACHE_SIZE": "524288000",
    "CACHE_ENABLED": "true",
    "CACHE_TTL": "600000"
  }
}

Files Not Found

Ensure absolute paths are used:

typescript
// Correct
filePath: "/Users/username/project/file.log"

// Incorrect
filePath: "~/project/file.log"
filePath: "./file.log"

Next Steps

Released under the MIT License.