loctree-mcp
Officialインストール
curl -fsSL https://loct.io/install.sh | sh # One-liner (installs from crates.io)またはCargo経由で直接インストール:
cargo install loctree # CLI: loct, loctree
cargo install loctree-mcp # MCP server for AI agentsRelated MCP server: Context Bunker MCP
クイックスタート
アーティファクトはデフォルトでOSのキャッシュディレクトリに保存されます(LOCT_CACHE_DIRで上書き可能)。
loct # Scan project, write cached artifacts
loct --for-ai # AI-optimized overview (health, hubs, quick wins)
loct slice src/App.tsx --consumers # Context: file + deps + consumers
loct find useAuth # Find symbol definitions
loct find 'Snapshot FileAnalysis' # Cross-match: where terms meet
loct impact src/utils/api.ts # What breaks if you change this?
loct health # Quick summary: cycles + dead + twins
loct dead --confidence high # Unused exports
loct cycles # Circular imports
loct twins # Dead parrots + duplicates + barrel chaos
loct audit # Full codebase review機能
loctreeは、プロジェクトの実際の依存関係グラフを一度のスキャンでキャプチャし、そのスナップショットから構造的な質問に即座に回答します。すべてのファイルを読み込まずに、必要なコンテキストのみを抽出する必要があるAIエージェント向けに設計されています。
主な機能:
ホログラフィック・スライス - ファイル、依存関係、コンシューマーを1回の呼び出しで抽出
クロス・マッチ検索 - 複数の用語が共起する場所を検索(単純なgrepではありません)
デッドエクスポート検出 - JS/TS、Python、Rust、Go、Dart全体で未使用のエクスポートを特定
循環インポート検出 - Tarjanの強連結成分分解アルゴリズムで実行時の問題を捕捉
ハンドラ追跡 - FE/BEパイプライン全体でTauriコマンドを追跡
影響分析 - 削除やリファクタリングを行う前に、何が壊れるかを可視化
jqクエリ - jq構文を使用してスナップショットデータをクエリ可能 (
loct '.files | length')
MCPサーバー
loctreeは、AIエージェントとのシームレスな統合のためにMCPサーバーとして提供されます:
loctree-mcp # Start via stdio (configure in your MCP client)ツール: repo-view, slice, find, impact, focus, tree。各ツールは project パラメータを受け取り、初回使用時に自動スキャンを行い、スナップショットをRAMにキャッシュします。
{
"mcpServers": {
"loctree": {
"command": "loctree-mcp",
"args": []
}
}
}言語サポート
言語 | デッドエクスポート精度 | 備考 |
Rust | ~0% FP | rust-lang/rust (35Kファイル) でテスト済み |
Go | ~0% FP | golang/go (17Kファイル) でテスト済み |
TypeScript/JavaScript | ~10-20% FP | JSX/TSX, Reactパターン, Flow, WeakMap |
Python | ~20% FP | ライブラリモード, |
Svelte | <15% FP | テンプレート解析, .d.ts再エクスポート |
Vue | ~15% FP | SFCサポート, Composition & Options API |
Dart/Flutter | 完全対応 | pubspec.yaml検出 |
Cargo.toml, tsconfig.json, pyproject.toml, pubspec.yaml, src-tauri/ からスタックを自動検出します。
ホログラフィック・スライス
任意のファイルの3層コンテキストを抽出:
loct slice src/App.tsx --consumersSlice for: src/App.tsx
Core (1 files, 150 LOC):
src/App.tsx (150 LOC, ts)
Deps (3 files, 420 LOC):
[d1] src/hooks/useAuth.ts (80 LOC)
[d2] src/contexts/AuthContext.tsx (200 LOC)
[d2] src/utils/api.ts (140 LOC)
Consumers (2 files, 180 LOC):
src/main.tsx (30 LOC)
src/routes/index.tsx (150 LOC)
Total: 6 files, 750 LOCクロス・マッチ検索
複数用語のクエリで、単純なOR検索ではなく、用語が交差する場所を表示:
loct find 'Snapshot FileAnalysis'=== Cross-Match Files (9) ===
src/snapshot.rs: Snapshot(6), FileAnalysis(4)
src/slicer.rs: Snapshot(2), FileAnalysis(3)
...
=== Symbol Matches (222 in cross-match files) ===
src/snapshot.rs:20 - Snapshot [struct]
src/types.rs:15 - FileAnalysis [struct]
...
=== Parameter Matches (4 cross-matched) ===
src/slicer.rs:45 - snapshot: &Snapshot in build_slice(analyses: &[FileAnalysis])jqクエリ
スナップショットデータを直接クエリ:
loct '.dead_parrots' # Dead code findings
loct '.files | length' # Count files
loct '.edges[] | select(.from | contains("api"))' # Filter edges
loct '.summary.health_score' # Health scoreCI統合
loct lint --fail --sarif > results.sarif # SARIF for GitHub/GitLab
loct --findings | jq '.dead_parrots | length' # Check dead code count
loct doctor && echo 'Clean' # Health gateクレート
クレート | 説明 |
コアアナライザー + CLI ( | |
HTMLレポートレンダラー (Leptos SSR) | |
AIエージェント用MCPサーバー |
開発
make precheck # fmt + clippy + check (run before push)
make install # Install loct + loctree-mcp
make test # Run all workspace tests
make publish # Cascade publish to crates.ioバッジ
[](https://crates.io/crates/loctree)ライセンス
MIT OR Apache-2.0。 LICENSE-MIT および LICENSE-APACHE を参照してください。
VibeCrafted with AI Agents (c)2026 Loctree Team
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
AI-powered codebase analysis — call graphs, security, dead code, complexity. 150+ tools.
Related MCP Servers
- AlicenseCqualityAmaintenanceLocal-first codebase intelligence engine providing AI coding agents with a typed MCP toolset for understanding and navigating code repositories.10051Apache 2.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that indexes your codebase using tree-sitter AST parsing and gives AI tools instant access to structural intelligence like dependency graphs, call trees, and dead code detection from a local SQLite database.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for semantic codebase navigation that builds an AST index of symbols, imports, and exports, providing AI agents with tools to search, explore, and understand code.MIT
- AlicenseNot gradedqualityBmaintenanceA local-first codebase intelligence layer for AI coding agents, providing a persistent, queryable model of a repository via an MCP server and CLI to enable structure queries instead of reading many files.Apache 2.0