Repomix is a powerful tool that packages your codebase into AI-friendly formats, making it easy to feed your entire repository to large language models like ChatGPT, Claude, DeepSeek, and others. It helps optimize your code for AI analysis by organizing it in a structured, token-efficient way.
You can use Repomix without installation via npx:
npx repomix@latest
Or install it globally for regular use:
# Install 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 pack your entire repository:
repomix
This will generate a repomix-output.xml file in your current directory containing your entire codebase in an AI-friendly format.
To pack a specific directory:
repomix path/to/directory
To include only specific file patterns:
repomix --include "src/**/*.ts,**/*.md"
To exclude specific files or directories:
repomix --ignore "**/*.log,tmp/"
Pack a repository directly from GitHub:
repomix --remote https://github.com/yamadashy/repomix
# Using GitHub shorthand:
repomix --remote yamadashy/repomix
# With specific branch or commit:
repomix --remote yamadashy/repomix --remote-branch main
repomix --remote https://github.com/yamadashy/repomix/tree/main
Repomix supports multiple output formats:
repomix
repomix --style markdown
repomix --style json
repomix --style plain
Reduce token count by extracting only essential code structure:
repomix --compress
Include git logs for repository context:
repomix --include-logs
Include git diffs for tracking changes:
repomix --include-diffs
Use with other CLI tools to select files:
# Using find
find src -name "*.ts" -type f | repomix --stdin
# Using git
git ls-files "*.ts" | repomix --stdin
# Using grep
grep -l "TODO" **/*.ts | repomix --stdin
Visualize token distribution in your codebase:
repomix --token-count-tree
Set a minimum threshold to focus on larger files:
repomix --token-count-tree 1000
Run Repomix in an isolated container:
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
Create a configuration file for persistent settings:
repomix --init
This generates a repomix.config.json file with default settings.
You can also use TypeScript for configuration:
// 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 as a Model Context Protocol server for AI assistant integration:
repomix --mcp
This allows AI assistants like Claude to directly interact with your codebase through the MCP protocol.
For a quick start without installation, visit repomix.com. Simply enter your repository details and click Pack to generate your output file.
Chrome extension: Repomix - Chrome Web Store
Firefox add-on: Repomix - Firefox Add-ons
After generating the packed file, you can use it with AI tools by uploading it with prompts like:
This file contains all the files in the repository combined into one.
I want to refactor the code, so please review it first.
For code review:
This file contains my entire codebase. Please review the overall structure and suggest any improvements or refactoring opportunities, focusing on maintainability and scalability.
For documentation generation:
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 test case generation:
Analyze the code in this file and suggest a comprehensive set of unit tests for the main functions and classes. Include edge cases and potential error scenarios.
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