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 分