RepoMix MCP server

Package codebases into AI-friendly single files with intelligent code structure preservation and token optimization.
Back to servers
Setup instructions
Provider
Sho Yamada
Release date
Mar 13, 2025
Language
TypeScript
Package
Stats
320.0K downloads
17.9K stars

Repomix is a powerful tool that allows you to package your entire codebase into a single, AI-friendly file. This makes it easy to feed your code to large language models (LLMs) like Claude, ChatGPT, DeepSeek, or Gemini for analysis and assistance.

Installation

There are several ways to install and use Repomix:

Quick Start with npx

Run Repomix in your project directory without installation:

npx repomix@latest

Global Installation

Install Repomix globally for repeated use:

# Using npm
npm install -g repomix

# Using yarn
yarn global add repomix

# Using bun
bun add -g repomix

# Using Homebrew (macOS/Linux)
brew install repomix

Docker Installation

Run Repomix in a Docker container:

# Current directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix

# Specific directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix path/to/directory

# Remote repository
docker run -v ./output:/app -it --rm ghcr.io/yamadashy/repomix --remote https://github.com/yamadashy/repomix

Basic Usage

Packing Your Codebase

To pack your entire repository into a single file:

repomix

This will generate a repomix-output.xml file in your current directory, which you can then send to an AI assistant for analysis.

Packing Specific Directories or Files

# Pack a specific directory
repomix path/to/directory

# Pack specific files using glob patterns
repomix --include "src/**/*.ts,**/*.md"

# Exclude specific files or directories
repomix --ignore "**/*.log,tmp/"

Processing Remote Repositories

# Using a full URL
repomix --remote https://github.com/yamadashy/repomix

# Using GitHub shorthand
repomix --remote yamadashy/repomix

# Specifying a branch
repomix --remote yamadashy/repomix --remote-branch main

Reading Files from stdin

# Using find command
find src -name "*.ts" -type f | repomix --stdin

# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin

# Using ripgrep to find files with specific content
rg -l "TODO|FIXME" --type ts | repomix --stdin

Code Compression

To reduce token count while preserving structure:

repomix --compress

Output Formats

Repomix supports three output formats:

XML Format (default)

repomix --style xml

Markdown Format

repomix --style markdown

Plain Text Format

repomix --style plain

Configuration

Create a configuration file in your project root:

repomix --init

This creates a repomix.config.json file that lets you customize:

  • What files to include/exclude
  • Output format and style
  • Token counting settings
  • Security checks
  • And more

Global Configuration

You can also create a global configuration file:

repomix --init --global

Security Features

Repomix includes built-in security checks to prevent accidental exposure of sensitive information:

# Disable security check (use with caution)
repomix --no-security-check

MCP Server Integration

Repomix can function as a Model Context Protocol (MCP) server, allowing AI assistants to directly interact with your codebase:

repomix --mcp

This enables AI tools to perform repository analysis without requiring manual file preparation.

Command Line Options

Some commonly used options:

# Specify output file
repomix -o output.xml

# Output to stdout
repomix --stdout

# Copy to clipboard
repomix --copy

# Remove comments
repomix --remove-comments

# Include git diffs
repomix --include-diffs

Updating Repomix

# Using npm
npm update -g repomix

# Using yarn
yarn global upgrade repomix

# Using bun
bun update -g repomix

Using npx repomix will always use the latest version.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "repomix" '{"command":"npx","args":["-y","repomix","--mcp"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later