Repomix is a powerful tool that packages your entire codebase into an AI-friendly format, making it easier to analyze or discuss your code with AI assistants like ChatGPT, Claude, or other LLMs.
You can start using Repomix instantly without installation:
npx repomix@latest
For repeated use, install it globally:
# 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
To update a globally installed Repomix:
npm update -g repomix
To pack your entire repository:
repomix
This generates a repomix-output.xml file in your current directory containing your codebase in an AI-friendly format.
repomix path/to/directory
Use glob patterns to specify which files to include or exclude:
# Include specific files
repomix --include "src/**/*.ts,**/*.md"
# Exclude specific files
repomix --ignore "**/*.log,tmp/"
Reduce token count by extracting only essential code elements:
repomix --compress
# Using GitHub URL
repomix --remote https://github.com/yamadashy/repomix
# Using shorthand
repomix --remote yamadashy/repomix
# Specify branch or commit
repomix --remote yamadashy/repomix --remote-branch main
Process files from other commands:
# Using find command
find src -name "*.ts" -type f | repomix --stdin
# Using git to get tracked files
git ls-files "*.ts" | repomix --stdin
Repomix supports multiple output formats:
repomix
repomix --style markdown
repomix --style json
repomix --style plain
Create a configuration file for persistent settings:
repomix --init
This creates a repomix.config.json file with default settings that you can customize.
For better type support:
// repomix.config.ts
import { defineConfig } from 'repomix';
export default defineConfig({
output: {
filePath: 'output.xml',
style: 'xml',
removeComments: true,
},
ignore: {
customPatterns: ['**/node_modules/**', '**/dist/**'],
},
});
Run Repomix in a container:
# Process current directory
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
# Process remote repository
docker run -v ./output:/app -it --rm ghcr.io/yamadashy/repomix --remote https://github.com/yamadashy/repomix
Run Repomix as a Model Context Protocol server for AI tool integration:
repomix --mcp
To configure the server with VS Code, use one of these methods:
# Using command line
code --add-mcp '{"name":"repomix","command":"npx","args":["-y","repomix","--mcp"]}'
# Or click the install badge in documentation
View token distribution across your codebase:
repomix --token-count-tree
# Include git logs
repomix --include-logs
# Include git diffs
repomix --include-diffs
Repomix includes automatic security scanning to detect sensitive information:
# Disable security check (use with caution)
repomix --no-security-check
After generating your packed file, upload it to your preferred AI tool with a prompt like:
This file contains all the files in the repository combined into one.
I want to refactor the code, so please review it first.
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