@@ -219,6 +219,16 @@ export default async function reconnectInstallationRoute(server: FastifyInstance
219219 return reply . status ( 400 ) . type ( 'application/json' ) . send ( JSON . stringify ( errorResponse ) ) ;
220220 }
221221
222+ // Immediately update instance status so frontend reflects the change via SSE
223+ await db
224+ . update ( mcpServerInstances )
225+ . set ( {
226+ status : 'connecting' ,
227+ status_message : 'Reconnection in progress' ,
228+ status_updated_at : new Date ( ) ,
229+ } )
230+ . where ( eq ( mcpServerInstances . id , instance . id ) ) ;
231+
222232 // Perform health check on the template
223233 const healthCheckService = new McpHealthCheckService ( db , request . log ) ;
224234 const healthResult = await healthCheckService . checkTemplateHealth ( serverTemplate . id ) ;
@@ -254,7 +264,16 @@ export default async function reconnectInstallationRoute(server: FastifyInstance
254264 } ;
255265 return reply . status ( 200 ) . type ( 'application/json' ) . send ( JSON . stringify ( successResponse ) ) ;
256266 } else {
257- // Server is still offline
267+ // Server is still offline — revert instance status to original
268+ await db
269+ . update ( mcpServerInstances )
270+ . set ( {
271+ status : instance . status ,
272+ status_message : healthResult . error || 'Server is still unreachable' ,
273+ status_updated_at : new Date ( ) ,
274+ } )
275+ . where ( eq ( mcpServerInstances . id , instance . id ) ) ;
276+
258277 request . log . info ( {
259278 operation : 'reconnect_installation_still_offline' ,
260279 teamId,
0 commit comments