codetree
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
codetree
tree shows the shape of a directory. codetree shows the shape of the code
inside it: directories → files → classes, functions and methods, one row each
with its line range, visibility and the one-sentence purpose from the doc
comment — and, for a file, the classes it references, rendered as a tree with
the file each one resolves to.
It is read-only, uses tree-sitter instead of a compiler or language server, and supports TypeScript, TSX, JavaScript, Python, Java and Kotlin. A grep mode covers the other half of code reading: text lines, with grep flags.
src/main/java/com/acme/order/
└─ OrderService.java (5 syms · 23 L · 9 refs)
└─ cls public class OrderService extends BaseService implements OrderApi :9-23 pub "Places orders."
├─ field private final OrderRepo repo :10 priv
├─ field private final Clock clock :11 priv
├─ ctor public OrderService(OrderRepo repo, Clock clock) :13-16 pub
└─ meth public Order place(Cart cart, List<Item> items) :19-22 pub "Validates the cart, then writes the order."
references (9 total, 8 resolved, 1 external):
├─ imp BaseService com.acme.base.BaseService -> src/main/java/com/acme/base/BaseService.java
├─ imp Clock com.acme.clock.Clock -> src/main/java/com/acme/clock/Clock.java
├─ imp List java.util.List (external)
├─ imp OrderRepo com.acme.repo.OrderRepo -> src/main/java/com/acme/repo/OrderRepo.java
├─ impl OrderApi -> src/main/java/com/acme/order/OrderApi.java
├─ new CartValidator -> src/main/java/com/acme/order/CartValidator.java
├─ param Cart -> src/main/java/com/acme/order/Cart.java
├─ param Item -> src/main/java/com/acme/order/Item.java
└─ ret Order -> src/main/java/com/acme/order/Order.java
[1 file · 5 symbols · java · 53 ms]Why
An agent has a context budget. ls says nothing about purpose, a raw symbol dump
wastes tokens, and grep finds one name at a time. codetree answers three
questions in one compact hierarchy: what exists, what each implementation does,
and what it depends on.
Related MCP server: codebase-rag
Quick start
Give this to your agent:
Set up codetree for this project: follow AGENTS.md, verify the MCP server, add it to my client with CODETREE_ROOTS set to the project root, reload, and confirm the outline, read_file, search and grep tools.Or run it yourself:
npx -y @ringko-ai/codetree --print srcFrom a local checkout:
pnpm install
pnpm build
node dist/main.js --print srcDepth
--depth (CLI) and depth (MCP) control how many directory levels are expanded:
codetree --depth 1 --print src # the immediate children, plus their files
codetree --depth 3 --print src # three levels downEach opened file carries its reference count, so going deeper exposes more files and therefore more references. Pass a file instead of a directory to expand those references into a tree with the resolved target path:
npx -y @ringko-ai/codetree --print src/main.tsdepth is clamped to 1–12 (default 3), and every result is bounded by an entry
budget and a character budget; truncation is reported in the footer.
Grep
The tree answers "what is here"; grep answers "where is this text". It is line-oriented and repo-wide, with the flags you expect from grep:
codetree grep "place" src # regex, case-sensitive by default
codetree grep -i -w "place" src # case-insensitive, whole word
codetree grep -C 2 "TODO" . # two lines of context around each match
codetree grep -l "Cart" . # files with matches
codetree grep -c "Order" src # matching-line counts per file
codetree grep -F "operator(" src # literal string (regex still works)
codetree grep --include '*.java' "place" srcOutput is path:line: text; context lines use path-line- text, like grep.
-m <n> stops after n matching lines, --exclude <glob> skips files and
--hidden includes dotfiles. Invalid regexes return an actionable error, and
every result is bounded by the same character budget as the tree.
MCP server
codetree is a stdio MCP server. Any MCP client that supports stdio can launch it:
{
"mcpServers": {
"codetree": {
"command": "npx",
"args": ["-y", "@ringko-ai/codetree"],
"env": { "CODETREE_ROOTS": "/absolute/path/to/project" }
}
}
}Tool | Purpose |
| Implementation tree for a directory or a file. Directories expand to |
| Numbered source lines prefixed by the file outline. Use |
| Find declarations by name, signature or documentation (default), or search source text lines. |
| grep-style text search: literal or regex, case sensitivity, whole words, context lines, counts, files-with-matches. |
Common outline parameters: path, depth, docs, kinds, languages,
max_entries, max_chars, references (single-file reference tree).
Reference resolution
Extraction is tree-sitter based; resolution is a name index, not a compiler.
Language | Import form | Resolution |
TypeScript / JavaScript |
| Relative file lookup, including the |
TypeScript / JavaScript |
| Marked |
Java |
| Package + class probed from the module's |
Kotlin |
| Same probing; supertypes come from the |
Python |
| Module path against the root and |
Non-import references (extends, implements, field, param, ret, new,
type) are matched against the file's import table first, then against sibling
files and the workspace index. Ambiguous names prefer the same package; names
that cannot be resolved are printed without a target instead of being guessed.
Supported languages
typescript (.ts, .mts, .cts), tsx (.tsx, .jsx), javascript
(.js, .mjs, .cjs), python (.py, .pyi), java (.java), kotlin
(.kt, .kts) — via the WASM grammars shipped inside the package.
Limits
Resolution is heuristic: overloads, generics and path aliases are not resolved through a compiler.
Only a doc comment directly above a declaration becomes its purpose; without one the row shows the signature alone.
The workspace class index is built lazily and is not invalidated when files are added or removed during a server session.
Symlinks and junctions are never followed, and every path must stay inside a configured root.
Development
pnpm typecheck # src + tests, zero diagnostics expected
bun test # extractor, resolver and tool tests against tests/fixturesLicense
Apache-2.0.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
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 LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides a semantic understanding of your codebase by parsing with tree-sitter and building a graph of symbols and dependencies. Enables AI assistants to navigate code, analyze changes, and discover architecture using 18 tools with minimal context overhead.14 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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.4MIT
- AlicenseNot gradedqualityDmaintenanceProvides semantic codebase understanding via a graph, enabling AI agents to search, explore, and plan changes with whole-repo context in a single tool call.33MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to navigate and refactor a codebase through an AST index, offering project overviews, symbol and usage search, module dependency exploration, and LSP-backed operations such as rename, go-to-definition, diagnostics, and extract-method. Supports TypeScript/JavaScript and C# with automatic reindexing and watch mode.MIT