Skip to main content
Glama
loctree-mcp

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 agents

Related MCP server: MCP Codebase Server

빠른 시작

아티팩트는 기본적으로 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 에이전트를 위해 설계되었습니다.

핵심 기능:

  • 홀로그래픽 슬라이스(Holographic Slice) - 파일 + 의존성 + 소비자(consumers)를 한 번의 호출로 추출

  • 교차 매칭 검색(Cross-Match Search) - 여러 용어가 함께 나타나는 위치를 검색 (단순 grep이 아님)

  • 사용되지 않는 내보내기 탐지(Dead Export Detection) - JS/TS, Python, Rust, Go, Dart 전반에서 사용되지 않는 내보내기 탐지

  • 순환 참조 탐지(Circular Import Detection) - Tarjan의 SCC 알고리즘으로 런타임 오류 방지

  • 핸들러 추적(Handler Tracing) - 전체 FE/BE 파이프라인을 통해 Tauri 명령 추적

  • 영향 분석(Impact Analysis) - 삭제나 리팩토링 전 영향 범위 확인

  • 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

라이브러리 모드, __all__, 표준 라이브러리 탐지

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 --consumers
Slice 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 score

CI 통합

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

크레이트(Crates)

크레이트

설명

loctree

핵심 분석기 + CLI (loct, loctree)

report-leptos

HTML 리포트 렌더러 (Leptos SSR)

loctree-mcp

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

배지

[![loctree](https://img.shields.io/badge/analyzed_with-loctree-a8a8a8?style=flat&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij48cmVjdCB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIGZpbGw9IiMwMDAiLz48dGV4dCB4PSI4IiB5PSIxMiIgZm9udC1mYW1pbHk9Im1vbm9zcGFjZSIgZm9udC1zaXplPSIxMCIgZmlsbD0iI2E4YThhOCIgdGV4dC1hbmNob3I9Im1pZGRsZSI+TDwvdGV4dD48L3N2Zz4=)](https://crates.io/crates/loctree)

라이선스

MIT 또는 Apache-2.0. LICENSE-MIT 및 LICENSE-APACHE를 참조하세요.


VibeCrafted with AI Agents (c)2026 Loctree Team

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    An 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
  • A
    license
    Not graded
    quality
    D
    maintenance
    MCP 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
  • A
    license
    Not graded
    quality
    D
    maintenance
    A 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
  • A
    license
    B
    quality
    B
    maintenance
    Indexes 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.
    10
    MIT