Large File MCP Server
The Large File MCP Server enables intelligent handling, navigation, and analysis of large files without loading them fully into memory:
Read file chunks (
read_large_file_chunk): Access specific parts of large files using intelligent chunking with auto-detected optimal chunk sizes, with optional line numbers.Search within files (
search_in_large_file): Search for text or regex patterns with configurable case sensitivity, context lines around matches, result limits, and optional line range scoping.Navigate to a specific line (
navigate_to_line): Jump directly to any line number and view it with surrounding context.Analyze file structure (
get_file_structure): Get comprehensive metadata including line statistics, recommended chunk size, and sample content from the start and end of a file.Get a file summary (
get_file_summary): Retrieve statistical summaries including line counts, character statistics, and word counts.Stream large files (
stream_large_file): Efficiently stream very large files in configurable byte-based chunks from a specified offset.Optimized performance: Built-in LRU caching speeds up repeated access, and flexible environment variable configuration controls chunking, caching, and maximum file size handling.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Large File MCP Serverfind all ERROR lines in /var/log/app.log with 5 lines of context"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Large File MCP Server
MCP server for intelligent handling of large files β smart chunking, search, navigation, and streaming.
π Live Demo / Landing Page β install with
npx @willianpinho/large-file-mcpπ Full Documentation | API Reference | Examples
Features
Smart Chunking - Automatically determines optimal chunk size based on file type
Intelligent Navigation - Jump to specific lines with surrounding context
Powerful Search - Regex support with context lines before/after matches
File Analysis - Comprehensive metadata and statistical analysis
Memory Efficient - Stream files of any size without loading into memory
Performance Optimized - Built-in LRU caching for frequently accessed chunks
Type Safe - Written in TypeScript with strict typing
Cross-Platform - Works on Windows, macOS, and Linux
Related MCP server: Excel Analyser MCP
Installation
npm install -g @willianpinho/large-file-mcpOr use directly with npx:
npx @willianpinho/large-file-mcpQuick Start
Claude Code CLI
Add the MCP server using the CLI:
# Add for current project only (local scope)
claude mcp add --transport stdio --scope local large-file-mcp -- npx -y @willianpinho/large-file-mcp
# Add globally for all projects (user scope)
claude mcp add --transport stdio --scope user large-file-mcp -- npx -y @willianpinho/large-file-mcpVerify installation:
claude mcp list
claude mcp get large-file-mcpRemove if needed:
# Remove from local scope
claude mcp remove large-file-mcp -s local
# Remove from user scope
claude mcp remove large-file-mcp -s userMCP Scopes:
local- Available only in the current project directoryuser- Available globally for all projectsproject- Defined in.mcp.jsonfor team sharing
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"large-file": {
"command": "npx",
"args": ["-y", "@willianpinho/large-file-mcp"]
}
}
}Config file locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Restart Claude Desktop after editing.
Other AI Platforms
Gemini:
{
"tools": [
{
"name": "large-file-mcp",
"command": "npx @willianpinho/large-file-mcp",
"protocol": "mcp"
}
]
}Usage
Once configured, you can use natural language to interact with large files:
Read the first chunk of /var/log/system.logFind all ERROR messages in /var/log/app.logShow me line 1234 of /code/app.ts with contextGet the structure of /data/sales.csvAvailable Tools
read_large_file_chunk
Read a specific chunk of a large file with intelligent chunking.
Parameters:
filePath(required): Absolute path to the filechunkIndex(optional): Zero-based chunk index (default: 0)linesPerChunk(optional): Lines per chunk (auto-detected if not provided)includeLineNumbers(optional): Include line numbers (default: false)
Example:
{
"filePath": "/var/log/system.log",
"chunkIndex": 0,
"includeLineNumbers": true
}search_in_large_file
Search for patterns in large files with context.
Parameters:
filePath(required): Absolute path to the filepattern(required): Search patterncaseSensitive(optional): Case sensitive search (default: false)regex(optional): Use regex pattern (default: false)maxResults(optional): Maximum results (default: 100)contextBefore(optional): Context lines before match (default: 2)contextAfter(optional): Context lines after match (default: 2)
Example:
{
"filePath": "/var/log/error.log",
"pattern": "ERROR.*database",
"regex": true,
"maxResults": 50
}get_file_structure
Analyze file structure and get comprehensive metadata.
Parameters:
filePath(required): Absolute path to the file
Returns: File metadata, line statistics, recommended chunk size, and sample lines.
navigate_to_line
Jump to a specific line with surrounding context.
Parameters:
filePath(required): Absolute path to the filelineNumber(required): Line number to navigate to (1-indexed)contextLines(optional): Context lines before/after (default: 5)
get_file_summary
Get comprehensive statistical summary of a file.
Parameters:
filePath(required): Absolute path to the file
Returns: File metadata, line statistics, character statistics, and word count.
stream_large_file
Stream a file in chunks for processing very large files.
Parameters:
filePath(required): Absolute path to the filechunkSize(optional): Chunk size in bytes (default: 64KB)startOffset(optional): Starting byte offset (default: 0)maxChunks(optional): Maximum chunks to return (default: 10)
Supported File Types
The server intelligently detects and optimizes for:
Text files (.txt) - 500 lines/chunk
Log files (.log) - 500 lines/chunk
Code files (.ts, .js, .py, .java, .cpp, .go, .rs, etc.) - 300 lines/chunk
CSV files (.csv) - 1000 lines/chunk
JSON files (.json) - 100 lines/chunk
XML files (.xml) - 200 lines/chunk
Markdown files (.md) - 500 lines/chunk
Configuration files (.yml, .yaml, .sh, .bash) - 300 lines/chunk
Configuration
Customize behavior using environment variables:
Variable | Description | Default |
| Default lines per chunk | 500 |
| Overlap between chunks | 10 |
| Maximum file size in bytes | 10GB |
| Cache size in bytes | 100MB |
| Cache TTL in milliseconds | 5 minutes |
| Enable/disable caching | true |
Example with custom settings (Claude Desktop):
{
"mcpServers": {
"large-file": {
"command": "npx",
"args": ["-y", "@willianpinho/large-file-mcp"],
"env": {
"CHUNK_SIZE": "1000",
"CACHE_ENABLED": "true"
}
}
}
}Example with custom settings (Claude Code CLI):
claude mcp add --transport stdio --scope user large-file-mcp \
--env CHUNK_SIZE=1000 \
--env CACHE_ENABLED=true \
-- npx -y @willianpinho/large-file-mcpExamples
Analyzing Log Files
Analyze /var/log/nginx/access.log and find all 404 errorsThe AI will use the search tool to find patterns and provide context around each match.
Code Navigation
Find all function definitions in /project/src/main.pyUses regex search to locate function definitions with surrounding code context.
CSV Data Exploration
Show me the structure of /data/sales.csvReturns metadata, line count, sample rows, and recommended chunk size.
Large File Processing
Stream the first 100MB of /data/huge_dataset.jsonUses streaming mode to handle very large files efficiently.
Performance
Caching
LRU Cache with configurable size (default 100MB)
TTL-based expiration (default 5 minutes)
Speeds up repeated access to the same file chunk or structure lookup
Cache hit-rate depends entirely on your access pattern (how often you re-request
the same chunk), so there's no single universal number β run pnpm run benchmark
to measure it against a documented, repeatable "hot chunk" workload. On that
workload it currently measures 95% (95/100 accesses hit the cache).
Memory Management
Streaming architecture - files are read line-by-line, never fully loaded
Configurable chunk sizes - adjust based on your use case
Smart buffering - minimal memory footprint for search operations
Read Latency (measured)
Uncached readChunk() latency from scripts/benchmark.mjs, generated fixtures,
Apple M1 Pro laptop β re-run the script on your own hardware for your own numbers:
File Size | Observed Latency | Method |
~500KB | ~6-8ms | Direct read |
~5MB | ~17-24ms | Streaming |
~50MB | ~120-200ms | Streaming |
Larger tiers (100MB-1GB, >1GB) aren't benchmarked here β the streaming
architecture (line-by-line readline, never loading the full file) means time
scales roughly linearly with size, and streamFile() switches to an
AsyncGenerator so memory stays flat regardless of file size.
Development
Building from Source
git clone https://github.com/willianpinho/large-file-mcp.git
cd large-file-mcp
pnpm install
pnpm buildDevelopment Mode
pnpm dev # Watch mode
pnpm lint # Run linter
pnpm start # Run serverProject Structure
src/
βββ index.ts # Entry point
βββ server.ts # MCP server implementation
βββ fileHandler.ts # Thin barrel β delegates to src/file-handler/*
βββ file-handler/ # Chunking, search, navigation, streaming (split by concern)
βββ cacheManager.ts # Caching implementation
βββ types.ts # TypeScript type definitionsTroubleshooting
File not accessible
Ensure the file path is absolute and the file has read permissions:
chmod +r /path/to/fileOut of memory
Reduce
CHUNK_SIZEenvironment variableDisable cache with
CACHE_ENABLED=falseUse
stream_large_filefor very large files
Slow search performance
Reduce
maxResultsparameterUse
startLineandendLineto limit search rangeEnsure caching is enabled
Claude Code CLI: MCP server not found
Check if the server is installed:
claude mcp listIf not listed, reinstall:
claude mcp add --transport stdio --scope user large-file-mcp -- npx -y @willianpinho/large-file-mcpCheck server health:
claude mcp get large-file-mcpDesigned For
Log Analysis: Processing multi-GB log files with search and navigation
Data Processing: Reading large CSV/JSON files in manageable chunks
Code Review: Navigating large codebases efficiently
System Monitoring: Analyzing system logs and debug outputs
Document Analysis: Processing large text documents
Compatible with Claude Code, Cursor, and Gemini CLI. Available on npm and the Glama.ai registry, and listed in community awesome-MCP directories.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Development Workflow
Fork the repository
Create a feature branch
Make your changes
Ensure code builds and lints successfully
Submit a pull request
See CONTRIBUTING.md for detailed guidelines.
License
MIT
Support
Issues: GitHub Issues
Documentation: This README and inline code documentation
Examples: Check the
examples/directory
Acknowledgments
Built with the Model Context Protocol SDK.
Made for the AI developer community.
Available Tools
6 toolsget_file_structureB
Analyze file structure and get comprehensive metadata including line statistics, recommended chunk size, and samples from start and end.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description bears full burden for behavioral disclosure. It mentions what metadata is returned but does not disclose whether the tool reads the entire file, any size limits, side effects, or performance implications. This is a significant gap for a tool that likely processes file contents.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that packs in the purpose and key outputs. It is concise and front-loaded, but slightly dense; could be split for readability. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the moderate complexity, no output schema, and siblings, the description lists key return values but lacks context on prerequisites (file existence, access) and how it relates to sibling tools. It is adequate but not comprehensive.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The single parameter 'filePath' is described as 'Absolute path to the file' in the schema. The description adds no additional meaning beyond the schema. With 100% schema coverage, baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's verb 'analyze' and 'get' with the resource 'file structure' and lists specific metadata types (line statistics, recommended chunk size, samples). This distinguishes it from siblings like get_file_summary which likely provides a summary, or read_large_file_chunk which reads content.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for analyzing file structure but provides no explicit guidance on when to use this tool versus alternatives like read_large_file_chunk or search_in_large_file. No when-not-to-use or prerequisite information is given.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_file_summaryA
Get comprehensive statistical summary of a file including line stats, character stats, and word count.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It discloses that the tool returns line stats, character stats, and word count, but does not mention performance, limitations, or side effects. The read-only nature is implied but not explicit.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the main purpose. Every word adds valueβno redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the simplicity of the tool (1 parameter, no output schema), the description provides basic context about the output. However, it does not specify return format or whether additional stats may be included, leaving some gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% for the single parameter filePath, so the baseline is 3. The tool description adds no additional meaning beyond the schema description of the parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool gets a comprehensive statistical summary of a file, listing specific stats (line, character, word count). It distinguishes from sibling tools like get_file_structure or read_large_file_chunk.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use (for file stats) but does not explicitly state when not to use or alternatives. While sibling names suggest different use cases, no direct guidance is provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_large_file_chunkA
Read a specific chunk of a large file with intelligent chunking based on file type. Automatically determines optimal chunk size.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file | |
| chunkIndex | No | Zero-based chunk index to read (default: 0) | |
| linesPerChunk | No | Number of lines per chunk (optional, auto-detected if not provided) | |
| includeLineNumbers | No | Include line numbers in output (default: false) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description should fully disclose behavior. It mentions 'intelligent chunking' and 'optimal chunk size' but lacks details on error handling, performance implications, or how 'file type' influences chunking, leaving significant gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no extraneous text, front-loaded with purpose and key behavior. Every sentence is valuable and compact.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 4 parameters and no output schema, the description is decent but lacks details on return format, error cases, and how 'file type' detection works, which are important for correct usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%. The description adds value by explaining that linesPerChunk is optional and auto-detected, and chunkIndex is zero-based, providing context beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses clear verb 'Read' and resource 'specific chunk of a large file', and highlights intelligent chunking behavior, distinguishing it from siblings like stream_large_file and search_in_large_file.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for reading specific chunks but does not provide explicit guidance on when to use this tool versus alternatives like stream_large_file or search_in_large_file, nor does it mention when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_in_large_fileA
Search for a pattern in a large file with context lines. Supports regex and case-sensitive search.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file | |
| pattern | Yes | Search pattern (supports regex if regex=true) | |
| caseSensitive | No | Case sensitive search (default: false) | |
| regex | No | Use regex pattern (default: false) | |
| maxResults | No | Maximum number of results (default: 100) | |
| contextBefore | No | Number of context lines before match (default: 2) | |
| contextAfter | No | Number of context lines after match (default: 2) | |
| startLine | No | Start searching from line number (optional) | |
| endLine | No | End searching at line number (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions search features but does not disclose side effects, performance implications, or whether the tool is read-only. There is no contradiction.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with key information, no unnecessary words. Every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema, the description should explain the return format (e.g., lines with context). It does not. Also, it does not mention that filePath must be absolute. The description is adequate for basic usage but incomplete for full understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so baseline is 3. The tool description adds minimal extra meaning beyond repeating schema information (e.g., 'supports regex'). Does not significantly compensate for low coverage (not applicable).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it searches for a pattern in a large file with context lines, and explicitly mentions regex and case-sensitive search. It distinguishes from sibling tools like read_large_file_chunk and stream_large_file.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for pattern searching but does not provide explicit guidance on when to use versus alternatives, nor does it mention any prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
stream_large_fileC
Stream a large file in chunks. Returns multiple chunks for processing very large files efficiently.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file | |
| chunkSize | No | Chunk size in bytes (default: 65536 - 64KB) | |
| startOffset | No | Starting byte offset (default: 0) | |
| maxBytes | No | Maximum bytes to stream (optional) | |
| maxChunks | No | Maximum number of chunks to return (default: 10) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It states it returns multiple chunks but omits details such as response format, error behavior, or whether it is a read operation. More behavioral context is needed for safe invocation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two succinct, front-loaded sentences. No wasted words. The core action and purpose are immediately clear.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite good conciseness, the description lacks completeness given the tool's complexity. It does not explain how chunks are delivered (e.g., response structure, pagination) or how to process them. The absence of an output schema further burdens the description to provide this context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% coverage, so baseline is 3. The description does not add extra meaning beyond the schema; it only reiterates that chunks are returned. No parameter descriptions are enhanced.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool streams a large file in chunks for efficient processing. It uses a specific verb and resource, but does not explicitly differentiate from sibling tool 'read_large_file_chunk', which likely serves a similar purpose.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives like 'read_large_file_chunk'. The description implies use for large files requiring multiple chunks, but there is no explicit when-not or mention of alternative scenarios.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
- First observed
get_file_structure - First observed
get_file_summary - First observed
navigate_to_line - First observed
read_large_file_chunk - First observed
search_in_large_file - First observed
stream_large_file
TDQS
Scored across 6 tools
Most tools have clearly distinct purposes (navigate, search, stream, read chunk). However, get_file_structure and get_file_summary both provide file statistics, creating slight ambiguity about which to use for metadata needs.
All tool names follow a consistent verb_noun pattern with snake_case (e.g., get_file_structure, navigate_to_line). The naming is predictable and clear across all six tools.
Six tools cover the core capabilities for reading and analyzing large files (structure, summary, navigation, chunking, searching, streaming). The count is well-scoped for the domain.
The tool set provides comprehensive read-only operations: structural metadata, statistical summary, targeted line access, chunked reading, pattern searching, and streaming. No obvious gaps for the declared purpose.
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Manage files and folders directly from your workspace. Read and write files, list directories, creβ¦
Access the GitHub API, enabling file operations, repository management, search functionality, andβ¦
Securely search and manage workspace context files for AI agents and teams.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides LLM-optimized filesystem access with intelligent file pagination for large files, lightning-fast ripgrep-powered code search with regex support, and security sandboxing to safely explore and search codebases.751MIT
- AlicenseNot gradedqualityDmaintenanceEnables efficient reading, analyzing, and querying of Excel, CSV, and JSON files with support for chunked processing, column/field filtering, and streaming for large datasets. Supports multiple transport protocols (stdio, HTTP, SSE) for flexible integration.144ISC
- AlicenseAqualityBmaintenanceEnables LLMs to efficiently navigate and analyze large diff files by providing pattern-based chunk navigation, allowing direct access to relevant changes without loading entire diffs into context.58MIT
- AlicenseAqualityCmaintenanceNavigate, search, and edit large codebases, logs, and data files that exceed AI context limits.811MIT