Repomix is a tool that packages your codebase into AI-friendly formats, making it easier to analyze your code with AI assistants like ChatGPT, Claude, or Gemini. It generates a single file containing your entire repository in a structured format that AI models can understand and process effectively.
You can use Repomix without installing it:
npx repomix@latest
Or install it globally for repeated use:
# Install using npm
npm install -g repomix
# Alternatively using yarn
yarn global add repomix
# Alternatively using bun
bun add -g repomix
# Alternatively using Homebrew (macOS/Linux)
brew install repomix
To pack your entire repository:
repomix
This generates a repomix-output.xml file in your current directory that you can send to an AI assistant.
To pack a specific directory:
repomix path/to/directory
To include or exclude specific files:
# Include specific files or patterns
repomix --include "src/**/*.ts,**/*.md"
# Exclude specific files or patterns
repomix --ignore "**/*.log,tmp/"
You can pack a remote GitHub repository:
# Full URL
repomix --remote https://github.com/yamadashy/repomix
# GitHub shorthand
repomix --remote yamadashy/repomix
# Specify branch or commit
repomix --remote yamadashy/repomix --remote-branch main
Reduce token count while preserving code structure:
repomix --compress
Process files from a list (pipe via stdin):
# Using find command
find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin
# Include git logs with default count (50 commits)
repomix --include-logs
# Include git diffs for changes
repomix --include-diffs
View token distribution across your codebase:
repomix --token-count-tree
Choose from multiple output formats:
# XML format (default)
repomix --style xml
# Markdown format
repomix --style markdown
# JSON format
repomix --style json
# Plain text format
repomix --style plain
Run Repomix in an isolated Docker container:
# Current directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
# Remote repository
docker run -v ./output:/app -it --rm ghcr.io/yamadashy/repomix --remote yamadashy/repomix
Run Repomix as a Model Context Protocol server for AI tool integration:
repomix --mcp
You can install the Repomix MCP server in VS Code with this command:
code --add-mcp '{"name":"repomix","command":"npx","args":["-y","repomix","--mcp"]}'
You can create a configuration file:
# Initialize config file in current directory
repomix --init
# Create global config
repomix --init --global
This creates a repomix.config.json file with customizable options, including:
After generating your packed file, use these sample prompts with AI tools:
This file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability.
Or:
Review the codebase for adherence to coding best practices and industry standards. Identify areas where the code could be improved in terms of readability, maintainability, and efficiency.
Repomix includes security scanning to prevent sensitive information exposure:
# Disable security check (use with caution)
repomix --no-security-check
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json2. Add this to your configuration file:
{
"mcpServers": {
"repomix": {
"command": "npx",
"args": [
"-y",
"repomix",
"--mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect