Skip to content

Conversation

@eryajf
Copy link
Member

@eryajf eryajf commented Jan 15, 2026

  • Remove conditional auto-registration logic and simplify tool registration
  • Add clarifying comments about MCP client tool registration

🔧 chore(mcpclient): Deprecate autoRegister parameter and update comments

  • Mark autoRegister parameter as deprecated for backward compatibility
  • Add note about automatic tool registration for successfully registered MCP servers

Summary by CodeRabbit

发版说明

  • 功能改进

    • 优化了工具自动注册流程。MCP工具现在会在服务器注册时自动进行注册,无需额外手动配置。
  • 弃用通知

    • 自动注册参数已标记为弃用,后续版本中工具将统一自动注册。

✏️ Tip: You can customize this high-level summary in your review settings.

- Remove conditional auto-registration logic and simplify tool registration
- Add clarifying comments about MCP client tool registration

🔧 chore(mcpclient): Deprecate autoRegister parameter and update comments

- Mark autoRegister parameter as deprecated for backward compatibility
- Add note about automatic tool registration for successfully registered MCP servers
@coderabbitai
Copy link

coderabbitai bot commented Jan 15, 2026

概述

移除了 MCP 客户端自动注册的运行时门控条件,使工具注册流程不再受 AutoRegister 标志控制。同时在管理器中标记 autoRegister 参数为已弃用,并明确说明工具将在 MCP 服务器注册后自动注册。

变更内容

内聚体 / 文件 变更摘要
自动注册流程调整
internal/imcp/external.go
删除了对 mcpClient.Config.AutoRegister 的运行时条件检查,循环现在为管理器列表中的每个 MCP 客户端注册工具,依赖于 Manager.LoadFromConfig 的过滤机制
参数弃用标记
internal/mcpclient/manager.go
RegisterFromDB 函数添加文档注释,标记 autoRegister 参数为已弃用,并说明工具将在 MCP 服务器注册后自动注册

预估代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

诗歌

🐰 旧日之门已关闭,
工具自注无需复,
服务器来自自招,
代码清爽又合谐,
弃用标记护周全!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题清晰准确地总结了主要变更:移除自动注册条件检查和更新注释,与代码变更内容完全对应。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

🧹 Recent nitpick comments
internal/mcpclient/manager.go (1)

332-346: 弃用处理得当,建议增强注释说明。

弃用 autoRegister 参数并保留其签名以实现向后兼容的做法是正确的。不过,当前注释只说明参数"已废弃",建议补充说明该参数会被忽略,这样调用方能更清楚地了解实际行为。

♻️ 建议的注释改进
 // RegisterFromDB 从数据库模型注册 MCP 客户端
-// 注意: autoRegister 参数已废弃,现在只要 MCP 服务器被成功注册,其工具就会被自动注册
+// 注意: autoRegister 参数已废弃且会被忽略,现在只要 MCP 服务器被成功注册,其工具就会被自动注册
 func (m *Manager) RegisterFromDB(name string, serverType string, command string, args []string, env map[string]string, baseURL string, headers map[string]string, timeout int, toolPrefix string, autoRegister bool) error {
-		AutoRegister: autoRegister, // 已废弃,保留仅为向后兼容
+		AutoRegister: autoRegister, // 已废弃且被忽略,保留仅为向后兼容

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e9eafb6 and 2196a31.

📒 Files selected for processing (2)
  • internal/imcp/external.go
  • internal/mcpclient/manager.go
🔇 Additional comments (1)
internal/imcp/external.go (1)

22-25: LGTM!

注释清晰地说明了新的行为:只要 MCP 客户端被加载到 Manager 中,其工具就会被注册。这与 Manager.LoadFromConfig 中通过 IsActive 进行过滤的逻辑一致,简化了整体设计。

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@eryajf eryajf added the bug Something isn't working label Jan 15, 2026
@eryajf eryajf merged commit 374fa79 into main Jan 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant