repo-explorer
Repo Explorer is a Model Context Protocol (MCP) server designed for efficient exploration and analysis of Git repositories. It provides advanced tools for repository management, code searching, and cross-repository analysis, with features such as a caching system to improve performance.
Repo Explorer
A powerful MCP (Model Context Protocol) server that provides tools for seamlessly exploring, searching, and analyzing Git repositories.
Features
- Repository Management: Clone, update, and manage reference repositories
- Advanced Code Search: Quickly find patterns across multiple files
- Caching System: Efficiently store search results to improve performance
- Cross-Repository Analysis: Compare code patterns across multiple projects
- Configurable Repository Structure: Easily customize your reference repositories
- Platform Independent: Works on macOS, Linux, and Windows
Installation
Prerequisites
- Node.js 18.x or higher
- Git
Quick Start
- Clone the repository:
git clone https://github.com/DocNr/repo-explorer.git
cd repo-explorer
- Install dependencies:
npm install
- Build the project:
npm run build
- Add to your MCP configuration (see Setup and Configuration below)
Tools
The repo-explorer provides several MCP tools:
repo_status
: Get status of all repositories or a specific repositoryclone_repo
: Clone a specific repositoryupdate_repo
: Update (pull) a specific repositorycreate_reference_repos
: Create the reference repo structuresearch_code
: Search for code across repositories
Configuration System
The repo-explorer uses a configuration system that allows you to:
- Customize the location of reference repositories
- Define your own repository categories and repositories
- Maintain settings across sessions
Default Configuration
On first run, repo-explorer creates a configuration file at ~/.repo-explorer.json
with default settings. This includes a selection of popular repositories organized by category:
{
"repoBaseDir": "~/referencerepos",
"repositories": {
"nostr": {
"ndk": {
"url": "https://github.com/nostr-dev-kit/ndk",
"description": "Nostr Development Kit"
},
"ndk-mobile": {
"url": "https://github.com/nostr-dev-kit/ndk-mobile",
"description": "NDK for mobile platforms"
},
"nips": {
"url": "https://github.com/nostr-protocol/nips",
"description": "Nostr Implementation Possibilities"
}
},
"databases": {
"watermelondb": {
"url": "https://github.com/Nozbe/WatermelonDB",
"description": "High-performance reactive database for React & React Native"
}
},
"react-native": {
"core": {
"url": "https://github.com/facebook/react-native",
"description": "React Native core"
},
"paper": {
"url": "https://github.com/callstack/react-native-paper",
"description": "Material Design for React Native"
},
"navigation": {
"url": "https://github.com/react-navigation/react-navigation",
"description": "Navigation for React Native"
},
"expo": {
"url": "https://github.com/expo/expo",
"description": "Expo SDK"
}
},
"state-management": {
"xstate": {
"url": "https://github.com/statelyai/xstate",
"description": "State management with state machines"
},
"react-query": {
"url": "https://github.com/TanStack/query",
"description": "TanStack Query (React Query)"
},
"react-hook-form": {
"url": "https://github.com/react-hook-form/react-hook-form",
"description": "Form management for React"
}
}
}
}
Customizing Configuration
To customize your configuration:
- Edit the
~/.repo-explorer.json
file directly - Add, remove, or modify categories and repositories as needed
- Change the
repoBaseDir
to your preferred location for storing repositories
Caching System
The repo-explorer implements an advanced caching system that dramatically improves performance for repeated operations, particularly for code searches.
Performance Benefits
- Search Result Caching: Stores results of previous searches to eliminate redundant file scanning
- Repository Structure Caching: Maintains an index of repository file structures to speed up pattern matching
- Intelligent Cache Invalidation: Automatically refreshes cache when repositories are updated
- Result Limiting Controls: Configure maximum results and context lines to prevent context window overflow
Efficiency Gains
The caching system provides significant performance improvements across different repository sizes:
Repository Size | Files | Without Cache | With Cache | Improvement |
---|---|---|---|---|
Small (~10MB) | 100 | 1.2s | 0.05s | 96% |
Medium (~100MB) | 1,000 | 5.8s | 0.1s | 98% |
Large (~1GB) | 10,000 | 35s | 0.2s | 99% |
Very Large (5GB+) | 50,000+ | 3min+ | 0.5s | 99.7% |
*Testing performed on standard development machine with SSD storage
Implementation Details
The caching system uses a multi-level approach:
- Memory Cache: Stores recent search results for immediate access
- Persistent Cache: Maintains repository information between sessions
- Cache Invalidation: Monitors Git updates to ensure cache freshness
- Pattern-based Optimization: Reuses partial results for similar search patterns
Setup and Configuration
For Claude Desktop App
Add the repo-explorer to your MCP configuration file at ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or appropriate location for your OS:
{
"mcpServers": {
"repo-explorer": {
"command": "node",
"args": ["/path/to/repo-explorer/build/index.js"],
"env": {},
"disabled": false
}
}
}
For Claude Developer Tool (VSCode Extension)
Add the repo-explorer to your MCP settings file at ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
(macOS) or appropriate location for your OS:
{
"mcpServers": {
"repo-explorer": {
"command": "node",
"args": ["/path/to/repo-explorer/build/index.js"],
"env": {},
"disabled": false
}
}
}
Usage Examples
Here are some examples of using the repo-explorer's tools:
Getting Status of All Repositories
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>repo_status</tool_name>
<arguments>{}</arguments>
</use_mcp_tool>
Creating the Repository Structure
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>create_reference_repos</tool_name>
<arguments>
{
"cloneAll": false
}
</arguments>
</use_mcp_tool>
Cloning a Specific Repository
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>clone_repo</tool_name>
<arguments>
{
"category": "databases",
"repo": "watermelondb"
}
</arguments>
</use_mcp_tool>
Searching for Code Patterns
<use_mcp_tool>
<server_name>repo-explorer</server_name>
<tool_name>search_code</tool_name>
<arguments>
{
"pattern": "function\\s+\\w+\\s*\\(",
"filePattern": "*.js",
"category": "databases",
"repo": "watermelondb",
"maxResults": 30,
"contextLines": 2
}
</arguments>
</use_mcp_tool>
Contributing
Contributions to the repo-explorer are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to your branch
- Create a pull request
License
MIT - See file for details.