File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { app , shell , BrowserWindow , ipcMain } from 'electron' ;
2
+ import { mapClientRef } from '@main/mcp/client' ;
2
3
import { join } from 'path' ;
3
4
import { registerIpcMain } from '@ui-tars/electron-ipc/main' ;
4
5
import { electronApp , optimizer , is } from '@electron-toolkit/utils' ;
@@ -133,11 +134,16 @@ app.whenReady().then(async () => {
133
134
// Quit when all windows are closed, except on macOS. There, it's common
134
135
// for applications and their menu bar to stay active until the user quits
135
136
// explicitly with Cmd + Q.
136
- app . on ( 'window-all-closed' , ( ) => {
137
+ app . on ( 'window-all-closed' , async ( ) => {
137
138
logger . info ( 'All windows closed' ) ;
138
139
if ( process . platform !== 'darwin' ) {
139
140
app . quit ( ) ;
140
141
}
142
+ logger . info ( 'mcp cleanup' ) ;
143
+ // Deactivate all MCP servers
144
+ await mapClientRef . current ?. cleanup ( ) . catch ( ( err ) => {
145
+ logger . error ( 'Error during cleanup of MCP servers:' , err ) ;
146
+ } ) ;
141
147
} ) ;
142
148
143
149
// In this file you can include the rest of your app's specific main process
You can’t perform that action at this time.
0 commit comments