codesearch MCP
codesearch searches code across several repositories with hybrid retrieval and runs fully offline, without a GPU or Docker.
- 103 ★ on the repository
- Last commit
Minimal access
Why this level
- Index and search run locally, but the optional hooks can block edits and grep.
Install
- Works in
Manual install
curl -fsSLO https://github.com/flupkede/codesearch/releases/latest/download/install.sh && bash install.sh && rm install.shThe Linux and macOS option from the README. Windows has `install.ps1`, and the agent runs `codesearch mcp`.
Access and checks
How we reviewMinimal accessThe tool runs nothing and makes no network calls.
- Index and search run locally, but the optional hooks can block edits and grep.
This is third-party code. Review the repository files before installing.
What it does
Rust-based MCP server that builds a local repository index and gives the agent semantic and literal search. Vector embeddings are fused with full-text BM25 through Reciprocal Rank Fusion, and code is split along function and class boundaries by tree-sitter for 17 languages. Beyond search there is symbol navigation: definitions, usages, imports and dependents. In `serve` mode one server holds a group of repositories and merges query results. Replies are compact by default; the agent fetches full code with a separate `get_chunk` call.
Who it is for. Developers whose agent works in a large codebase or several repositories and burns tokens scanning files.
Good fit when
- The agent looks for where a function is implemented and grep by name is not enough.
- Several repositories belong to one task and search must cover the whole group.
- Before renaming a symbol you need the list of call sites (`find_impact`).
- Code cannot go to cloud indexers and the machine has no GPU.
- Search must be wired into OpenCode, Claude Code or Cursor with one `codesearch mcp` command.
Not a fit when
- The file is known in advance and plain reading or grep is enough.
- Large repositories cannot be indexed on a weak machine.
- A full code knowledge graph is needed rather than lightweight search.
Example request
Find where this project handles payment retries and show which files depend on that function.MCP
- Transport
- stdio, http
- Authentication
- not required
Limitations
The first indexing takes 2–5 minutes, later runs update only changed files. Switching the embedding model requires a full reindex with `--force`. Precise `find_impact` call-site search covers C# and TypeScript; other languages fall back to lexical `find`. The optional `grep-guard` and `edit-guard` hooks block grep and edits until codesearch is consulted, so enable them deliberately. The installer downloads a prebuilt binary from releases.
How to disable. Remove the `codesearch` entry from the agent's MCP configuration and stop `codesearch serve` if running. Delete the index in `~/.codesearch` and any installed hooks separately.
FAQ
How does serve differ from mcp?
`codesearch mcp` serves one repository and watches files itself. `codesearch serve` holds several repositories over HTTP and merges search results.
Is a GPU or Docker required?
No. The server runs on CPU, downloads no models at runtime and ships as a static binary.
Which tools does the agent see?
The main ones are `search`, `find`, `explore`, `get_chunk`, `find_impact` and `status`. Search runs in `semantic` and `literal` modes.
How do I change the embedding model?
Pass `--model` and rebuild the index with `--force`, for example `codesearch --model embeddinggemma-q4 index <path> --force`.
Where is the index stored?
The repository registry lives in `~/.codesearch/repos.json` and indexes are created locally. Listing and cleanup use `codesearch index list`, `rm` and `prune`.
Discussion
No questions or reviews yet.
Related
MCP serversA Rust MCP server and CLI with a call graph and hybrid semantic code search for Claude Code and Codex
Local search and MCP server for agents: one Rust binary that indexes code, docs and logs
An MCP server that indexes a local repository with tree-sitter and gives the agent code search, file lookup and a structure summary of a file
An MCP server and CLI for code research: search and understand your project and all of GitHub with fewer tokens
Source search ranks matches using code structure and gives agents relevant snippets without a separate search index.
A local codebase index for agents: hybrid search, dependency graphs and change impact analysis
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| codesearch (this card) | no | not required | 103 | |
| Claude Context | yes | API key | 12,689 | indexes code through an external vector database; codesearch keeps the index local and merges several repositories |
| Serena | no | not required | 31,301 | offers symbol navigation through language servers; codesearch adds hybrid semantic search |
README in short
One index per repository, semantic and literal search, symbol navigation and a `serve` mode for a group of repositories. Everything runs locally.