modelcontextprotocol / modelcontextprotocol/java-sdk
Reject listRoots if not supported by client, without sending any request
Open
Beginner friendly
Nobody has claimed this yet.
enhancement
good first issue
P3
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 1.1k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 9
Description
Some requests in McpAsyncServerExchange make a point of failing fast if functionality not supported, such the condition on line 146
listRoots does not do the same
For example, add this
if (this.clientCapabilities.roots() == null) {
return Mono.error(new IllegalStateException("Client must be configured with root listing capabilities"));
}
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
Read mcp-core/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java, especially the existing capability check around lines 141-151 and the listRoots entry point around lines 227-230. Confirm that an unsupported roots capability is rejected before any request is sent, with the specified error behavior, then run the relevant project tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100