Code Index

io.github.trondhindenes由 GitHub 帳號 trondhindenes 發布v1.0.16更新於 Oct 24, 2026

Fast local source code searching using Zoekt trigram-based indexing

已驗證STDIO僅桌面檔案與儲存開發者工具

概覽

AI 產生的概覽

一個本機 MCP 伺服器,使用 Zoekt 三元組索引為原始碼目錄建立索引,讓助理能快速進行子字串與正規表示式程式碼搜尋。

可以做什麼
為原始碼目錄建立索引,並列出、檢視或刪除已儲存的各目錄索引,可顯示儲存位置並透過 CODE_INDEX_DIR 變更。使用 Zoekt 查詢語法搜尋已索引的程式碼,支援正規表示式、檔案與語言篩選、排除條件與大小寫敏感,並可限定於某個目錄。結果以精簡的 grep 風格「檔案:行號」輸出回傳,可限制檔案數與每個檔案的符合數,也可只回傳檔案路徑。
適用情境
適合助理需要快速、反覆搜尋本機程式碼庫的情況,例如在專案中找出函式、類別或特定樣式,或依檔案類型、語言縮小結果範圍而不必讀取整個檔案。
執行需求
以本機程序執行於 macOS 或 Linux(Apple Silicon、Intel、Linux x64 或 ARM64)。可透過對應平台的 .mcpb 套件、發行壓縮檔或 Go 安裝,再將執行檔註冊為 stdio 伺服器。未宣告需要帳號、API 金鑰或網路存取;選用的 CODE_INDEX_DIR 變數可變更索引儲存位置。
安裝前請注意
建立索引會讀取所選目錄的內容,並在使用者設定目錄中儲存索引,因此只應指向你願意在本機建立索引的程式碼。delete_index 工具會刪除某個目錄已儲存的索引。隱藏目錄以及常見的建置、相依與二進位檔案會自動略過。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Code Index,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Code Index MCP Server

An MCP (Model Context Protocol) server for fast local source code searching using Zoekt.

Features

  • Fast code search: Uses Zoekt's trigram-based indexing for fast substring and regex matching
  • Per-directory indexes: Each indexed directory gets its own index stored in the user profile
  • Rich query language: Supports regex, file filters, language filters, and boolean operators
  • Cross-platform: Works on macOS and Linux

Installation

This server is available on the MCP Registry.

Download Pre-built MCPB bundle (experimental)

Download the appropriate .mcpb bundle for your platform from the GitHub Releases page:

  • code-index-mcp-darwin-arm64.mcpb - macOS Apple Silicon
  • code-index-mcp-darwin-amd64.mcpb - macOS Intel
  • code-index-mcp-linux-amd64.mcpb - Linux x64
  • code-index-mcp-linux-arm64.mcpb - Linux ARM64

The .mcpb file is a ZIP archive containing the binary and manifest. You can open it directly in Claude Desktop in order to install it

Manual installation (recommended)

In order to get the binary onto your computer, you can do one of the following:

Download from releases

Go to GitHub Releases and download the appropriate file (not mcpb but the tar/gzipped ones corresponding to your platform). For example:

shell
curl -sL https://github.com/trondhindenes/code-index-mcp/releases/download/1.0.13/code-index-mcp-darwin-arm64.tar.gz | tar xzchmod +x code-index-mcp
Using Go
bash
go install github.com/trondhindenes/code-index-mcp@latest
Build from Source
bash
git clone https://github.com/trondhindenes/code-index-mcpcd code-index-mcpgo build -o code-index-mcp .

Configuration

Now that you have the binary installed locally, you can register it in your tools of choice. This should not be necessary if you installed via mcpb bundle but your mileage may vary.

Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

json
{  "mcpServers": {    "code-index": {      "command": "/path/to/code-index-mcp"    }  }}

Claude Code

Run the following:

shell
claude mcp add --scope user --transport stdio code-index /path/to/code-index-mcp

Environment Variables

  • CODE_INDEX_DIR: Override the default index storage location

Default index locations:

  • macOS: ~/Library/Application Support/code-index/
  • Linux: ~/.local/share/code-index/ or $XDG_DATA_HOME/code-index/

Available Tools

index_directory

Index a source code directory for fast searching.

Parameters:

  • directory (required): The path to the directory to index

Example:

Index the directory /Users/me/projects/myapp

search_code

Search for code across indexed directories. Returns compact grep-like output to minimize context window usage.

Parameters:

  • query (required): The search query using Zoekt syntax
  • directory (optional): Limit search to a specific indexed directory
  • max_files (optional): Maximum files to return (default: 20)
  • max_lines_per_file (optional): Maximum matches per file (default: 3)
  • files_only (optional): Only return file paths, no line content (default: false)

Output Format:

/path/to/file.go:42: matching line content here/path/to/file.go:58: another matching line  ... and 5 more matches in this file

Query Syntax Examples:

  • func main - Simple text search
  • file:\.go$ func main - Search only in .go files
  • lang:python class.*Model - Search in Python files
  • -test func main - Exclude files containing "test"
  • case:yes MyFunc - Case-sensitive search

list_indexes

List all indexed directories and their locations.

delete_index

Delete the index for a specific directory.

Parameters:

  • directory (required): The path to the directory whose index should be deleted

index_info

Get information about the indexing configuration, including storage location.

Skipped Directories

The following directories are automatically skipped during indexing:

  • Hidden directories (starting with .)
  • node_modules, vendor, __pycache__
  • target, build, dist
  • venv, .venv, env, .env

Skipped Files

Binary files and common non-code files are automatically skipped, including:

  • Executables (.exe, .dll, .so, .dylib)
  • Archives (.zip, .tar, .gz)
  • Images (.png, .jpg, .gif)
  • Documents (.pdf, .doc, .docx)

License

MIT

來源:README.md,提交 f796bf8

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.16最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分