mirror of
https://github.com/voideditor/void
synced 2026-05-24 01:48:25 +00:00
mcp ui + misc
This commit is contained in:
parent
627ec18cc9
commit
81ab21868a
2 changed files with 11 additions and 14 deletions
|
|
@ -1355,7 +1355,7 @@ Use Model Context Protocol to provide Agent mode with more tools.
|
|||
`} chatMessageLocation={undefined} />
|
||||
</h4>
|
||||
<div>
|
||||
<VoidButtonBgDarken className='px-4 py-1 mb-2' onClick={async () => { await mcpService.revealMCPConfigFile() }}>
|
||||
<VoidButtonBgDarken className='px-4 py-1 mb-2 w-full max-w-48' onClick={async () => { await mcpService.revealMCPConfigFile() }}>
|
||||
Add MCP Server
|
||||
</VoidButtonBgDarken>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -205,14 +205,6 @@ class MCPService extends Disposable implements IMCPService {
|
|||
return allTools;
|
||||
}
|
||||
|
||||
// toggle MCP server and update isOn in void settings
|
||||
public async toggleServerIsOn(serverName: string, isOn: boolean): Promise<void> {
|
||||
await this.voidSettingsService.setMCPServerState(serverName, { isOn });
|
||||
this.channel.call('toggleMCPServer', { serverName, isOn })
|
||||
}
|
||||
|
||||
// utility functions
|
||||
|
||||
private async _getMCPConfigFilePath(): Promise<URI> {
|
||||
const appName = this.productService.dataFolderName
|
||||
const userHome = await this.pathService.userHome();
|
||||
|
|
@ -274,11 +266,7 @@ class MCPService extends Disposable implements IMCPService {
|
|||
|
||||
// set all servers to loading
|
||||
for (const serverName in newConfigFileJSON.mcpServers) {
|
||||
if (serverName in this.state.mcpServerOfName) continue
|
||||
this._setMCPServerState(serverName, {
|
||||
status: 'loading',
|
||||
tools: [],
|
||||
})
|
||||
this._setMCPServerState(serverName, { status: 'loading', tools: [] })
|
||||
}
|
||||
const updatedServerNames = Object.keys(newConfigFileJSON.mcpServers).filter(serverName => !addedServerNames.includes(serverName) && !removedServerNames.includes(serverName))
|
||||
|
||||
|
|
@ -292,6 +280,15 @@ class MCPService extends Disposable implements IMCPService {
|
|||
}
|
||||
|
||||
|
||||
// toggle MCP server and update isOn in void settings
|
||||
public async toggleServerIsOn(serverName: string, isOn: boolean): Promise<void> {
|
||||
this._setMCPServerState(serverName, { status: 'loading', tools: [] })
|
||||
|
||||
await this.voidSettingsService.setMCPServerState(serverName, { isOn });
|
||||
this.channel.call('toggleMCPServer', { serverName, isOn })
|
||||
}
|
||||
|
||||
|
||||
public async callMCPTool(toolData: MCPToolCallParams): Promise<{ result: MCPGenericToolResponse }> {
|
||||
const result = await this.channel.call<MCPGenericToolResponse>('callTool', toolData);
|
||||
return { result };
|
||||
|
|
|
|||
Loading…
Reference in a new issue