@@ -40,7 +40,7 @@ interface ManifestResponse {
4040 * */
4141export default class IPCs {
4242 static clients : ClientObj [ ] = [ ]
43- static currentFeatures : any [ ] = [ ]
43+ static currentFeatures : FeatureObj [ ] = [ ]
4444
4545 static initialize ( ) : void {
4646 // Get application version
@@ -56,16 +56,24 @@ export default class IPCs {
5656 return pathToFileURL ( normalize ( resolve ( Constants . ASSETS_PATH . dxt ) ) ) . toString ( )
5757 } )
5858
59+ ipcMain . handle ( 'msgMcpServersStop' , async ( ) => {
60+ IPCs . stopAllServers ( )
61+
62+ const configs = await loadConfig ( )
63+
64+ const features = configs . map ( ( params ) => {
65+ return registerIpcHandlers ( params )
66+ } )
67+
68+ this . currentFeatures = features
69+
70+ return true
71+ } )
72+
5973 ipcMain . handle (
6074 'msgMcpServersInit' ,
6175 async ( event : IpcMainEvent , metadata : ConfigMcpMetadata ) => {
62- this . clients . forEach ( ( client : ClientObj ) => {
63- if ( client . connection ?. transport ) {
64- disconnect ( client . connection . transport )
65- }
66- } )
67-
68- IPCs . removeAllHandlers ( )
76+ IPCs . stopAllServers ( )
6977
7078 const progressCallback : McpProgressCallback = ( name , message , status ) => {
7179 mcpServersCallback ( { name, message, status } )
@@ -249,6 +257,17 @@ export default class IPCs {
249257 this . currentFeatures = newFeatures
250258 }
251259
260+ static stopAllServers ( ) {
261+ this . clients . forEach ( ( client : ClientObj ) => {
262+ if ( client . connection ?. transport ) {
263+ disconnect ( client . connection . transport )
264+ delete client . connection . transport
265+ }
266+ } )
267+
268+ IPCs . removeAllHandlers ( )
269+ }
270+
252271 static removeAllHandlers ( ) {
253272 for ( const [ eventName ] of handlerRegistry ) {
254273 ipcMain . removeHandler ( eventName )
0 commit comments