Skip to content

Commit ef95562

Browse files
committed
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.
1 parent b2b5e1f commit ef95562

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,15 @@ export class ClineProvider implements vscode.WebviewViewProvider {
613613
this.postMessageToWebview({ type: "openRouterModels", openRouterModels })
614614
}
615615
})
616+
617+
// If MCP Hub is already initialized, update the webview with current server list
618+
if (this.mcpHub) {
619+
this.postMessageToWebview({
620+
type: "mcpServers",
621+
mcpServers: this.mcpHub.getServers(),
622+
})
623+
}
624+
616625
// 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.
617626
// 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
618627
// (see normalizeApiConfiguration > openrouter)
@@ -2115,6 +2124,7 @@ export class ClineProvider implements vscode.WebviewViewProvider {
21152124
autoApprovalEnabled: autoApprovalEnabled ?? false,
21162125
customModes: await this.customModesManager.getCustomModes(),
21172126
experiments: experiments ?? experimentDefault,
2127+
mcpServers: this.mcpHub?.getServers() ?? [],
21182128
}
21192129
}
21202130

0 commit comments

Comments
 (0)