Code Index — Claude Code MCP server: search and install
A local MCP server indexes source trees and searches them with Zoekt. Use it when an agent needs to locate code across a project.
Open on GitHubWhat Code Index does
Code Index keeps a separate index for each directory you add and exposes code search through Zoekt. Queries can use regular expressions, file and language filters, Boolean operators, and case-sensitive matching. Results use a compact grep-style format with file paths, line numbers, and matched text.
The server provides index_directory, search_code, list_indexes, delete_index, and index_info. Index data is stored in the user profile, with CODE_INDEX_DIR available to change that location. It runs on macOS and Linux, while indexing skips hidden directories, build folders, binaries, and common document files.
For Claude Code, install the binary with Go and register it using claude mcp add --scope user --transport stdio code-index /path/to/code-index-mcp. Files under skipped directories are outside the search index, so results will not include code from node_modules or dist.
What it helps with
- index a local source directory
- search code with a regular expression
- filter matches by language or file name
- list the directories already indexed
- remove one directory index
Example prompts for the agent
- Index
/Users/me/projects/myappso I can search its source code. - Find every
MyFuncmatch in.gofiles and include the matching line numbers. - Search Python files for the
Modelclass while excluding test files.
How to install Code Index
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Code Index
How do I install Code Index in Claude Code?
Install the binary with go install github.com/trondhindenes/code-index-mcp@latest, then register it with claude mcp add --scope user --transport stdio code-index /path/to/code-index-mcp.
What does Code Index do?
It builds local indexes for source directories and lets an agent search them through Zoekt. The search supports text, regex, file filters, language filters, and Boolean operators.
Which directories does Code Index skip?
Indexing skips hidden directories, node_modules, vendor, __pycache__, target, build, dist, virtual environments, binary files, and common document formats.