repo-explorer

MCP server for efficient Git repository exploration with advanced caching. Search code patterns across multiple repositories, manage reference codebases, and analyze patterns with 95%+ performance improvements. Integrates with Claude AI via desktop app or VSCode extension. Configurable and platform-independent.

GitHub Stars

2

User Rating

Not Rated

Forks

0

Issues

1

Views

7

Favorites

0

README
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
  1. Clone the repository:
git clone https://github.com/DocNr/repo-explorer.git
cd repo-explorer
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. 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 repository
  • clone_repo: Clone a specific repository
  • update_repo: Update (pull) a specific repository
  • create_reference_repos: Create the reference repo structure
  • search_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:

  1. Edit the ~/.repo-explorer.json file directly
  2. Add, remove, or modify categories and repositories as needed
  3. 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:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to your branch
  5. Create a pull request
License

MIT - See LICENSE file for details.

Author Information
DocNR

npub1xy54p83r6wnpyhs52xjeztd7qyyeu9ghymz8v66yu8kt3jzx75rqhf3urc

3

Followers

15

Repositories

0

Gists

3

Total Contributions

Top Contributors

Threads