modelcontextprotocol / modelcontextprotocol/typescript-sdk
Support `roots/list` request from server to client
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the tool request handler calls to extra.sendRequest and mcpServer.server.listRoots, then compare their behavior across stateful and stateless StreamableHTTPServerTransport construction. Check how the SDK handles server-to-client requests and the roots/list protocol flow. Done means roots/list works without timing out, or the supported usage and limitation are documented if implementation is out of scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100