home / mcp / repomix mcp server

Repomix MCP Server

Exposes repository packing and analysis tools for AI assistants to process codebases via MCP endpoints.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "yamadashy-repomix": {
      "command": "npx",
      "args": [
        "-y",
        "repomix",
        "--mcp"
      ]
    }
  }
}

You can run Repomix as a Model Context Protocol (MCP) server to let AI tools pack, inspect, and analyze codebases directly through an API-like interface. This server enables seamless AI-assisted code analysis by packaging repositories into an AI-friendly format and exposing functions that AI assistants can invoke without manual file handling.

How to use

To use the MCP server, start Repomix in MCP mode and connect your MCP client or integration. The server offers actions like packing local or remote repositories, attaching existing packed outputs, reading and searching outputs, and reading files or directories securely. Your AI tool can request these operations and receive structured results suitable for analysis, code reviews, refactoring suggestions, or documentation generation.

How to install

Prerequisites: ensure Node.js and npm are installed on your system. You can also use Docker if you prefer containerized execution.

Option A: Run MCP server via npx (no global install)

npx -y repomix --mcp

Option B: Install Repomix globally and run MCP server

# Install globally via npm
npm install -g repomix

# Start MCP server
repomix --mcp

Option C: Run Repomix as a Docker container in MCP mode

# Basic run in MCP mode
docker run -v $(pwd):/app -it --rm ghcr.io/yamadashy/repomix --mcp

Additional notes

In MCP mode, you expose a server that AI tools can call to perform repository packing, output reading, and related operations. You can combine MCP with the official configuration guides and plugin ecosystems to tailor how AI assistants interact with your codebase.

Available tools

pack_codebase

Packages a local code directory into a consolidated XML file for AI analysis. Supports optional compression to reduce token usage.

attach_packed_output

Attaches an existing Repomix packed output file for AI analysis, usable with an existing repomix-output.xml.

pack_remote_repository

Fetches, clones, and packages a remote GitHub repository into a consolidated XML file for AI analysis.

read_repomix_output

Reads the contents of a Repomix output file, with optional line-range support for partial reads.

grep_repomix_output

Searches a Repomix output file using JavaScript RegExp syntax, with configurable context lines.

file_system_read_file

Reads a file from the local file system with built-in security validation to prevent access to sensitive information.

file_system_read_directory

Lists directory contents with clear indicators for files and folders, using absolute paths.