UNPKG

repomix-mcp

Version:

MCP server for intelligent context gathering using repomix

167 lines (122 loc) • 3.06 kB
# repomix-mcp An MCP server that provides intelligent context gathering capabilities using repomix. This tool helps AI assistants understand your codebase better by automatically analyzing project structure and gathering relevant context. ## Features - Smart directory detection and context gathering - Project type detection (React, Vue, Angular) - Configurable file patterns and exclusions - Automatic configuration file inclusion - Project structure analysis for optimal context gathering - Concise summaries for users with full context for AI ## Installation You can use repomix-mcp directly with npx without installing: ```bash npx repomix-mcp ``` Or install globally: ```bash npm install -g repomix-mcp ``` ## Usage ### As an MCP Server Add to your MCP settings configuration file (e.g., claude_desktop_config.json): ```json { "mcpServers": { "repomix": { "command": "npx", "args": ["repomix-mcp"], "env": {}, "disabled": false, "autoApprove": [] } } } ``` Or if installed globally: ```json { "mcpServers": { "repomix": { "command": "repomix-mcp", "args": [], "env": {}, "disabled": false, "autoApprove": [] } } } ``` ### Available Tools #### 1. gather_context Gathers context from specified directories using repomix. Parameters: - `baseDir` (required): Base directory to search in - `targetDirs` (optional): Target directories to find (e.g. ['translations', 'src']) - `patterns` (optional): File patterns to include - `depth` (optional): Context gathering depth ('shallow', 'dependencies', 'full') - `includeConfigs` (optional): Include configuration files - `excludePatterns` (optional): Patterns to exclude Example: ```typescript await mcp.use("repomix", "gather_context", { baseDir: "/path/to/project", targetDirs: ["src", "translations"], patterns: ["*.ts", "*.tsx"], includeConfigs: true, excludePatterns: ["**/*.test.*"], }); ``` Output: ``` šŸ“¦ Context Summary: Total Files: 2 Total Lines: 150 Total Characters: 4500 Files Included: - src/index.ts (100 lines, 3000 chars) - translations/en.ts (50 lines, 1500 chars) ``` #### 2. analyze_project Analyzes project structure and suggests context gathering strategy. Parameters: - `projectDir` (required): Project directory to analyze Example: ```typescript await mcp.use("repomix", "analyze_project", { projectDir: "/path/to/project", }); ``` Output: ```json { "projectType": "react", "suggestedConfig": { "baseDir": "/path/to/project", "targetDirs": ["src", "components", "pages", "hooks"], "patterns": ["*.tsx", "*.jsx"], "includeConfigs": true, "depth": "dependencies", "excludePatterns": ["**/*.test.*", "**/*.spec.*", "**/node_modules/**"] } } ``` ## Development 1. Clone the repository: ```bash git clone https://github.com/yourusername/repomix-mcp.git cd repomix-mcp ``` 2. Install dependencies: ```bash npm install ``` 3. Build the project: ```bash npm run build ``` 4. Run locally: ```bash npm start ``` ## License MIT