Skip to main content
Glama

codeindex

AIコーディングエージェント向けにMCPサーバーとして動作する、構造的なコードインテリジェンスエンジンです。

tree-sitter(40以上の言語)でコードベースをインデックス化し、トライグラム全文インデックス、転置ワードインデックス、依存関係グラフを構築して、16のMCPツールとして公開します。

 ┌─────────────┐      MCP (stdio)       ┌──────────────┐
 │  AI Agent   │ ◄─────────────────────► │   codeindex  │
 │ (Claude,    │   16 tools, JSON-RPC    │  (Zig binary) │
 │  Cursor…)   │                         │              │
 └─────────────┘                         └──────┬───────┘
                                                │
                                   tree-sitter parse (40+ langs)
                                         trigram + word index
                                         dependency graph
                                         snapshot persistence

なぜ

AIコーディングエージェントは、ファイル全体を読むためにトークンを消費します。codeindexは、シンボルの概要、定義、呼び出し元、影響範囲、依存関係チェーンといった構造的な質問に、数千トークンではなく数百トークンで答えます。

plan_changeを1回呼び出すだけで、シンボルが定義されている場所、すべての呼び出し箇所、ファイルのアーキテクチャ上の役割(神モジュール / 安定コア / アイランド / ドライバー)、確認すべきハードコードされたリテラル、ファイルが変更された場合の完全な推移的影響範囲が返ります。

Related MCP server: OpenCodeHub MCP Server

クイックスタート

# Install (prebuilt binary or build from source)
curl -fsSL https://raw.githubusercontent.com/munhq/codeindex/main/install.sh | bash

# Or build manually:
cd zig && ./fetch-vendor.sh && zig build -Doptimize=ReleaseFast

AIエージェントに登録してください:

# Claude Code — the plugin is the one-step path. It ships the skill, the hook
# and the MCP server together, and its launcher finds or fetches the binary.
claude plugin marketplace add munhq/codeindex
claude plugin install codeindex@codeindex

# Without the plugin (or for a different MCP client), register the binary
# directly. Do not do both: two registrations mean two servers, two copies of
# every tool schema, and two writers on one snapshot. install.sh detects the
# plugin and skips this step when it is present.
claude mcp add -s user codeindex -- ~/.local/bin/codeindex --mcp

# Cursor / other MCP clients: add to your config
{
  "mcpServers": {
    "codeindex": {
      "command": "~/.local/bin/codeindex",
      "args": ["--mcp"]
    }
  }
}

次回エージェントを起動すると、codeindexがプロジェクトをバックグラウンドでインデックス化し、構造的なクエリに応答します。

MCPツール

ツール

説明

status

インデックスの統計: ファイル数、シンボル数、インデックス状態、トークン節約率(%)

search

インデックス化されたすべてのファイルに対する、トライグラムによる高速全文検索

find_symbol

名前によるシンボル定義(関数、構造体、クラスなど)の検索

find_word

転置ワードインデックスによる完全一致の単語/識別子の検索

find_callers

シンボルの近似呼び出し元(ヒューリスティック、完全な名前解決なし)

get_outine

ファイルの構造的な概要(シンボル、行数)

get_tree

ファイルメタデータ付きのディレクトリツリー

get_imports

指定されたファイルがインポート/依存しているファイル

get_imported_by

逆依存関係 — このファイルをインポートしているファイル

get_change_impact

推移的な影響範囲: ファイルが変更された場合に壊れるもの

plan_change

シンボルまたはファイルの完全なリファクタリング計画 — 定義、呼び出し元、ファイルの役割、リテラル、影響範囲

get_hot_files

最近変更されたファイルを新しい順に並べたもの

read_file

オプションの行範囲指定付きでファイル内容を読取る

read_symbol

シンボルのソースコードだけを読取る(オプションのコンテキスト行付き)

index_workspace

ワークスペースディレクトリのインデックス化または再インデックス化

analyze

16のコード解析のいずれかを実行(下記参照)

