I have an MCP server build using the SDK. I need it to determine the workspace context of the client that is attempting to execute its tools. As I understand it, a roots/list request from the MCP server to the client is the mechanism defined in the MCP spec to do this. There seem to possibly be some APIs in the SDK for this, but they don't seem to be documented at all.
Things I've tried:
- Use the extra.sendRequest param while in a tool request handler
const result = await extra.sendRequest(
{ method: 'roots/list' } as const,
ListRootsResultSchema
);
- Use the server.listRoots method (also in the request handler)
const result = await mcpServer.server.listRoots()
I've tried each with stateful and stateless versions of StreamableHTTPServerTransport construction. All attempts hang until eventually timing out.
If this is not yet supported, my request is:
Implement support for `roots/list` requests from server to client
If it is supported, and I'm just using incorrectly, my request is:
Document `roots/list` requests from server to client
I have an MCP server build using the SDK. I need it to determine the workspace context of the client that is attempting to execute its tools. As I understand it, a
roots/listrequest from the MCP server to the client is the mechanism defined in the MCP spec to do this. There seem to possibly be some APIs in the SDK for this, but they don't seem to be documented at all.Things I've tried:
I've tried each with stateful and stateless versions of
StreamableHTTPServerTransportconstruction. All attempts hang until eventually timing out.If this is not yet supported, my request is:
If it is supported, and I'm just using incorrectly, my request is: