Skip to main content
Glama

repo-compass

An MCP server that gives coding agents structural understanding of a codebase — symbols, references, module dependencies, diff impact, hotspots — plus an eval harness that measures whether it actually helps.

Under construction. See PLAN.md for the roadmap. Done so far: M0 (scaffold), M1 (indexer), M2 (MCP server), M3 (git-aware tools).

Install

uv sync                 # add --extra agent for the anthropic SDK (API scripts only)

Related MCP server: codebase-rag

Usage

uv run compass index path/to/repo              # index Java + Python (incremental on re-run)
uv run compass symbol Order.add --repo path/to/repo --refs

compass symbol accepts a simple name (add), a qualified suffix (Order.add) or search words (getUser also finds get_user_by_id). --refs lists call sites, each labeled with a confidence tier:

method com.example.shop.model.Order.add  public Order add(Item item)  .../model/Order.java:25
    exact    .../model/Order.java:36:13  add(...)
    likely   .../service/OrderService.java:17:19  order.add(...)

The index is stored in your user cache directory (never inside the repository); --db overrides the location.

Use it from Claude Code

From the repository you want to work on, register the server (replace the path with your repo-compass checkout):

claude mcp add repo-compass -- uv run --project /path/to/repo-compass compass serve --repo .

--project (not --directory) keeps the working directory where Claude Code started, so --repo . is your repository. There is no separate indexing step: the server indexes in the background when it starts and refreshes before every tool call. The first call on a large repo may reply "index building, retry" if the build takes more than a few seconds.

Eight read-only tools: repo_summary, search_symbols, get_symbol, find_references, file_outline, module_dependencies, and two that read git history: diff_impact (changed symbols between two refs or against the working tree, their callers outside the diff, dangling uses of removed ones) and hotspots (files ranked by commits x lines inside methods). Answers are compact text, ranked, and capped per tool with an explicit [truncated: N more] line. Formats, ranking rules and token caps: docs/tools.md. An end-to-end run in Claude Code on commons-lang and flask, including what went wrong: docs/e2e-m2.md; for the git tools, docs/e2e-m3.md.

Limitations

  • Reference resolution is approximate. It uses names, imports, packages and scopes, not types. exact means the binding is certain from syntax; likely means the target's class is visible but the receiver's type is unknown; possible means only the name matches. There is no type inference or override/dispatch analysis. Details and known failure cases: ADR-003.

  • Only call sites are references. Type usages (parameters, extends, casts) are not.

  • module_dependencies sees import statements only. Java classes used from the same package, or written fully qualified without an import, add no edge.

  • Tool token counts are estimated as characters / 3 (no offline Claude tokenizer), see ADR-005.

  • Outside a git work tree, .gitignore is not applied (ADR-004).

  • diff_impact finds changed symbols exactly (both versions are parsed), but their callers come from the same approximate resolution, from the working tree's index, with no override analysis. hotspots counts commits per file, not lines changed. Both need git. Limits: docs/tools.md, ADR-007.

  • Java and Python only.

Indexing speed: about 2.4s for a 50k-line repo, and 7.3s for apache/commons-lang (207k lines). See docs/benchmarks.md, including the slower first run after a fresh clone.

Development

uv run pytest -q                 # tests (includes a benchmark and a stdio test marked slow)
uv run pytest -q -m "not slow"   # skip the slow ones
uv run ruff check .              # lint
uv run ruff format --check .     # format check
uv run python scripts/bench_index.py --synthetic 50000

Design decisions are recorded in docs/adr/.

License

MIT

Available Tools

8 tools
diff_impactA
Read-only

What a change touches: symbols changed between base and head (removed, signature, body, added), their callers outside the diff by tier, dangling uses of removed ones, importers. Compares the merge base, like a PR; head: a ref, default the working tree. Ranked: removed/signature changes with callers outside the diff first. <= 2000 tokens.

Inputs: base (required), head, limit.

file_outlineA
Read-only

Symbols a file defines, with line ranges and signatures, without reading it. Truncation keeps types, then methods, then fields. <= 1500 tokens.

Inputs: path (required), limit.

find_referencesA
Read-only

Call sites of a symbol, grouped by file, with calling symbol and source line. Tier: exact (certain from syntax), likely (type visible, receiver type unknown), possible (name only). Ranked exact>likely>possible, non-test first. <= 2000 tokens.

Inputs: symbol (required), limit.

get_symbolB
Read-only

Source of one symbol: body for methods/functions, member list for types, plus doc. symbol: 'Order.add', a qualified name, or path:line. <= 2000 tokens.

Inputs: symbol (required), max_lines.

hotspotsB
Read-only

Files that change often and hold much code: commits x lines inside methods, per file, renames followed. since: a ref or a date ('6 months ago'), default 1 year. Test files left out unless include_tests. <= 1200 tokens.

Inputs: limit, since, include_tests.

module_dependenciesA
Read-only

Import graph between packages/modules, and import cycles. No module: overview. module: a name, 'pkg.*' or a prefix: its imports, importers, external deps, cycles. Test files are left out unless include_tests. <= 1200 tokens.

Inputs: limit, module, include_tests.

repo_summaryA
Read-only

Overview: languages, size, packages by lines, index freshness. Start here. <= 600 tokens.

Inputs: limit.

search_symbolsA
Read-only

Find symbols by name: 'save', 'Order.add', or words ('get user' finds get_user_by_id). Returns file:line, kind, signature; no bodies. Ranked exact name, then word match; non-test first. kind: class|interface|enum|record|annotation|method|constructor|function|field. path: only in this dir, file or package ('model/', 'com.x.model'); with query '' it lists what path defines, types first. <= 1500 tokens.

Inputs: query (required), kind, path, limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a distinct analysis task: repo overview, symbol search/retrieval, file outline, reference lookup, module dependencies, churn hotspots, and diff impact. The overlap between find_references and diff_impact is minimal and contextually separated by change-focused vs. general reference lookup.

    Naming Consistency3/5

    Names use snake_case throughout, but they mix verb_noun (search_symbols, get_symbol, find_references) with noun_phrase (diff_impact, hotspots, repo_summary, file_outline, module_dependencies). The convention is readable but not predictable as a single pattern.

    Tool Count5/5

    Eight tools are well-scoped for a repository analysis server, with no obvious redundancy. Each tool covers a distinct and useful analysis capability, fitting comfortably in the recommended 3-15 range.

    Completeness4/5

    The set covers core static analysis needs: overview, symbol search, symbol retrieval, file outline, references, dependencies, churn, and change impact. Minor gaps exist, such as direct file content reading or type hierarchy/call graph queries, but agents can often work around these using other tools.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A graph-powered code intelligence engine that indexes codebases into a structural knowledge graph to provide AI agents with deep context on function calls, types, and execution flows. It offers local, zero-dependency tools for hybrid search, impact analysis, and dead code detection across Python, JavaScript, and TypeScript projects.
      1,036 PyPI
      816
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM agents to efficiently understand and navigate a codebase by providing semantic search over symbols and a reference graph, replacing expensive grep/glob calls with structured tools like definition lookup, caller/callee queries, and change-impact analysis.
      4
      MIT
    • F
      license
      A
      quality
      D
      maintenance
      Provides codebase indexing and retrieval tools that give AI agents token-efficient, query-relevant context packages (symbols, imports, and dependencies) instead of scanning entire repositories.
      6
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Indexes a codebase into a symbol-level graph and exposes tools for finding symbols, querying relationships, and assessing impact, letting AI coding agents answer structural questions in a single call within a token budget.
      83 npm
      4
      Apache 2.0