You are an agent configuring codetree (a read-only stdio MCP server) for the user's project. Do the configuration yourself: edit the client config, reload the client, verify the tools, and report exactly what you changed. Do not publish the package and do not modify codetree's source.
git rev-parse --show-toplevel # or use the current workspace directoryUse that absolute path as <ROOT> everywhere below. Never set CODETREE_ROOTS
to /, C:\, or the user's home directory.
node -v # must be >= 20
npx -y @ringko-ai/codetree --version # 0.6.0 or newer0.6.0+exposesoutline,read_file,search,grep,exports,imports,usages, resolves pnpm/tsconfig workspace packages, groups imports by module, and reports re-exports asvia.0.5.0addsusagesand runtime imports;0.4.0addsexports/imports;0.2.0addsgrep;0.1.0only has the first three.- The npm registry may still serve an older release (0.3.0 at the time of
writing). When a tool is missing, prefer a local checkout
(
node <CODETREE_DIR>/dist/main.js, runpnpm buildfirst) or the 0.6.0 tarball until 0.6.0 is published.
Smoke test before touching any config:
npx -y @ringko-ai/codetree --roots "<ROOT>" --print src --depth 1Run it from the user's project, not from inside the codetree package directory (npx resolves the local package there and may fail to find the bin).
Always back up and merge an existing config; never overwrite unrelated servers.
claude_desktop_config.json (or the client's MCP settings):
{
"mcpServers": {
"codetree": {
"command": "npx",
"args": ["-y", "@ringko-ai/codetree"],
"env": { "CODETREE_ROOTS": "<ROOT>" }
}
}
}.vscode/mcp.json in the workspace:
{
"servers": {
"codetree": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@ringko-ai/codetree"],
"env": { "CODETREE_ROOTS": "<ROOT>" }
}
}
}.mcp.json in the solution directory, or %USERPROFILE%\.mcp.json:
{
"servers": {
"codetree": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@ringko-ai/codetree"],
"env": { "CODETREE_ROOTS": "<ROOT>" }
}
}
}Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add → STDIO, then paste:
{
"mcpServers": {
"codetree": {
"command": "npx",
"args": ["-y", "@ringko-ai/codetree"],
"env": { "CODETREE_ROOTS": "<ROOT>" }
}
}
}hermes mcp add codetree --command npx --env CODETREE_ROOTS="<ROOT>" \
--args -y @ringko-ai/codetree--args must be the last option (it consumes the rest of the command line).
Reload with /reload-mcp or start a new session.
Edit mcp.json (Program → Install → Edit mcp.json) and add the mcpServers
entry above, then reload. If the build rejects command/args, use its HTTP
mode with a stdio→HTTP bridge instead.
Do not configure it: Android Studio's MCP client supports Streamable HTTP only
and explicitly does not support stdio. Use one of the clients above, or put a
stdio→HTTP bridge in front of codetree and configure httpUrl.
Restart the client or run its MCP reload action, then check that all seven tools are listed:
outline, read_file, search, grep, exports, imports, usages
Call outline on a small directory to confirm parsing:
{ "name": "outline", "arguments": { "path": "src", "depth": 2 } }Then confirm the module tools: exports on a file, imports on a file with a
dynamic import, and usages for a symbol that is called from another file:
{ "name": "usages", "arguments": { "name": "startServer", "include_calls": true } }If the client shows fewer than seven tools, the registry still resolved an older release — switch to a local checkout or the 0.6.0 tarball.
Tell the user: client and config file changed, <ROOT>, codetree version, and
the tool list. Mention that the server is read-only and confined to
CODETREE_ROOTS.
outlinefirst: directories expand todepthlevels; a file appends its resolved reference tree. Start at depth 1–3.read_filewithstart_line/end_linefrom the outline; avoid reading whole large files.searchfor declarations (name/signature/doc).grepfor text, with-i,-w,-C,-l,-c,--include,--exclude.exportsanswers "what does this file or directory publish?" (kindsfilters classes, interfaces, functions, ...;export … fromrows arevia).importsanswers "what does it depend on?", withdynamic: truefor runtime imports (import(),require(),Class.forName,dlopen, ...) markeddyn;group: falsegives one row per symbol, otherwise rows share a specifier. Workspace packages (@scope/pkg) resolve throughpnpm-workspace.yaml/workspacesand packageexports/main, plus tsconfigpaths; they are no longer labelled(external).usagesis the reverse lookup: give aname(ortargetfile) and get call sites, imports and type references across the workspace;include_callsandinclude_importswiden the result.- Everything is bounded (characters, entries, files, 20 s); truncation is reported, never silent.
| Symptom | Fix |
|---|---|
Connection closed right after adding (Hermes) |
--args was not last; re-add with --args as the final option |
PATH_OUTSIDE_ROOT |
CODETREE_ROOTS does not contain the path; fix the root, not the path |
missing grammars |
use npx (grammars ship in the package) or rebuild the checkout (pnpm build) |
| Android Studio rejects the server | stdio is unsupported; use HTTP + bridge |
| Fewer than seven tools | registry serves an older release; use 0.6.0+ or the local build |
Apache-2.0. The full license text is in LICENSE and ships with the npm package.