# Repomix [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/yamadashy/repomix  
**GitHub Stars:** 29247  
**npm Downloads (last month):** 422263  
**Views:** 6  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/repomix

## Description
Pack local or remote codebases into AI-friendly files that LLMs and coding agents can read or search

## Tools
Capabilities this server exposes over MCP:

- **pack_codebase** — Package a local code directory into a consolidated XML file for AI analysis
- **directory** — Absolute path to the directory to pack
- **compress** — (Optional, default: false) Enable Tree-sitter compression to extract essential code signatures and structure while removing implementation details. Reduces token usage by ~70% while preserving semantic meaning. Generally not needed since grep_repomix_output allows incremental content retrieval. Use…
- **includePatterns** — (Optional) Specify files to include using fast-glob patterns. Multiple patterns can be comma-separated (e.g., "**/*.{js,ts}", "src/**,docs/**"). Only matching files will be processed.
- **ignorePatterns** — (Optional) Specify additional files to exclude using fast-glob patterns. Multiple patterns can be comma-separated (e.g., "test/**,*.spec.js", "node_modules/**,dist/**"). These patterns supplement .gitignore, .ignore, and built-in exclusions.
- **outputPatterns** — (Optional) Per-file inclusion levels, mirroring the config-file `output.patterns` option. An array of `{ pattern, compress?, directoryStructureOnly? }` entries; the first matching pattern wins, `directoryStructureOnly` takes precedence over `compress`, and a match with neither flag forces full cont…
- **topFilesLength** — (Optional, default: 10) Number of largest files by size to display in the metrics summary for codebase analysis.
- **attach_packed_output** — Attach an existing Repomix packed output file for AI analysis
- **path** — Path to a directory containing repomix-output.xml or direct path to a packed repository XML file
- **pack_remote_repository** — Fetch, clone, and package a GitHub repository into a consolidated XML file for AI analysis
- **remote** — GitHub repository URL or user/repo format (e.g., "yamadashy/repomix", "https://github.com/user/repo", or "https://github.com/user/repo/tree/branch")
- **read_repomix_output** — Read the contents of a Repomix-generated output file. Supports partial reading with line range specification for large files.
- **outputId** — ID of the Repomix output file to read
- **startLine** — (Optional) Starting line number (1-based, inclusive). If not specified, reads from beginning.
- **endLine** — (Optional) Ending line number (1-based, inclusive). If not specified, reads to end.
- **grep_repomix_output** — Search for patterns in a Repomix output file using grep-like functionality with JavaScript RegExp syntax
- **pattern** — Search pattern (JavaScript RegExp regular expression syntax)
- **contextLines** — (Optional, default: 0) Number of context lines to show before and after each match. Overridden by beforeLines/afterLines if specified.
- **beforeLines** — (Optional) Number of context lines to show before each match (like grep -B). Takes precedence over contextLines.
- **afterLines** — (Optional) Number of context lines to show after each match (like grep -A). Takes precedence over contextLines.
- **ignoreCase** — (Optional, default: false) Perform case-insensitive matching
- **file_system_read_file** — Read a file inside the sandbox workspace. Only available in [sandbox mode](#sandbox-mode) (`--sandbox`), where the workspace root bounds what it can reach.
- **file_system_read_directory** — List the contents of a directory inside the sandbox workspace. Only available in [sandbox mode](#sandbox-mode) (`--sandbox`).

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "repomix": {
    "command": "npx",
    "args": ["-y","repomix@latest"]
  }
}
```

## Documentation

## What Repomix does

Repomix turns a codebase into an AI-readable artifact and exposes that workflow through MCP tools. Local directories can be packed into a consolidated XML file, while GitHub repositories can be fetched, cloned, and packaged from either a repository URL or a `user/repo` reference. Existing Repomix output files can also be attached for analysis.

The generated output is intended for repository review, code search, refactoring work, and other tasks where an agent needs broad project context. Repomix also records token counts and repository metrics in its normal workflow, including a configurable list of the largest files.

## How it works

`pack_codebase` accepts an absolute local directory and produces a Repomix output. `pack_remote_repository` performs the equivalent operation for a GitHub repository. `attach_packed_output` makes an existing `repomix-output.xml` file, or a directly specified XML file, available for analysis.

Large outputs can be explored incrementally. `read_repomix_output` reads the full result or a selected one-based line range, while `grep_repomix_output` searches with JavaScript regular-expression syntax. Searches can include context before and after each match, with separate settings taking precedence over the shared context value.

Packing follows repository-aware exclusions, including `.gitignore`, `.ignore`, and built-in exclusions. Repomix also uses Secretlint to detect files matching known credential formats and omit them from output.

## Setup and configuration

The underlying Repomix CLI can be run without a global installation with:

```bash
npx repomix@latest
```

For repeated use, the package can be installed globally through npm, Yarn, Bun, or Homebrew. Running `repomix` in a project directory creates `repomix-output.xml` in that directory. Repomix can also be used through its website, which accepts a repository name and supports XML, Markdown, and plain-text output.

MCP calls can refine the packed content with comma-separated fast-glob patterns. `includePatterns` limits processing to matching files, while `ignorePatterns` adds exclusions alongside the repository’s ignore files. `outputPatterns` assigns per-pattern handling such as compression or directory-structure-only output; the first matching pattern determines the result.

## Tools and capabilities

- `pack_codebase` packages a local directory and accepts inclusion, exclusion, output, compression, and metrics options.
- `pack_remote_repository` packages a GitHub repository from a URL, `user/repo` value, or branch path.
- `attach_packed_output` attaches an existing Repomix XML output.
- `read_repomix_output` reads complete output or selected line ranges.
- `grep_repomix_output` performs regular-expression searches with configurable context.
- `file_system_read_file` reads a file inside the sandbox workspace.
- `file_system_read_directory` lists entries in the sandbox workspace.

The optional `compress` setting uses Tree-sitter to retain code signatures and structure while removing implementation details. The documented estimate is about a 70% token reduction, although incremental search and reading can often avoid packing all retrieved content into one operation. The two filesystem tools are available only when the server runs in sandbox mode, and access is bounded by the workspace root.

## Limitations and notes

Remote packaging is centered on GitHub repositories. Compression changes the amount of implementation detail available to the agent, so it should be selected according to the analysis task. File reads and directory listings are restricted to the sandbox workspace when sandbox mode is used. Packed output may be large; line ranges and regular-expression searches provide narrower retrieval paths for those cases.

_Full upstream README: https://allmcps.com/mcp/repomix/readme_

