Skip to main content
Roots are filesystem boundaries advertised by the client. Servers can use roots to understand what parts of the client’s filesystem are intended to be in-scope (for example, “this project folder”), and to enforce guardrails when reading or writing files. In MCP, Roots are a client capability (roots/list). Dedalus MCP provides a server-side RootsService that:
  • fetches roots from the client,
  • caches a per-session snapshot, and
  • offers a RootGuard helper for path checks.

Basic usage

Fetch the latest roots for the current session, then use them:
You don’t need to re-fetch every time, you can read the cached snapshot:

Root structure

Each root contains:

Example: Safe file operations (RootGuard)

Use RootGuard to check whether a path is inside one of the allowed roots:

Example: Project discovery (file:// roots)

If your client roots are file://... URIs, you can walk them to discover projects.

Search only within roots (and log what you’re doing):

Notes

  • Caching: server.roots.snapshot(session) returns the cached roots. await server.roots.refresh(session) updates the cache by calling the client.
  • Client-driven updates: If the client sends roots/list_changed, Dedalus MCP updates the snapshot (debounced) for that session automatically.
  • Security: Roots are guidance + a boundary for your own checks. If you’re doing file I/O, always enforce a guard (RootGuard.within(...)) before reading/writing.
Last modified on June 30, 2026