Code Index MCP

Local code search, file discovery and symbol summaries for a repository on your machine

By johnhuang316 (individual) Python Local · stdio Developer tools

62 popularity score ★ 1.0k ↓ 2.9k/mo

Connect your client

Local (PyPI)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add code-index -- uvx code-index-mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "code-index": {
      "command": "uvx",
      "args": [
        "code-index-mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "code-index": {
      "command": "uvx",
      "args": [
        "code-index-mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "code-index": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "code-index-mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.code-index]
command = "uvx"
args = ["code-index-mcp"]
Gemini CLITerminal
gemini mcp add --scope user code-index uvx -- code-index-mcp
Local (from source)

Add in one click

Opens the app, which asks before it adds the server. Then replace each <NAME> in its settings with your value.

Or add it by command or config

FirstTerminal
git clone https://github.com/johnhuang316/code-index-mcp.git
cd code-index-mcp
uv sync
Claude CodeTerminal
claude mcp add code-index -- uv --directory '<ABSOLUTE_PATH_TO_CLONE>' run code-index-mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "code-index": {
      "command": "uv",
      "args": [
        "--directory",
        "<ABSOLUTE_PATH_TO_CLONE>",
        "run",
        "code-index-mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "code-index": {
      "command": "uv",
      "args": [
        "--directory",
        "<ABSOLUTE_PATH_TO_CLONE>",
        "run",
        "code-index-mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "code-index": {
      "type": "stdio",
      "command": "uv",
      "args": [
        "--directory",
        "<ABSOLUTE_PATH_TO_CLONE>",
        "run",
        "code-index-mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.code-index]
command = "uv"
args = ["--directory", "<ABSOLUTE_PATH_TO_CLONE>", "run", "code-index-mcp"]
Gemini CLITerminal
gemini mcp add --scope user code-index uv -- --directory '<ABSOLUTE_PATH_TO_CLONE>' run code-index-mcp

Settings 4

PROJECT_PATH Optional: Folder to index at startup when --project-path is not passed; otherwise call set_project_path.
FILE_WATCHER_ENABLED Optional: true or false to turn automatic index refresh on or off at startup.
ADDITIONAL_EXCLUDE_PATTERNS Optional: Comma-separated directory or file patterns to leave out of the index.
CODE_INDEX_BUILD_TIMEOUT Optional: Deep index build timeout in seconds (positive integer).

What it does

Code Index MCP indexes one local project folder and gives an assistant tools to find files by glob, search the code by text, regex or fuzzy pattern, and summarise a file's functions, classes, imports and complexity. You point it at a repository with the set_project_path tool or the --project-path flag, and it keeps a shallow file list that a file watcher refreshes as files change. A separate deep index, built on request with build_deep_index, parses symbols with tree-sitter for Python, JavaScript, TypeScript, Java, Kotlin, C#, Go, Objective-C, Zig and Rust; other file types are indexed only at file level.

Text search shells out to the best grep-style tool it finds on the machine (ugrep, ripgrep, ag or grep) and falls back to a built-in literal search when none is present. Results are paginated, 10 matches per call by default, adjustable with max_results and start_index.

The v2.17.1 source registers 14 tools, one more than the README's table: get_symbol_body returns the code of a single function, method or class along with its signature, docstring and callers, so an assistant can read one symbol without loading the whole file. The same source also reads four environment variables the README does not document: PROJECT_PATH (used when --project-path is not given), FILE_WATCHER_ENABLED, ADDITIONAL_EXCLUDE_PATTERNS (comma-separated) and CODE_INDEX_BUILD_TIMEOUT (seconds). It also exposes each indexed file as a files:// resource.

What it needs

RuntimePython 3.10+

Python 3.10 or later and uv for the uvx command (pip install code-index-mcp also works and puts a code-index-mcp program on PATH). A local repository to index. Regex and fuzzy search need a native search tool on PATH: ugrep, ripgrep, ag or grep for regex, and ugrep for fuzzy matching. On Windows under Codex CLI, the README says HOME, APPDATA, LOCALAPPDATA and SystemRoot must be passed in the env block for uvx to start.

Limits

Symbol-level analysis (get_file_summary, get_symbol_body) needs build_deep_index first; the shallow index the watcher keeps current holds file names only. Only the ten tree-sitter languages get symbol extraction; C, C++, Ruby, PHP, Swift and others are indexed at file level. Without a native search tool, search is literal-only, and fuzzy matching needs ugrep. Unless set, the deep build timeout scales at 0.5 s per file between 30 s and 600 s, with min(4, CPU count) workers (server.py). Indexes go under /tmp/code_indexer unless --indexer-path is given. On macOS the kqueue watcher opens one file descriptor per file, so large projects may need a higher ulimit.

Who it suits

Suits developers who want an assistant to navigate a local codebase (find where something is called, list files of a kind, read one function) without sending the code anywhere, and who are happy installing uv and ideally ripgrep or ugrep. It reads source files but has no tool that edits them, so it pairs with an assistant's own editing tools rather than replacing them. It is a community project, not tied to any vendor. For semantic or embedding-based search, or for projects mostly in languages outside its ten tree-sitter languages, look elsewhere: here those files get plain text search and file listing only.

Tools 14

set_project_path
Choose the project folder to index and start indexing it.
search_code_advanced
Search code by literal text, regex or fuzzy pattern, with file filter and paging.
find_files
List indexed files matching a glob or file name.
get_file_summary
Summarise a file's line count, definitions, imports and complexity; needs the deep index.
get_symbol_body
Return the code, signature, docstring and callers of one function, method or class.
refresh_index
Rebuild the shallow file index, for instance after git operations.
build_deep_index
Build the full symbol index, with optional worker count and timeout.
get_settings_info
Show the current project settings and index status.
create_temp_directory
Create the directory that holds index data.
check_temp_directory
Check the index data directory and its permissions.
clear_settings
Delete all saved settings and cached index data.
refresh_search_tools
Detect again which command-line search programs are installed.
get_file_watcher_status
Report whether the file watcher is running and its statistics.
configure_file_watcher
Turn the watcher on or off and set debounce, exclusions and observer type.

Similar servers