CleanClean
MCP Tools

index_repo

Index a local folder or clone and index a public GitHub repo for semantic search.

index_repo builds the searchable index for a repository. It parses every function, class, and method, generates semantic embeddings, and builds a call graph. It's safe to re-run — already-indexed repos are detected.

index_repo is most relevant to the local edition, where you index folders and repos yourself. In the cloud edition you connect repos through the dashboard and indexing is managed for you. (The tool can be hidden entirely by setting CLEAN_DISABLE_INDEX_TOOL.)

Two modes

Pass path to index a folder already on disk — no clone, fully offline.

{ "name": "index_repo", "arguments": { "path": "/Users/me/code/myproject" } }

The folder's basename becomes the searchable repo name, unless the folder is a git repo with a GitHub remote — in which case the detected owner/repo is used. Folders without a remote are namespaced as local/<folder>.

Inputs

NameTypeRequiredDefaultDescription
pathstringone ofAbsolute path to a local directory to index. Use this or repo.
repostringone ofRepository in owner/repo format. Clones from GitHub. Use this or path.
branchstringdefaultGit branch to index (e.g. main, dev). Omit for the repo's default branch.
backgroundbooleantrueRun indexing asynchronously and return as soon as it starts, so MCP clients don't time out.
forcebooleanfalseForce a full re-index even if already indexed. Use when the index is corrupted or you need a clean rebuild.
timeoutnumber1800Foreground timeout in seconds when background=false. Capped at 7200 (2 hours).

You must provide either path or repo (not both).

Background by default

Indexing starts in the background and returns immediately. Poll list_repos until the repo's status becomes ready. To block until indexing finishes instead, pass background=false (subject to timeout).

Re-indexing & staleness

  • Re-running on an already-indexed repo reports it's already indexed rather than redoing the work.
  • Pass force=true to wipe and rebuild from scratch.
  • On the local edition, search_code detects a stale index automatically and re-indexes in the background — usually you never need to re-run this manually.

Useful prompts

Index this local directory
Index this GitHub repo clarsbyte/obs-assistant
Force re-index this GitHub repo clarsbyte/obs-assistant
Index the main branch of this repo in the foreground

On this page