Skip to content

IMcpClientRoots

Provides access to MCP client roots for the current MCP session.

public interface IMcpClientRoots

Clears the soft roots for the current session.

void ClearSoftRoots()

Resolves the current effective roots for the session, refreshing native roots on demand when supported.

ValueTask<IReadOnlyList<McpClientRoot>> GetAsync(CancellationToken cancellationToken = default)

ValueTask<IReadOnlyList<McpClientRoot>>

Sets soft roots for the current session — which under mcp serve is the connection, and on a reused BuildMcpServerOptions() result is every connection built from it. See Current.

void SetSoftRoots(IEnumerable<McpClientRoot> roots)
  • roots (IEnumerable<McpClientRoot>)

Gets the current effective roots for the session. Native roots are preferred once resolved; otherwise soft roots are returned.

IReadOnlyList<McpClientRoot> Current { get; }

IReadOnlyList<McpClientRoot>

Gets a value that indicates whether soft roots were configured for the current session.

bool HasSoftRoots { get; }

bool

Gets a value that indicates whether the connected MCP client supports native roots discovery.

bool IsSupported { get; }

bool