diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index 7dca05c7..641b06da 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -984,7 +984,9 @@ const MCPServer = ({ name, server }: { name: string, server: MCPServerObject }) const MCPServersList = () => { const mcpServiceState = useMCPServiceState() const accessor = useAccessor(); - const mcpService = accessor.get('IMCPService'); + + const userSpecifiedMCPServerNames = mcpServiceState.userSpecifiedMCPServerNames + // TODO tell the user what servers they've specified (might be different from those found) let content: React.ReactNode diff --git a/src/vs/workbench/contrib/void/common/mcpService.ts b/src/vs/workbench/contrib/void/common/mcpService.ts index de25163c..cdba9da2 100644 --- a/src/vs/workbench/contrib/void/common/mcpService.ts +++ b/src/vs/workbench/contrib/void/common/mcpService.ts @@ -25,21 +25,22 @@ type MCPState = { mcpServerOfName: MCPServerOfName, error: string | undefined, isLoading: boolean, // TODO!!!!!! + userSpecifiedMCPServerNames: string[], } export interface IMCPService { readonly _serviceBrand: undefined; revealMCPConfigFile(): Promise; toggleMCPServer(serverName: string, isOn: boolean): Promise; + + readonly state: MCPState; // NOT persisted + onDidChangeState: Event; + + getCurrentMCPToolNames(): InternalToolInfo[]; getMCPToolFns(): { callTool: MCPCallTool; resultToString: MCPToolResultToString }; - - readonly state: MCPState; - onDidChangeState: Event; - - getCurrentMCPToolNames(): InternalToolInfo[]; } export const IMCPService = createDecorator('mcpConfigService'); @@ -78,6 +79,7 @@ class MCPService extends Disposable implements IMCPService { mcpServerOfName: {}, error: undefined, isLoading: false, + userSpecifiedMCPServerNames: [], } // Emitters for server events @@ -154,6 +156,20 @@ class MCPService extends Disposable implements IMCPService { } this._onDidChangeState.fire(); } + private readonly _setUserSpecifiedServerNames = async (names: string[]) => { + this.state = { + ...this.state, + userSpecifiedMCPServerNames: names, + } + this._onDidChangeState.fire(); + } + // private readonly _setIsLoading = async (isLoading: boolean) => { + // this.state = { + // ...this.state, + // isLoading: isLoading, + // } + // this._onDidChangeState.fire(); + // } @@ -273,6 +289,8 @@ class MCPService extends Disposable implements IMCPService { if (!mcpConfigFile) { console.log(`Not setting state: MCP config file not found`); return } if (!mcpConfigFile?.mcpServers) { console.log(`Not setting state: MCP config file did not have an 'mcpServers' field`); return } + this._setUserSpecifiedServerNames(Object.keys(mcpConfigFile.mcpServers)) + const currMCPStateOfName = this.voidSettingsService.state.mcpServerStateOfName; const availableServers = Object.keys(mcpConfigFile.mcpServers);