mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: ensure MCP server list appears in settings when server starts first
When the MCP server was initialized before opening RooCode, the server list
would not appear in the settings. This was fixed by:
1. Adding proper server list initialization in ClineProvider.ts when the
webview launches, checking if mcpHub exists and sending its current
servers to the webview:
```typescript
if (this.mcpHub) {
this.postMessageToWebview({
type: "mcpServers",
mcpServers: this.mcpHub.getServers()
})
}
```
2. Using the public getServers() method from McpHub instead of relying on
internal state updates, ensuring consistent server list state across
the application.
The fix maintains clean separation of concerns and follows existing patterns
for state management between the extension and webview.
This commit is contained in:
parent
b2b5e1ffa6
commit
ef95562dfe
1 changed files with 10 additions and 0 deletions
|
|
@ -613,6 +613,15 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
this.postMessageToWebview({ type: "openRouterModels", openRouterModels })
|
||||
}
|
||||
})
|
||||
|
||||
// If MCP Hub is already initialized, update the webview with current server list
|
||||
if (this.mcpHub) {
|
||||
this.postMessageToWebview({
|
||||
type: "mcpServers",
|
||||
mcpServers: this.mcpHub.getServers(),
|
||||
})
|
||||
}
|
||||
|
||||
// gui relies on model info to be up-to-date to provide the most accurate pricing, so we need to fetch the latest details on launch.
|
||||
// we do this for all users since many users switch between api providers and if they were to switch back to openrouter it would be showing outdated model info if we hadn't retrieved the latest at this point
|
||||
// (see normalizeApiConfiguration > openrouter)
|
||||
|
|
@ -2115,6 +2124,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
|
|||
autoApprovalEnabled: autoApprovalEnabled ?? false,
|
||||
customModes: await this.customModesManager.getCustomModes(),
|
||||
experiments: experiments ?? experimentDefault,
|
||||
mcpServers: this.mcpHub?.getServers() ?? [],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue