AiDex
AiDex
AIのコンテキストウィンドウの80%をコード検索で無駄にするのはやめましょう。
AiDexは、永続的で事前構築されたインデックスを通じて、AIコーディングアシスタントにコードベース全体への即時アクセスを提供するMCPサーバーです。Claude Code、Claude Desktop、Cursor、Windsurf、Gemini CLI、VS Code Copilotなど、MCP互換のあらゆるAIアシスタントで動作します。


サーバーに含まれる30のツール
カテゴリ | ツール | 機能 |
検索・インデックス |
| プロジェクトのインデックス作成、名前による識別子の検索(完全一致/部分一致/前方一致)、時間ベースのフィルタリング |
シグネチャ |
| ファイルを読み込まずにクラスやメソッドを取得(単一ファイルまたはglobパターン) |
プロジェクト概要 |
| エントリポイント、言語の内訳、統計付きファイルツリー、タイプ別のファイル一覧 |
プロジェクト間連携 |
| 依存関係のリンク、インデックス済みプロジェクトの検出 |
グローバル検索 |
| 全プロジェクトを横断して検索 — 「Xを書いたことはあるか?」 |
ガイドライン |
| 永続的なAI指示とコーディング規約 — 全プロジェクトで共有 |
セッション |
| セッションの追跡、外部変更の検出、次セッションへのメモ(検索可能な履歴付き) |
タスク管理 |
| 優先度、タグ、自動記録履歴、スケジュール/定期タスクを備えた組み込みタスク管理 |
ログハブ |
| ユニバーサルログ受信機 — あらゆるプログラムからHTTP経由でログを送信、AIによるクエリ可能、Viewerでライブ表示 |
スクリーンショット |
| LLM最適化されたクロスプラットフォーム画面キャプチャ — スケール調整と色数削減でトークンを最大95%節約 |
ビューア |
| ファイルツリー、シグネチャ、タスク、ログ、ライブリロードを備えたインタラクティブなブラウザUI |
11言語対応 — C#, TypeScript, JavaScript, Rust, Python, C, C++, Java, Go, PHP, Ruby
# Find where "PlayerHealth" is defined — 1 call, ~50 tokens
aidex_query({ term: "PlayerHealth" })
→ Engine.cs:45, Player.cs:23, UI.cs:156
# All methods in a file — without reading the whole file
aidex_signature({ file: "src/Engine.cs" })
→ class GameEngine { Update(), Render(), LoadScene(), ... }
# What changed in the last 2 hours?
aidex_query({ term: "render", modified_since: "2h" })
# Search across ALL your projects at once
aidex_global_query({ term: "TransparentWindow", mode: "contains" })
→ Found in: LibWebAppGpu (3 hits), DebugViewer (1 hit)
# Leave a note for your next session
aidex_note({ path: ".", note: "Test the parser fix after restart" })
# Create a task while working
aidex_task({ path: ".", action: "create", title: "Fix edge case in parser", priority: 1, tags: "bug" })目次
課題
AIアシスタントがコードを検索するたびに、以下のことが起こります:
grepで数千のファイルを検索 → 何百もの結果がコンテキストを埋め尽くす
ファイルを次々と読み込んで構造を理解 → コンテキストを大量消費
セッション終了時にすべてを忘れる → 最初からやり直し
「Xはどこで定義されているか?」という質問一つで2,000トークン以上を消費することがあります。これを10回繰り返せば、ナビゲーションだけでコンテキストの半分を使い果たしてしまいます。
解決策
一度インデックスを作成すれば、何度でもクエリ可能:
# Before: grep flooding your context
AI: grep "PlayerHealth" → 200 hits in 40 files
AI: read File1.cs, File2.cs, File3.cs...
→ 2000+ tokens consumed, 5+ tool calls
# After: precise results, minimal context
AI: aidex_query({ term: "PlayerHealth" })
→ Engine.cs:45, Player.cs:23, UI.cs:156
→ ~50 tokens, 1 tool call結果:コードナビゲーションのコンテキスト消費量を50〜80%削減。
なぜgrepでは不十分なのか?
Grep/Ripgrep | AiDex | |
コンテキスト消費 | 検索ごとに2000+トークン | 約50トークン |
結果 | すべてのテキスト一致 | 識別子のみ |
精度 |
|
|
永続性 | 毎回リセット | セッションをまたいでインデックスを保持 |
構造 | フラットなテキスト検索 | メソッド、クラス、型を認識 |
grepの真のコスト:すべてのgrep結果には周囲のコンテキストが含まれます。大規模プロジェクトでUserを検索すると、コメント、文字列、部分一致など何百ものヒットが得られます。AIはそれらすべてを読み込み、ノイズのためにコンテキストトークンを浪費します。
AiDexは識別子をインデックス化します:Tree-sitterを使用してコードを実際に解析します。Userを検索すると、クラス定義、メソッドパラメータ、変数宣言が得られます。「user」という単語を含むすべてのコメントがヒットするわけではありません。
仕組み
プロジェクトのインデックスを一度作成(1000ファイルあたり約1秒)
aidex_init({ path: "/path/to/project" })AIはgrepの代わりにインデックスを検索
aidex_query({ term: "Calculate", mode: "starts_with" }) → All functions starting with "Calculate" + exact line numbers aidex_query({ term: "Player", modified_since: "2h" }) → Only matches changed in the last 2 hoursファイル全体を読み込まずに概要を取得
aidex_signature({ file: "src/Engine.cs" }) → All classes, methods, and their signatures
インデックスは.aidex/index.db(SQLite)に保存されます。高速でポータブル、外部依存関係はありません。
機能
Tree-sitter解析: 正規表現ではなく実際のコード解析 — 識別子をインデックス化し、キーワードやノイズを無視
検索あたり約50トークン: grepの2000+トークンと比較 — AIは実際の作業のためにコンテキストを保持可能
永続的インデックス: セッションをまたいで保持 — 再スキャンや再読み込みは不要
増分更新: プロジェクト全体ではなく、変更された単一ファイルを再インデックス化
時間ベースのフィルタリング: 過去1時間、1日、1週間に変更されたものを検索
自動クリーンアップ: 除外されたファイル(ビルド出力など)は自動的にインデックスから削除
ゼロ依存関係: WALモードのSQLite — 単一ファイルで高速かつポータブル
対応言語
言語 | 拡張子 |
C# |
|
TypeScript |
|
JavaScript |
|
Rust |
|
Python |
|
C |
|
C++ |
|
Java |
|
Go |
|
PHP |
|
Ruby |
|
クイックスタート
1. インストール
npm install -g aidex-mcp以上です。 インストール後にセットアップが自動的に実行されます。インストール済みのAIクライアント(Claude Code, Claude Desktop, Cursor, Windsurf, Gemini CLI, VS Code Copilot)を検出し、AiDexをMCPサーバーとして登録します。また、AIの構成ファイル(~/.claude/CLAUDE.md, ~/.gemini/GEMINI.md)に使用方法を追加します。
手動で再実行する場合:aidex setup | 登録解除:aidex unsetup | 自動セットアップをスキップ:AIDEX_NO_SETUP=1 npm install -g aidex-mcp
2. またはAIアシスタントに手動で登録
Claude Codeの場合 (~/.claude/settings.json または ~/.claude.json):
{
"mcpServers": {
"aidex": {
"type": "stdio",
"command": "aidex",
"env": {}
}
}
}Claude Desktopの場合 (Windowsでは %APPDATA%/Claude/claude_desktop_config.json):
{
"mcpServers": {
"aidex": {
"command": "aidex"
}
}
}注意:
aidexとaidex-mcpはどちらもコマンド名として機能します。
重要: 設定内のサーバー名はMCPツールのプレフィックスを決定します。上記のように
"aidex"を使用してください。これによりaidex_queryやaidex_signatureといったツール名になります。別の名前(例:"codegraph")を使用すると、プレフィックスもそれに応じて変更されます。
Gemini CLIの場合 (~/.gemini/settings.json):
{
"mcpServers": {
"aidex": {
"command": "aidex"
}
}
}VS Code Copilotの場合 (コマンドパレットで MCP: Open User Configuration を実行):
{
"servers": {
"aidex": {
"type": "stdio",
"command": "aidex"
}
}
}その他のMCPクライアントの場合: 各クライアントのMCPサーバー設定ドキュメントを参照してください。
3. AIに実際に使わせる
AIの指示(Claude Codeなら ~/.claude/CLAUDE.md など)に追加します。これにより、AIがgrepの代わりにAiDexをいつ、どのように使用すべきかを指示します:
## AiDex - Persistent Code Index (MCP Server)
AiDex provides fast, precise code search through a pre-built index.
**Always prefer AiDex over Grep/Glob for code searches.**
### REQUIRED: Before using Grep/Glob/Read for code searches
コードを検索したいか? ├── .aidex/ が存在する場合 → 停止!代わりにAiDexを使用 ├── .aidex/ が存在しない場合 → aidex_init を実行(質問不要)、その後AiDexを使用 └── Config/Logs/Text → Grep/ReadでOK
**NEVER do this when .aidex/ exists:**
- ❌ `Grep pattern="functionName"` → ✅ `aidex_query term="functionName"`
- ❌ `Grep pattern="class.*Name"` → ✅ `aidex_query term="Name" mode="contains"`
- ❌ `Read file.cs` to see methods → ✅ `aidex_signature file="file.cs"`
- ❌ `Glob pattern="**/*.cs"` + Read → ✅ `aidex_signatures pattern="**/*.cs"`
### Session-Start Rule (REQUIRED — every session, no exceptions)
1. Call `aidex_session({ path: "<project>" })` — detects external changes, auto-reindexes
2. If `.aidex/` does NOT exist → run `aidex_init` automatically (don't ask)
3. If a session note exists → **show it to the user** before continuing
4. **Before ending a session:** always leave a note about what to do next
### Question → Right Tool
| Question | Tool |
|----------|------|
| "Where is X defined?" | `aidex_query term="X"` |
| "Find anything containing X" | `aidex_query term="X" mode="contains"` |
| "All functions starting with X" | `aidex_query term="X" mode="starts_with"` |
| "What methods does file Y have?" | `aidex_signature file="Y"` |
| "Explore all files in src/" | `aidex_signatures pattern="src/**"` |
| "Project overview" | `aidex_summary` + `aidex_tree` |
| "What changed recently?" | `aidex_query term="X" modified_since="2h"` |
| "What files changed today?" | `aidex_files path="." modified_since="8h"` |
| "Have I ever written X?" | `aidex_global_query term="X" mode="contains"` |
| "Which project has class Y?" | `aidex_global_signatures term="Y" kind="class"` |
| "All indexed projects?" | `aidex_global_status` |
### Search Modes
- **`exact`** (default): Finds only the exact identifier — `log` won't match `catalog`
- **`contains`**: Finds identifiers containing the term — `render` matches `preRenderSetup`
- **`starts_with`**: Finds identifiers starting with the term — `Update` matches `UpdatePlayer`, `UpdateUI`
### All Tools (30)
| Category | Tools | Purpose |
|----------|-------|---------|
| Search & Index | `aidex_init`, `aidex_query`, `aidex_update`, `aidex_remove`, `aidex_status` | Index project, search identifiers (exact/contains/starts_with), time filter |
| Signatures | `aidex_signature`, `aidex_signatures` | Get classes + methods without reading files |
| Overview | `aidex_summary`, `aidex_tree`, `aidex_describe`, `aidex_files` | Entry points, file tree, file listing by type |
| Cross-Project | `aidex_link`, `aidex_unlink`, `aidex_links`, `aidex_scan` | Link dependencies, discover projects |
| Global Search | `aidex_global_init`, `aidex_global_query`, `aidex_global_signatures`, `aidex_global_status`, `aidex_global_refresh` | Search across ALL projects |
| Guidelines | `aidex_global_guideline` | Persistent AI instructions & conventions (key-value, global) |
| Sessions | `aidex_session`, `aidex_note` | Track sessions, leave notes (with searchable history) |
| Tasks | `aidex_task`, `aidex_tasks` | Built-in backlog with priorities, tags, summaries, auto-logged history, scheduled/recurring tasks |
| Log Hub | `aidex_log` | Universal log receiver — any program sends logs via HTTP, AI queries them, live in Viewer |
| Screenshots | `aidex_screenshot`, `aidex_windows` | Screen capture with LLM optimization (scale + color reduction, no index needed) |
| Viewer | `aidex_viewer` | Interactive browser UI with file tree, signatures, tasks, and live logs |
**11 languages:** C#, TypeScript, JavaScript, Rust, Python, C, C++, Java, Go, PHP, Ruby
### Session Notes
Leave notes for the next session — they persist in the database:aidex_note({ path: ".", note: "再起動後に修正をテストする" }) # 書き込み aidex_note({ path: ".", note: "エッジケースも確認", append: true }) # 追記 aidex_note({ path: "." }) # 読み込み aidex_note({ path: ".", search: "parser" }) # 履歴検索 aidex_note({ path: ".", clear: true }) # クリア
- **Before ending a session:** automatically leave a note about next steps
- **User says "remember for next session: ..."** → write it immediately
### Task Backlog
Track TODOs, bugs, and features right next to your code index:aidex_task({ path: ".", action: "create", title: "バグ修正", priority: 1, tags: "bug" }) aidex_task({ path: ".", action: "update", id: 1, status: "done" }) aidex_task({ path: ".", action: "log", id: 1, note: "根本原因を発見" }) aidex_tasks({ path: ".", status: "active" })
スケジュール・定期タスク
aidex_task({ path: ".", action: "create", title: "PRステータス確認", due: "3d", interval: "3d", task_action: "gh pr list" })
Priority: 1=high, 2=medium, 3=low | Status: `backlog → active → done | cancelled`
### Global Search (across all projects)
aidex_global_init({ path: "/path/to/all/repos" }) # スキャンと登録 aidex_global_init({ path: "...", index_unindexed: true }) # + 小規模プロジェクトの自動インデックス aidex_global_query({ term: "TransparentWindow", mode: "contains" }) # 全体検索 aidex_global_signatures({ term: "Render", kind: "method" }) # 全体からメソッド検索 aidex_global_status({ sort: "recent" }) # 全プロジェクト一覧
### Screenshots
aidex_screenshot() # フルスクリーン aidex_screenshot({ mode: "active_window" }) # アクティブウィンドウ aidex_screenshot({ mode: "window", window_title: "VS Code" }) # 特定ウィンドウ aidex_screenshot({ scale: 0.5, colors: 2 }) # 白黒、半サイズ(LLMに最適) aidex_screenshot({ colors: 16 }) # 16色(UI可読) aidex_windows({ filter: "chrome" }) # ウィンドウタイトル検索
No index needed. Returns file path → use `Read` to view immediately.
**LLM optimization strategy:** Always start with aggressive settings, then retry if unreadable:
1. First try: `scale: 0.5, colors: 2` (B&W, half size — smallest possible)
2. If unreadable: retry with `colors: 16` (adds shading for UI elements)
3. If still unclear: `scale: 0.75` or omit `colors` for full quality
4. **Remember** what works for each window/app during the session — don't retry every time.4. プロジェクトのインデックス作成
AIにこう尋ねてください:"Index this project with AiDex"
またはAIチャットで手動実行:
aidex_init({ path: "/path/to/your/project" })利用可能なツール
ツール | 説明 |
| プロジェクトのインデックス作成(.aidex/を作成) |
| 用語による検索(完全一致/部分一致/前方一致) |
| 単一ファイルのクラスとメソッドを取得 |
| 複数ファイルのシグネチャを取得(glob) |
| 変更された単一ファイルの再インデックス |
| 削除されたファイルをインデックスから除外 |
| プロジェクト概要 |
| 統計付きファイルツリー |
| 概要にドキュメントを追加 |
| 他のインデックス済みプロジェクトをリンク |
| リンクされたプロジェクトを削除 |
| リンクされたプロジェクト一覧 |
| インデックス統計 |
| ディレクトリツリー内のインデックス済みプロジェクトを検索 |
| タイプ別のプロジェクトファイル一覧(コード/設定/ドキュメント/アセット) |
| セッションメモの読み書き(セッション間で永続化) |
| セッション開始、外部変更の検出、自動再インデックス |
| ブラウザでインタラクティブなプロジェクトツリーを開く |
| 優先度とタグ付きタスクの作成、読み込み、更新、削除 |
| ステータス、優先度、タグによるタスクのフィルタリングと一覧表示 |
| スクリーンショット撮影(フルスクリーン、ウィンドウ、領域)、スケール・色数削減オプション付き |
| スクリーンショット対象の開いているウィンドウ一覧 |
| ディレクトリツリーをスキャンし、すべてのインデックス済みプロジェクトをグローバルDBに登録 |
| 登録済み全プロジェクトの統計表示 |
| 登録済み全プロジェクトを横断して用語検索 |
`aidex_global_ |
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/CSCSoftware/AiDex'
If you have feedback or need assistance with the MCP directory API, please join our Discord server