Skip to main content
Glama

mcp-repo-search

An MCP (Model Context Protocol) server that lets AI assistants search code across multiple repositories in a workspace directory. Built for use with Cursor, Claude Code, and any MCP-compatible client.

The Problem

You work across multiple repos in a single parent directory. You want your AI assistant to search for a keyword, endpoint, or usage pattern across all of them — without opening each one individually.

Related MCP server: Code Search MCP

What It Does

Point it at a directory that contains your repos, and it auto-discovers all subdirectories as searchable projects. No config files listing repos — just drop them in.

~/workspace/
├── api-server/       ← auto-discovered
├── web-app/          ← auto-discovered
├── shared-lib/       ← auto-discovered
└── mobile-app/       ← auto-discovered

Tools Provided

Tool

Description

search_code

Regex search across file contents (powered by ripgrep). Filter by file type, glob, or specific repos

find_files

Find files by name/glob pattern across all repos

read_file

Read file contents with optional line range

list_repos

List all discovered repositories

repo_overview

Get directory structure and config files for a specific repo

Prerequisites

  • Node.js >= 18

  • ripgrep (rg) installed and in PATH

# macOS
brew install ripgrep

# Ubuntu/Debian
sudo apt install ripgrep

# Windows
choco install ripgrep

Setup

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "repo-search": {
      "command": "node",
      "args": ["/path/to/mcp-repo-search/index.js"],
      "env": {
        "REPO_SEARCH_ROOT": "/path/to/your/workspace"
      },
      "alwaysAllow": [
        "search_code",
        "find_files",
        "read_file",
        "list_repos",
        "repo_overview"
      ]
    }
  }
}

Restart Cursor. The tools will be available to the AI agent.

Claude Code

claude mcp add repo-search node /path/to/mcp-repo-search/index.js \
  -e REPO_SEARCH_ROOT=/path/to/your/workspace

VS Code (Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "repo-search": {
      "command": "node",
      "args": ["/path/to/mcp-repo-search/index.js"],
      "env": {
        "REPO_SEARCH_ROOT": "/path/to/your/workspace"
      }
    }
  }
}

npx (any MCP client)

REPO_SEARCH_ROOT=/path/to/workspace npx mcp-repo-search

Environment Variables

Variable

Default

Description

REPO_SEARCH_ROOT

Current working directory

Parent directory containing your repos

REPO_SEARCH_RG

Auto-detected

Path to rg binary

REPO_SEARCH_IGNORE

node_modules,.git,target,.svn,dist,build

Comma-separated directories to ignore in repo_overview

REPO_SEARCH_DEPTH

2

Default directory tree depth for repo_overview

Usage Examples

Once configured, ask your AI assistant:

  • "Search for PaymentController across all repos"

  • *"Find all files named .controller.ts"

  • "Where is the /api/webhook endpoint defined?"

  • "Give me an overview of the backend repo"

  • "Search for 'fetchUser' but only in the frontend and shared-lib repos"

  • "Find all .svelte files that import EmailBuilder"

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to perform high-performance code search and analysis across multiple languages using symbol indexing, regex text search, and structural AST pattern matching. It also provides tools for technology stack detection and dependency analysis with persistent caching for optimized performance.
      12
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Integrates GitHub repository management and local file system access to enable AI agents to perform code reviews and manage pull requests. It provides tools for listing repositories, retrieving PR diffs, and searching or reading files within a specified workspace.
      7
      MIT