codeindex
io.github.munhq由 GitHub 账号 munhq 发布v0.6.2更新于 Nov 3, 2026
基于MCP的结构化代码智能:符号、调用方、导入和影响范围,支持40多种语言。
AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。
原文描述
Structural code intelligence over MCP: symbols, callers, imports and blast radius, 40+ languages.
概览
codeindex 的本地 MCP 服务;无需登录;STDIO。
暂无 AI 概览:以下信息来自注册中心条目和服务本身。
安装
在 SourceWeft 中
- 打开 控制台中的 codeindex,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
[npm] [MCP Registry] [Smithery] [Glama] [license]
[Install in Cursor] [Install in VS Code]
A structural code intelligence engine that runs as an MCP server for AI coding agents.
It indexes your codebase with tree-sitter (40+ languages), builds a trigram full-text index, an inverted word index, and a dependency graph — then exposes them through 16 MCP tools.
Every session on a repository speaks plain stdio MCP, as before. Behind that, they share one index: the tree is parsed once, watched once and written once, however many agents are attached. Eight sessions on one repository used to be eight copies of the same index, eight file watchers and eight writers of the same snapshot; measured on a 720-file project, each session went from 87 MB to 7 MB, against one shared 77 MB daemon.
Why
AI coding agents spend tokens reading entire files. codeindex answers structural questions — symbol outlines, definitions, callers, blast radius, dependency chains — in a few hundred tokens instead of thousands.
One plan_change call returns: where a symbol is defined, every call site, the file's architectural role (god module / stable core / island / driver), hardcoded literals to check, and the full transitive blast radius if the file changes.
Quickstart
The shortest path, if you have Node 18+. Nothing else to install, no key, no config — the package is a 4 KB wrapper that fetches the binary for your platform and verifies it against the published checksums:
No Node, or you want the skill and the hook as well:
Docker, for hosts that install MCP servers as images. The workspace is bind-mounted read-only; codeindex never writes to it:
Register with your AI agent:
Every listing points at the same server: npm @munhq/codeindex, the official MCP
registry as io.github.munhq/codeindex, and Smithery as munhq/codeindex.
The next time your agent starts, codeindex indexes your project in the background and serves structural queries.
MCP Tools
Analyses (analyze tool)
Supported Languages
40+ languages via tree-sitter: Rust, Python, TypeScript/TSX, Go, Zig, C, C++, Java, Ruby, Bash, C#, Kotlin, Lua, Scala, Elixir, R, Swift, Dart, Haskell, TOML, JSON, YAML, HTML, CSS, SCSS, SQL, HCL, Dockerfile, Markdown, Nix, Make, and more.
Configuration
Getting it used
A server that registers without telling an agent when to reach for it stays idle, and an idle index saves nothing however cheap its calls are. The plugin ships three things for that, in the order they act:
- A SessionStart brief. About 240 tokens, once per session, in a repository that holds source files: codeindex is live, and here is the tool for each kind of code question. It lands before the agent has chosen a tool, which is the only moment that can change the first choice.
- A PreToolUse hint. Fires on the 1st, 8th and 25th code question of a
session, when a scan is about to answer something the index answers better,
and names the tool for that exact question. It matches
Bashas well asRead/Grep/Glob, because a permission mode that routes file work through the shell is where most scans actually happen. - The skill, which the model loads when it decides the task calls for it.
Advice loses to habit, so the narrow case where the index is strictly better is
refused rather than argued with: an identifier search that is the whole command
line, in a project that has been indexed before. It never refuses a file read —
the bytes are required before an Edit — never refuses a line that also builds
or tests, and stops refusing after three times in a session, so it can never be
the reason a session cannot proceed.
That is on by default, and it is one switch to turn off — no file to edit by
hand. It is a plugin option, so /plugin shows it as "Refuse a scan the index
answers better" and Claude Code passes your answer to the hook. Outside the
plugin, or for a single session, CODEINDEX_ENFORCE=0 in the environment
overrides the option and CODEINDEX_ENFORCE=1 restores it.
Measure the effect rather than assuming it: python3 plugin/measure_routing.py
counts, per session, how many code questions went to a scan and how many went to
the index, across every Claude Code home on the machine.
Which tree gets indexed
In --mcp mode the working directory belongs to the client, not to you, and it
is regularly not your project: Claude Code launches a plugin's MCP server from
the plugin's own directory and a user-scope server from its config directory. So
the workspace is resolved in this order, and the first usable answer wins:
--workspaceorCODEINDEX_WORKSPACE. An explicit answer is never overridden.CLAUDE_PROJECT_DIR, which Claude Code sets in every MCP server it spawns.- The launch directory, walking up for a
.git,package.json,Cargo.toml,go.mod,build.zigorpyproject.tomlmarker. - The client's MCP
roots. The server asks for them at the handshake whenever the root above was a guess, and adopts one when the guess was refused or lands outside every root the client reports.notifications/roots/list_changedis honoured too, so a directory added with--add-dircan still rescue a session.
status reports the effective root as workspace, and whether a file watcher is
running as watcher. Check them when a result looks empty: an index of the wrong
tree answers every question just as confidently as the right one.
It refuses to index your entire home directory, the filesystem root, or a folder
that merely holds several independent repositories. A refused workspace answers
every query with the reason and the one call that fixes it — index_workspace
with the project path — rather than with "no results".
One daemon serves one project, and every session on that project shares it, so
a daemon never moves to another tree. A session can move instead. An agent that
starts in one checkout and edits another (a second worktree, or a work folder
with a .desk-work marker and no .git) calls index_workspace with that
folder. The session then talks to the daemon of that folder, which starts if
none runs, and the first daemon keeps serving its own tree.
Architecture
- Parser: tree-sitter with 40+ grammars, compiled into a single binary
- Index: trigram index for fuzzy text search + inverted word index for exact identifier lookup
- Dependency graph: file-level import resolution with forward and reverse edges
- Version store: tracks file changes with sequence numbers for incremental updates
- Live watcher: re-indexes on file create/modify/delete (background thread in MCP mode). inotify on Linux; a polling walk on macOS and Windows, which compares mtime and size every couple of seconds.
statusreports which backend is live aswatcher_backend. - Snapshot: persists the full index to
.codeindex.json, so a restart loads the snapshot instead of re-indexing - MCP server: JSON-RPC over stdio, implements the MCP 2024-11-05 protocol
- Workspace daemon: the first session on a repository starts a background
daemon and becomes a relay onto it; later sessions just connect. A Unix-domain
socket on Linux, macOS and Windows 10 1803+, in
$XDG_RUNTIME_DIR/codeindex(or a per-user directory underTMPDIR), named by a hash of the workspace and the binary version — so a rebuilt binary never inherits the previous version's daemon. It exits after 15 minutes with no session attached. Anything that goes wrong falls back to indexing in-process, which is what happened before the daemon existed. Turn it off with--no-daemon.
Platform support
Every row is built by CI and its tests are run on that platform, except where
noted. status reports the live watcher backend so it is never a guess.
On Windows, install.sh and the plugin's launcher are shell scripts, so they
need Git Bash, MSYS2 or Cygwin — they detect it and resolve the right .exe
asset. The plugin registers its server through that launcher, so a native
Windows Claude Code without a shell should register the binary directly:
Nothing here is signed or notarized. On macOS a binary fetched with curl runs
without a Gatekeeper prompt; one downloaded through a browser is quarantined,
and xattr -d com.apple.quarantine codeindex clears it.
Building from source
Requires Zig 0.16.0.
Run tests:
zig build test routes results through the build runner's IPC protocol on
stdout, which the linked tree-sitter C sources corrupt via their debug printf
paths. Building the test binary and running it directly is the same tests
without that protocol in the way.
How it compares
Pairs with chat-recall
codeindex answers questions about the code in front of you. chat-recall answers questions about the work you already did — it indexes your Claude Code, Gemini CLI, Codex, OpenCode, Antigravity and Cursor sessions into one searchable history and exposes that over MCP too.
Together they cover both halves of what an agent forgets: codeindex stops it re-reading files it could have outlined, and chat-recall stops it redoing work it already finished. chat-recall detects a codeindex binary on your PATH and registers four extra code-intelligence tools when it finds one — neither requires the other.
License
MIT. See LICENSE.
来源:README.md,提交 c1d9502
工具
0版本历史
4- v0.6.2最新Nov 3, 2026
- v0.6.1Sep 26, 2026
- v0.6.0Sep 26, 2026
- v0.5.1Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分