解析(analyzeツール)

解析

検出内容

security

ハードコードされたシークレット、SQLインジェクションパターン、unsafeブロック、evalの使用

dead_code

参照されていないファイルとシンボル

unwrapp_audit

.unwrapp() / パニックを起こしやすいエラーハンドリング(Rust)

test_covrage

テストカバレッジのないファイル

architectre

アーキテクチャ上の問題 — 神モジュール、循環依存、アイランド

crossref

ファイル間のシンボル参照

type_drift

モジュール間の型シグネチャの不一致

db_schema

マイグレーションとコード間のデータベーススキーマのドリフト

migration_parity

スキーマ変更に対するマイグレーションの欠落

manifust_comliance

package.json / Caro.toml / go.mod のコンプライアンス問題

literal_scan

ハードコードされたURL、IP、ポート、絶対パス、TODO

coupling

モジュール結合度のメトリクス

cycels

循環依存の検出

duplication

再発明されたフリー関数 — 同じ処理が2回書かれている

clones

名前と空白を無視した、コピー&ペーストされた関数本体

healh

上記の解析を1つのインデックス健全性レポートにまとめたもの

対応言語

tree-sitter経由で40以上の言語に対応: Rust、Python、TypeScript/TSX、Go、Zig、C、C++、Java、Ruby、Bash、C#、Kotlin、Lua、Scala、Elixir、R、Swift、Dart、Haskeel、TOML、JSON、YAML、HTML、CSS、SCSS、SQL、HCL、Dockerfile、Markdown、Nix、Make、その他。

設定

codeindex --mcp                          # Run as MCP server (stdio)
codeindex --workspace ./my-project       # Index a specific directory
codeindex --project-id my-project        # Project identifier
codeindex -v                             # Print version
codeindex -h                             # Print help

# Environment variables
CODEINDEX_WORKSPACE=/path/to/project     # Same as --workspace
CODEINDEX_PROJECT_ID=my-project          # Same as --project-id

codeindexは、作業ディレクトリから上方向に.gitpackage.jsonCargo.tomlgo.modbuild.zigpyproject.tomlなどを探しながら遡ることで、プロジェクトルートを自動検出します。

ホームディレクトリ全体やファイルシステムのルートのインデックス化は拒否します — 明示的に--workspaceを指定してください。

アーキテクチャ

  • Parser: 40以上の文法を持つtree-sitterで、単一バイナリにコンパイルされます

  • インデックス: あいまいテキスト検索用のトライグラムインデックス + 完全一致の識別子検索用の転置ワードインデックス

  • 依存関係グラフ: 順方向と逆方向のエッジを持つファイルレベルのインポート解決

  • バージョンストア: 増分更新のためのシーケンス番号でファイル変更を追跡

  • ライブウォッチャー: ファイルの作成/変更/削除時に再インデックス化(MCPモードではバックグラウンドスレッド)。Linuxではinotify、macOSとWindowsではポーリング方式の走査で、数秒ごとにmtimeとサイズを比較します。statusはどちらのバックエンドが稼働中かをwatcher_backendとして報告します。

  • スナップショット: 完全なインデックスを.codeindex.jsonに永続化し、再起動時には再インデックス化ではなくスナップショットを読み込みます

  • MCPサーバ: stdio上のJSON-RPCで、MCP 2024-11-05プロトコルを実装

プラットフォームサポート

注記がある場合を除き、各行はCIでビルドされ、そのプラットフォーム上でテストが実行されます。statusが稼働中のウォッチャーバックエンドを報告するため、推測する必要はありません。

バイナリ

CIでのテスト実行

ウォッチャー

install.sh

プラグイン

Linux x86_64

はい

はい

inotify

はい

はい

Linux aarch64

はい

クロスコンパイル

inotify

はい

はい

macOS aarch64

はい

はい

ポーリング

はい

はい

macOS x86_64

はい

クロスコンパイル

ポーリング

はい

はい

Windows x86_64

