modelcontextprotocol / modelcontextprotocol/java-sdk
set loggingConsumer after client initialization
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 3.7k
- 派生
- 1.1k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 9
描述
Expected Behavior
We should be able to set a loggingConsumer on McpClient after querying its capabilities.
var capabilities = client.getServerCapabilities();
if (capabilities.logging() != null) {
client.setLoggingLevel(McpSchema.LoggingLevel.INFO);
client.setLoggingConsumer(consumer);
}
Current Behavior
Currently, we can set a loggingConsumer with McpClientTransport before client initialization. For example,
McpClient.sync(server.transport())
.loggingConsumer(consumer)
.build();
Context
However, many MCP servers' logging capabilities are not enabled. But we cannot query if the server has this capability before client initialization. Such a poor design makes it impossible to register a logging consumer safely.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先阅读 McpClient 的初始化和能力查询流程,然后将其与 McpClientTransport 的 loggingConsumer 配置进行比较。验证 setLoggingLevel 和 setLoggingConsumer 在初始化之前的行为。完成标准是:在 getServerCapabilities() 确认支持 logging 后,可以注册一个 consumer,同时不破坏现有的初始化前 builder 用法。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api, backend-api-design
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 58/100