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.
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
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.
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
Choose from three output formats:
# XML format (default)
repomix --style xml
# Markdown format
repomix --style markdown
# Plain text format
repomix --style plain
You can also run Repomix using Docker:
docker run -v .:/app -it --rm ghcr.io/yamadashy/repomix
Create a repomix.config.json
file to customize Repomix:
repomix --init
Key configuration options include:
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.
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.
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.
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 > 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"
]
}
}
}
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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.