RepoMix MCP server

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

Repomix is a powerful utility that packs your repository files into a single AI-friendly document. This makes it easy to share your codebase with AI tools like ChatGPT, Claude, or other large language models.

Installation

You can use Repomix without installation using npx:

npx repomix

Or install it globally:

# Using npm
npm install -g repomix

# Using yarn
yarn global add repomix

# Using Homebrew (macOS/Linux)
brew install repomix

Basic Usage

Run Repomix in your project directory to generate a file containing your entire codebase:

repomix

This will create a file named repomix-output.xml in your current directory.

Common Commands

Process a specific directory:

repomix path/to/directory

Include only specific files using glob patterns:

repomix --include "src/**/*.ts,**/*.md"

Exclude specific files or directories:

repomix --ignore "**/*.log,tmp/"

Process a remote repository:

repomix --remote yamadashy/repomix

Reduce token count with code compression:

repomix --compress

Create a configuration file:

repomix --init

Output Formats

Choose from three output formats:

# XML format (default)
repomix --style xml

# Markdown format
repomix --style markdown

# Plain text format
repomix --style plain

Docker Usage

You can also run Repomix using Docker:

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

Configuration

Create a repomix.config.json file to customize Repomix:

repomix --init

Key configuration options include:

  • Output file name and format
  • Files to include or exclude
  • Token counter configuration
  • Comment removal options
  • Security check settings

MCP Server Integration

You can run Repomix as a Model Context Protocol (MCP) server:

repomix --mcp

This allows AI assistants to directly use Repomix to analyze your codebase.

Using the Generated Output

Once you have your packed file, upload it to your AI tool of choice along with prompts like:

This file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability.

Or:

Based on the codebase in this file, please generate a detailed README.md that includes an overview of the project, its main features, setup instructions, and usage examples.

For web-based usage, you can also visit repomix.com to use Repomix online.

Security Features

Repomix includes security checks to help prevent sensitive information from being included in your packed files. You can disable this with:

repomix --no-security-check

But use this option with caution to avoid exposing sensitive data.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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