llms-install.md
This guide is specifically designed for AI agents like Cline to install and configure the Repomix MCP server for use with LLM applications like Claude Desktop, Cursor, Roo Code, and Cline.
Repomix MCP server is a powerful tool that packages local or remote codebases into AI-friendly formats. It allows AI assistants to analyze code efficiently without manual file preparation, optimizing token usage and providing consistent output.
Before installation, you need:
Add the Repomix MCP server configuration to your MCP settings file based on your LLM client:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json~/Library/Application Support/Claude/claude_desktop_config.json[project root]/.cursor/mcp.jsonAdd this configuration to your chosen client's settings file:
{
"mcpServers": {
"repomix": {
"command": "npx",
"args": [
"-y",
"repomix",
"--mcp"
],
"disabled": false,
"autoApprove": []
}
}
}
This configuration uses npx to run Repomix directly without requiring a global installation.
Once configured, you'll have access to these Repomix tools:
This tool packages a local code directory into a consolidated XML file for AI analysis. It analyzes the codebase structure, extracts relevant code content, and generates a comprehensive report including metrics, file tree, and formatted code content.
Parameters:
directory: (Required) Absolute path to the directory to packcompress: (Optional, default: false) Enable Tree-sitter compression to extract essential code signatures and structure while removing implementation details. Reduces token usage by ~70% while preserving semantic meaning. Generally not needed since grep_repomix_output allows incremental content retrieval. Use only when you specifically need the entire codebase content for large repositories.includePatterns: (Optional) Specify files to include using fast-glob patterns. Multiple patterns can be comma-separated (e.g., "/*.{js,ts}", "src/,docs/**"). Only matching files will be processed.ignorePatterns: (Optional) Specify additional files to exclude using fast-glob patterns. Multiple patterns can be comma-separated (e.g., "test/,*.spec.js", "node_modules/,dist/**"). These patterns supplement .gitignore and built-in exclusions.topFilesLength: (Optional, default: 10) Number of largest files by size to display in the metrics summary for codebase analysis.Example:
{
"directory": "/path/to/your/project",
"compress": false,
"includePatterns": "src/**/*.ts,**/*.md",
"ignorePatterns": "**/*.log,tmp/",
"topFilesLength": 10
}
This tool attaches an existing Repomix packed output file for AI analysis. It allows you to work with previously generated packed repositories without requiring re-processing.
Parameters:
path: (Required) Path to a directory containing repomix-output.xml or direct path to a packed repository XML filetopFilesLength: (Optional, default: 10) Number of largest files by size to display in the metrics summaryFeatures:
Example:
{
"path": "/path/to/directory/with/repomix-output.xml",
"topFilesLength": 10
}
This tool fetches, clones, and packages a GitHub repository into a consolidated XML file for AI analysis. It automatically clones the remote repository, analyzes its structure, and generates a comprehensive report.
Parameters:
remote: (Required) GitHub repository URL or user/repo format (e.g., "yamadashy/repomix", "https://github.com/user/repo", or "https://github.com/user/repo/tree/branch")compress: (Optional, default: false) Enable Tree-sitter compression to extract essential code signatures and structure while removing implementation details. Reduces token usage by ~70% while preserving semantic meaning. Generally not needed since grep_repomix_output allows incremental content retrieval. Use only when you specifically need the entire codebase content for large repositories.includePatterns: (Optional) Specify files to include using fast-glob patterns. Multiple patterns can be comma-separated (e.g., "/*.{js,ts}", "src/,docs/**"). Only matching files will be processed.ignorePatterns: (Optional) Specify additional files to exclude using fast-glob patterns. Multiple patterns can be comma-separated (e.g., "test/,*.spec.js", "node_modules/,dist/**"). These patterns supplement .gitignore and built-in exclusions.topFilesLength: (Optional, default: 10) Number of largest files by size to display in the metrics summary for codebase analysis.Example:
{
"remote": "yamadashy/repomix",
"compress": false,
"includePatterns": "src/**/*.ts,**/*.md",
"ignorePatterns": "**/*.log,tmp/",
"topFilesLength": 10
}
This tool reads the contents of a Repomix-generated output file. Supports partial reading with line range specification for large files. This tool is designed for environments where direct file system access is limited.
Parameters:
outputId: (Required) ID of the Repomix output file to readstartLine: (Optional) Starting line number (1-based, inclusive). If not specified, reads from beginning.endLine: (Optional) Ending line number (1-based, inclusive). If not specified, reads to end.Features:
Example:
{
"outputId": "8f7d3b1e2a9c6054",
"startLine": 100,
"endLine": 200
}
This tool searches for patterns in a Repomix output file using grep-like functionality with JavaScript RegExp syntax. Returns matching lines with optional context lines around matches.
Parameters:
outputId: (Required) ID of the Repomix output file to searchpattern: (Required) Search pattern (JavaScript RegExp regular expression syntax)contextLines: (Optional, default: 0) Number of context lines to show before and after each match. Overridden by beforeLines/afterLines if specified.beforeLines: (Optional) Number of context lines to show before each match (like grep -B). Takes precedence over contextLines.afterLines: (Optional) Number of context lines to show after each match (like grep -A). Takes precedence over contextLines.ignoreCase: (Optional, default: false) Perform case-insensitive matchingFeatures:
Example:
{
"outputId": "8f7d3b1e2a9c6054",
"pattern": "function\\s+\\w+\\(",
"contextLines": 3,
"ignoreCase": false
}
This tool reads a file from the local file system using an absolute path. Includes built-in security validation to detect and prevent access to files containing sensitive information.
Parameters:
path: (Required) Absolute path to the file to readSecurity features:
Example:
{
"path": "/absolute/path/to/file.txt"
}
This tool lists the contents of a directory using an absolute path. Returns a formatted list showing files and subdirectories with clear indicators.
Parameters:
path: (Required) Absolute path to the directory to listFeatures:
[FILE] or [DIR])Example:
{
"path": "/absolute/path/to/directory"
}
To verify the installation is working:
Please package the local directory /path/to/project for AI analysis using Repomix.
or
Please fetch and package the GitHub repository yamadashy/repomix for AI analysis.
Here are some examples of how to use Repomix MCP server with AI assistants:
Can you analyze the code in my project at /path/to/project? Please use Repomix to package it first.
I'd like you to review the code in the GitHub repository username/repo. Please use Repomix to package it first.
Please package my project at /path/to/project, but only include TypeScript files and markdown documentation.
For more detailed information, visit the Repomix official documentation. You can also join the Discord community for support and questions.