modelcontextprotocol / modelcontextprotocol/java-sdk

Reject listRoots if not supported by client, without sending any request

未关闭 适合新手
#1,067 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

enhancement good first issue P3
主要语言
Java
星标
3.7k
派生
1.1k
平均合并
1 天 15 小时
30 天内合并 PR
9

描述

Some requests in McpAsyncServerExchange make a point of failing fast if functionality not supported, such the condition on line 146

https://github.com/modelcontextprotocol/java-sdk/blob/fd004989b9484c9b81be6b03463396797b354804/mcp-core/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java#L141-L151

listRoots does not do the same

https://github.com/modelcontextprotocol/java-sdk/blob/fd004989b9484c9b81be6b03463396797b354804/mcp-core/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java#L227-L230

For example, add this

if (this.clientCapabilities.roots() == null) { 
    return Mono.error(new IllegalStateException("Client must be configured with root listing capabilities")); 
} 

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

阅读 mcp-core/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java,尤其是第 141-151 行附近现有的 capability 检查,以及第 227-230 行附近的 listRoots 入口点。确认不支持的 roots capability 会在发送任何请求之前,按照指定的错误行为被拒绝,然后运行相关的项目测试。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
描述清楚
新手友好度
82/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。