-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: showing all mcp server in the list #4478
Conversation
/next |
Walkthrough该 PR 引入了增强的服务器数据加载逻辑和接口调整。在 Changes
Sequence Diagram(s)sequenceDiagram
participant View as MCPConfigView
participant Pref as preferenceService
participant Server as mcpServerProxyService
View->>Pref: 调用 get() 获取用户服务器配置
Pref-->>View: 返回用户服务器列表
View->>Server: 调用 $getServers() 获取运行中服务器
Server-->>View: 返回运行中服务器列表
View->>View: 合并用户配置与运行状态,设置 isStarted 与 tools 属性
Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
yarn install v1.22.22 Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (9)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/ai-native/src/browser/mcp/config/components/mcp-config.view.tsx (1)
29-40
: 修复服务器列表显示逻辑,确保显示所有 MCP 服务器这个更改解决了 PR 中描述的问题,通过合并用户配置的服务器和运行中的服务器,确保所有 MCP 服务器都显示在列表中,即使它们没有启动。这样可以防止用户丢失非启动配置设置。
代码逻辑清晰,先获取用户配置的服务器,再获取运行中的服务器,然后将它们合并,保留用户配置的所有信息,同时添加运行时状态。
但有一个小的优化点:在
return
语句中,...server
已经包含了name
属性,因此name: server.name
是多余的。可以简化为:
return { ...server, - name: server.name, isStarted: !!runningServer, tools: runningServer?.tools, };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/ai-native/src/browser/mcp/config/components/mcp-config.view.tsx
(1 hunks)packages/ai-native/src/common/index.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: 🚀🚀🚀 Next Version for pull request
- GitHub Check: build (ubuntu-latest, 20.x)
- GitHub Check: build-windows
- GitHub Check: ubuntu-latest, Node.js 20.x
- GitHub Check: build (macos-latest, 20.x)
🔇 Additional comments (1)
packages/ai-native/src/common/index.ts (1)
137-144
:❓ Verification inconclusive
接口更新以支持服务器类型显示
此更改在
ISumiMCPServerBackend
接口的getServers
方法返回类型中添加了type
属性。这是一个良好的更新,因为它允许 UI 显示服务器的类型,与MCPConfigView
组件的getReadableServerType
函数对齐。确保所有实现此接口的类都更新了它们的返回值以包含
type
属性。
🏁 Script executed:
#!/bin/bash # 描述:检查 ISumiMCPServerBackend 接口的实现,确保它们包含新的 type 属性 # 查找 ISumiMCPServerBackend 接口的所有实现 echo "查找 ISumiMCPServerBackend 接口的所有实现..." rg -l "class.*implements.*ISumiMCPServerBackend" --type ts # 检查 getServers 方法实现 echo "检查 getServers 方法的实现..." rg "getServers\(\).*\{" -A 15 --type tsLength of output: 5125
请确保所有实现 getServers 的类返回包含 type 属性的数据
- 在
packages/ai-native/src/common/index.ts
中,getServers
接口现在要求返回的对象包含name
、isStarted
、type
(字符串类型)以及tools
。- 验证结果显示唯一实现
ISumiMCPServerBackend
接口的文件为packages/ai-native/src/node/mcp/sumi-mcp-server.ts
,但其getServers
实现中未明显看到对type
属性的处理。请检查该方法,确保最终返回结果包含服务器的type
字段。- 此外,请核对其他相关定义(例如
packages/ai-native/src/common/types.ts
中$getServers
方法及MCPServer
接口)与新接口保持一致,以确保 UI 中MCPConfigView
组件的getReadableServerType
能正确显示服务器类型。
🎉 PR Next publish successful! 3.8.3-next-1741940731.0 |
/next |
🎉 PR Next publish successful! 3.8.3-next-1741943877.0 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4478 +/- ##
==========================================
- Coverage 53.14% 53.14% -0.01%
==========================================
Files 1665 1665
Lines 102615 102615
Branches 22371 22215 -156
==========================================
- Hits 54537 54536 -1
- Misses 39995 39996 +1
Partials 8083 8083
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Types
Background or solution
原有实现会导致用户存储的非启动配置丢失
Changelog
showing all mcp server in the list
Summary by CodeRabbit