Expand description
Source-file tooling: read_source / grep / list_source.
Operates on a dynamic source root provider — a closure returning
the active list of allowed dirs at the moment of each tool call.
GitHub-workspace mode wires this to the active repo’s path; local-
workspace mode wires it to the bound root (re-routed on each
set_root_dir call); --source-root and --watch modes wire it
to a fixed root. An empty list signals “no active source” and the
tools return a friendly error.
All path traversal protection is done by canonicalising the resolved path against the allowed dirs before any I/O happens.
Design: stay close to the existing Python mcp_methods semantics
(line numbers, header format, “showing N of M matches”, etc.) so a
manifest written for the legacy Python server returns visually
similar output.
Structs§
Functions§
- grep
- list_
source - read_
source - Read a file from one of the allowed source dirs.
- resolve_
dir_ under_ roots - Resolve a path under the first allowed dir for directory listing.
Differs from
resolve_under_rootsin that it accepts directories, non-existent paths included only after canonicalisation succeeds. - resolve_
under_ roots - Resolve
file_pathagainst the allowed dirs and verify the canonical path lives under at least one of them. ReturnsNonewhen the file is missing or the path traversal lands outside the sandbox.
Type Aliases§
- Source
Roots Provider - Provider returning the current allowed source dirs.