Skip to main content
Glama
Large File Context MCP Server

Large File Context MCP Server

by MaybeLOL
README.md
# Large File Context MCP Server

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Node.js 18+](https://img.shields.io/badge/Node.js-18%2B-green.svg)](https://nodejs.org)
[![MCP Compatible](https://img.shields.io/badge/MCP-Compatible-purple.svg)](https://modelcontextprotocol.io)
[![Zero Config](https://img.shields.io/badge/Setup-Zero%20Config-orange.svg)](#quick-start)

**Give Claude Code full access to files of any size.** Paginated reading, regex search, and large file writing -- no truncation, no limits.

Claude Code's built-in file reading breaks down on large files. Anything over a few thousand lines gets truncated or refused entirely. If you work with large codebases, verbose configs, log files, or generated code, you've hit this wall.

This MCP server removes it. Read any range of any file, search with regex, write without size constraints. Plain JavaScript, no build step, works in seconds.

---

## Why This Exists

Claude Code truncates large files and can't search efficiently within them. That's a problem when you're working with:

- Source files that are 5,000+ lines
- Monorepo configs and lock files
- Application logs and CSV data
- Auto-generated or bundled code

This server gives Claude paginated, line-level access to the full contents of any file on disk. It plugs directly into Claude Code via MCP with zero configuration beyond pointing it at the server.

---

## Features

**Paginated File Reading** -- Read exactly the lines you need. Line 5000 to 5100 of a 50,000-line file? Done. Byte-range reads supported too.

**Regex Search** -- Find patterns inside massive files without reading the whole thing. Supports case-insensitive search, regex, and configurable context lines around each match.

**File Metadata** -- Check size, line count, and binary detection before deciding how to read a file.

**Large File Writing** -- Write or append content to files of any size. Automatically creates parent directories when needed.

---

## Quick Start

Three steps. No build, no environment variables.

```bash
git clone https://github.com/MaybeLOL/large-file-context-mcp.git
cd large-file-context-mcp
npm install
```

Then add it to your Claude Code MCP config (`~/.claude/mcp.json`):

```json
{
  "mcpServers": {
    "large-file-context": {
      "command": "node",
      "args": ["/path/to/large-file-context-mcp/server.js"]
    }
  }
}
```

Replace `/path/to/large-file-context-mcp` with the absolute path to your cloned repo. That's it.

---

## Tools Reference

### file_info

Get file metadata before reading. Returns size, line count, modified/created dates, and whether the file is binary.

```
path: "/absolute/path/to/file"
```

### read_file_chunked

Read a file with line-based or byte-based pagination. Defaults to the first 1000 lines.

| Parameter  | Default   | Description                              |
|------------|-----------|------------------------------------------|
| `path`     | required  | Absolute file path                       |
| `offset`   | `0`       | Start line (0-based) or byte offset      |
| `limit`    | `1000`    | Max lines or bytes to return             |
| `mode`     | `"lines"` | `"lines"` or `"bytes"`                   |
| `encoding` | `"utf-8"` | File encoding                            |

### search_in_file

Search for text or regex patterns within a file. Returns matching lines with line numbers.

| Parameter       | Default  | Description                              |
|-----------------|----------|------------------------------------------|
| `path`          | required | Absolute file path                       |
| `pattern`       | required | Text or regex pattern                    |
| `isRegex`       | `false`  | Treat pattern as a regular expression    |
| `caseSensitive` | `true`   | Case-sensitive matching                  |
| `maxResults`    | `100`    | Maximum number of matches to return      |
| `contextLines`  | `0`      | Lines of context before and after match  |

### write_file_large

Write or append content to a file. Optionally creates parent directories.

| Parameter    | Default   | Description                              |
|--------------|-----------|------------------------------------------|
| `path`       | required  | Absolute file path                       |
| `content`    | required  | Content to write                         |
| `mode`       | `"write"` | `"write"` (overwrite) or `"append"`      |
| `createDirs` | `false`   | Create parent directories if missing     |
| `encoding`   | `"utf-8"` | File encoding                            |

---

## Use Cases

**Large codebases** -- Navigate enterprise-scale source files without truncation. Jump to specific line ranges, search for symbols, read only what matters.

**Log files** -- Tail the last 200 lines of a 500MB log, or search for error patterns with context lines to see what happened before and after.

**Data files** -- Inspect specific rows in large CSVs, JSON dumps, or SQL exports without loading the entire file into context.

**Generated code** -- Read through bundled output, compiled artifacts, or auto-generated API clients that routinely exceed normal read limits.

**Monorepo configs** -- Parse massive lock files, CI configs, or dependency manifests that Claude Code would otherwise refuse to read.

---

## License

MIT