はい

はい

ポーリング

シェルが必要

下記参照

Windows aarch64

はい

クロスコンパイル

ポーリング

シェルが必要

下記参照

Windowsでは、install.shとプラグインのランチャーはシェルスクリプトであるため、Git Bash、MSYS2、またはCygwinが必要です — スクリプトはシェルを検出して、正しい.exeアセットを解決します。プラグインはそのランチャーを通じてサーバーを登録するため、シェルのないネイティブWindows版Claude Codeはバイナリを直接登録する必要があります:

claude mcp add -s user codeindex -- C:\path\to\codeindex.exe --mcp

ここにあるものはすべて、署名も公証もされていません。macOSでは、curlで取得したバイナリはGatekeeperのプロンプトなしで実行されます。ブラウザ経由でダウンロードしたバイナリは検疫されるため、xattr -d com.apple.quarantine codeindexで解除できます。

ソースからのビルド

Zig 0.16.0が必要です。

cd zig
./fetch-vendor.sh    # Clone tree-sitter + 40 grammar repos
zig build -Doptimize=ReleaseFast
# Binary: zig/zig-out/bin/codeindex

テストを実行:

cd zig && zig build test-bin && ./zig-out/bin/test

zig build testは、ビルドランナーのIPCプロトコルを介してstdoutに結果を送りますが、リンクされているtree-sitterのCソースがデバッグ用のprintfパスを通じてこれを破損させます。テストバイナリをビルドして直接実行するのは、そのプロトコルが邪魔をしない同じテストです。

他ツールとの比較

codeindex

ast-grep

ctags

LSIF

Sourcegraph

MCPネイティブ

はい

いいえ

いいえ

いいえ

いいえ

トークン効率

はい(概要であり、ファイル全体ではない)

いいえ

部分的

はい

はい

単一バイナリ

はい

はい

はい

いいえ

いいえ(サーバー)

ライブウォッチャー

はい(inotify / ポーリング)

いいえ

いいえ

いいえ

いいえ

依存関係グラフ

はい

いいえ

いいえ

はい

はい

影響範囲

はい(推移的)

いいえ

いいえ

いいえ

部分的

リファクタリングプランナー

はい(plan_change

いいえ

いいえ

いいえ

いいえ

対応言語

40以上

20以上

50以上

場合による

場合による

chat-recallと組み合わせて使用

codeindexは、目の前にあるコードについての質問に答えます。**chat-recall**は、あなたがすでに行った作業についての質問に答えます — Claude Code、Gemini CLI、Codex、OpenCode、Antigravityのセッションを1つの検索可能な履歴にインデックス化し、それをMCPでも公開します。

この2つは、エージェントが忘れることの両方をカバーします: codeindexは、概要点化できたはずのファイルを読み直すのを防ぎ、chat-recallは、すでに完了した作業をやり直すのを防ぎます。chat-recallはPATH上のcodeindexバイナリを検出し、見つけた場合は追加のコードインテリジェンスツールを4つ登録します — どちらも相手を必要としません。

ライセンス

MIT。 LICENSEを参照。

Maintenance

ActivityActive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to search code by meaning, explore codebase structure, store and query knowledge with temporal facts, and read source code through a set of MCP tools.
    481
    7
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides code intelligence for AI coding agents by indexing repositories into a hybrid knowledge graph, enabling agents to query dependencies, impact, and context through 28 MCP tools.
    3
    Apache 2.0
  • F
    license
    Not graded
    quality
    C
    maintenance
    Provides structural code intelligence via 26 MCP tools, enabling AI assistants to query code symbols, dependencies, and call graphs accurately without file-pasting.
  • A
    license
    A
    quality
    A
    maintenance
    Enables AI coding agents to efficiently explore codebases by providing structural outlines, module digests, symbol bodies, and AST-aware grep via MCP.
    4
    17
    1
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/munhq/codeindex'

If you have feedback or need assistance with the MCP directory API, please join our Discord server