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:
- Node.js 18.0.0 or higher
- npm (Node Package Manager)
Add the Repomix MCP server configuration to your MCP settings file based on your LLM client:
- Cline (VS Code Extension):
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Roo Code (VS Code Extension):
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json - Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json - Cursor:
[project root]/.cursor/mcp.json
Add 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 file for AI analysis.
Parameters:
directory: (Required) Absolute path to the directory to packcompress: (Optional, default: true) Whether to perform intelligent code extraction to reduce token countincludePatterns: (Optional) Comma-separated list of include patternsignorePatterns: (Optional) Comma-separated list of ignore patterns
Example:
{
"directory": "/path/to/your/project",
"compress": true,
"includePatterns": "src/**/*.ts,**/*.md",
"ignorePatterns": "**/*.log,tmp/"
}This tool fetches, clones, and packages a GitHub repository into a consolidated file for AI analysis.
Parameters:
remote: (Required) GitHub repository URL or user/repo format (e.g., yamadashy/repomix)compress: (Optional, default: true) Whether to perform intelligent code extraction to reduce token countincludePatterns: (Optional) Comma-separated list of include patternsignorePatterns: (Optional) Comma-separated list of ignore patterns
Example:
{
"remote": "yamadashy/repomix",
"compress": true,
"includePatterns": "src/**/*.ts,**/*.md",
"ignorePatterns": "**/*.log,tmp/"
}This tool reads the contents of a Repomix output file in environments where direct file access is not possible.
Parameters:
outputId: (Required) ID of the Repomix output file to read
Features:
- Specifically designed for web-based environments or sandboxed applications
- Retrieves the content of previously generated outputs using their ID
- Provides secure access to packed codebase without requiring file system access
Example:
{
"outputId": "8f7d3b1e2a9c6054"
}This tool reads a file using an absolute path with security validation.
Parameters:
path: (Required) Absolute path to the file to read
Security features:
- Implements security validation using Secretlint
- Prevents access to files containing sensitive information
- Validates absolute paths to prevent directory traversal attacks
Example:
{
"path": "/absolute/path/to/file.txt"
}This tool lists contents of a directory using an absolute path.
Parameters:
path: (Required) Absolute path to the directory to list
Features:
- Shows files and directories with clear indicators (
[FILE]or[DIR]) - Provides safe directory traversal with proper error handling
- Validates paths and ensures they are absolute
Example:
{
"path": "/absolute/path/to/directory"
}To verify the installation is working:
- Restart your LLM application (Cline, Claude Desktop, etc.)
- Test the connection by running a simple command like:
or
Please package the local directory /path/to/project for AI analysis using Repomix.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.
-
MCP server connection issues
- Verify the syntax in your MCP settings file is correct
- Ensure you have an active internet connection (needed for npx to fetch the package)
- Check if any other MCP servers are causing conflicts
-
Packaging failures
- Verify the specified directory or repository exists
- Check if you have sufficient disk space
- For remote repositories, ensure you have internet connectivity
- Try with simpler parameters first, then add complexity
-
JSON parsing errors in configuration
- Make sure your MCP settings file is properly formatted
- Verify all paths use forward slashes, even on Windows
- Check for any missing commas or brackets in the configuration
For more detailed information, visit the Repomix official documentation. You can also join the Discord community for support and questions.