loctree-mcp
OfficialInstallation
curl -fsSL https://loct.io/install.sh | sh # One-liner (installs from crates.io)Oder direkt über Cargo:
cargo install loctree # CLI: loct, loctree
cargo install loctree-mcp # MCP server for AI agentsRelated MCP server: MCP Codebase Server
Schnellstart
Artefakte werden standardmäßig im Cache-Verzeichnis Ihres Betriebssystems gespeichert (überschreibbar über 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 reviewWas es tut
loctree erfasst den tatsächlichen Abhängigkeitsgraphen Ihres Projekts in einem einzigen Scan und beantwortet dann sofort strukturelle Fragen aus dem Snapshot. Entwickelt für KI-Agenten, die fokussierten Kontext benötigen, ohne jede Datei lesen zu müssen.
Kernfunktionen:
Holografischer Slice - Extraktion von Datei + Abhängigkeiten + Konsumenten in einem Aufruf
Cross-Match-Suche - Finden, wo mehrere Begriffe gemeinsam auftreten (kein flaches Grep)
Erkennung ungenutzter Exporte - Finden Sie ungenutzte Exporte in JS/TS, Python, Rust, Go, Dart
Erkennung zirkulärer Importe - Tarjans SCC-Algorithmus erkennt Laufzeitfehler
Handler-Tracing - Verfolgen Sie Tauri-Befehle durch die gesamte FE/BE-Pipeline
Auswirkungsanalyse - Sehen Sie, was kaputt geht, bevor Sie löschen oder refactoren
jq-Abfragen - Abfrage von Snapshot-Daten mit jq-Syntax (
loct '.files | length')
MCP-Server
loctree wird als MCP-Server für eine nahtlose Integration von KI-Agenten ausgeliefert:
loctree-mcp # Start via stdio (configure in your MCP client)Tools: repo-view, slice, find, impact, focus, tree. Jedes Tool akzeptiert einen project-Parameter – scannt automatisch bei der ersten Verwendung und speichert Snapshots im RAM.
{
"mcpServers": {
"loctree": {
"command": "loctree-mcp",
"args": []
}
}
}Sprachunterstützung
Sprache | Genauigkeit ungenutzter Exporte | Hinweise |
Rust | ~0% FP | Getestet mit rust-lang/rust (35K Dateien) |
Go | ~0% FP | Getestet mit golang/go (17K Dateien) |
TypeScript/JavaScript | ~10-20% FP | JSX/TSX, React-Muster, Flow, WeakMap |
Python | ~20% FP | Bibliotheksmodus, |
Svelte | <15% FP | Template-Analyse, .d.ts Re-Exporte |
Vue | ~15% FP | SFC-Unterstützung, Composition & Options API |
Dart/Flutter | Vollständig | pubspec.yaml-Erkennung |
Erkennt den Stack automatisch anhand von Cargo.toml, tsconfig.json, pyproject.toml, pubspec.yaml, src-tauri/.
Holografischer Slice
Extrahieren Sie 3-Ebenen-Kontext für jede Datei:
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 LOCCross-Match-Suche
Multi-Term-Abfragen zeigen, wo Begriffe aufeinandertreffen, nicht flaches ODER:
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-Abfragen
Snapshot-Daten direkt abfragen:
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-Integration
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 gateCrates
Crate | Beschreibung |
Kern-Analyzer + CLI ( | |
HTML-Report-Renderer (Leptos SSR) | |
MCP-Server für KI-Agenten |
Entwicklung
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.ioBadge
[](https://crates.io/crates/loctree)Lizenz
MIT ODER Apache-2.0. Siehe LICENSE-MIT und LICENSE-APACHE.
VibeCrafted mit KI-Agenten (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
- 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 gradedqualityDmaintenanceMCP 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 gradedqualityDmaintenanceA 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
- AlicenseBqualityBmaintenanceIndexes a Python/JS/TS repository into a local SQLite knowledge graph so agents can trace callers, callees, imports, subclasses and covering tests, measure impact radius, rank diff risk, and summarize architecture without grepping files. Exposes these queries as MCP tools alongside an equivalent CLI, with no daemon, embeddings, or network access.10MIT