@@ -1415,8 +1415,12 @@ impl EventLoop {
14151415 values,
14161416 } => {
14171417 // Handle inline form submission
1418- self . handle_inline_form_submission ( & action_id, values) ;
1419- self . app_state . exit_interactive_mode ( ) ;
1418+ // Returns true if we should stay in interactive mode
1419+ let stay_open =
1420+ self . handle_inline_form_submission ( & action_id, values) ;
1421+ if !stay_open {
1422+ self . app_state . exit_interactive_mode ( ) ;
1423+ }
14201424 }
14211425 crate :: interactive:: InteractiveResult :: Cancelled => {
14221426 self . app_state . exit_interactive_mode ( ) ;
@@ -6026,11 +6030,12 @@ impl EventLoop {
60266030 }
60276031
60286032 /// Handles inline form submission from interactive mode (for MCP config, etc.).
6033+ /// Returns `true` if we should stay in interactive mode (e.g., return to MCP panel).
60296034 fn handle_inline_form_submission (
60306035 & mut self ,
60316036 action_id : & str ,
60326037 values : std:: collections:: HashMap < String , String > ,
6033- ) {
6038+ ) -> bool {
60346039 match action_id {
60356040 "mcp-add" | "mcp-add-stdio" => {
60366041 // Add new stdio MCP server from inline form
@@ -6040,7 +6045,7 @@ impl EventLoop {
60406045
60416046 if name. is_empty ( ) || command. is_empty ( ) {
60426047 self . app_state . toasts . error ( "Name and command are required" ) ;
6043- return ;
6048+ return false ;
60446049 }
60456050
60466051 // Parse args
@@ -6050,10 +6055,10 @@ impl EventLoop {
60506055 args_str. split_whitespace ( ) . map ( |s| s. to_string ( ) ) . collect ( )
60516056 } ;
60526057
6053- // Create new server info
6058+ // Create new server info - MCP servers are enabled (Running) by default
60546059 let server_info = crate :: modal:: mcp_manager:: McpServerInfo {
60556060 name : name. clone ( ) ,
6056- status : crate :: modal:: mcp_manager:: McpStatus :: Stopped ,
6061+ status : crate :: modal:: mcp_manager:: McpStatus :: Running ,
60576062 tool_count : 0 ,
60586063 error : None ,
60596064 requires_auth : false ,
@@ -6072,6 +6077,10 @@ impl EventLoop {
60726077 command,
60736078 args
60746079 ) ;
6080+
6081+ // Return to MCP panel
6082+ self . reopen_mcp_panel ( ) ;
6083+ true
60756084 }
60766085 "mcp-add-http" => {
60776086 // Add new HTTP MCP server from inline form
@@ -6081,13 +6090,13 @@ impl EventLoop {
60816090
60826091 if name. is_empty ( ) || url. is_empty ( ) {
60836092 self . app_state . toasts . error ( "Name and URL are required" ) ;
6084- return ;
6093+ return false ;
60856094 }
60866095
6087- // Create new server info
6096+ // Create new server info - MCP servers are enabled (Running) by default
60886097 let server_info = crate :: modal:: mcp_manager:: McpServerInfo {
60896098 name : name. clone ( ) ,
6090- status : crate :: modal:: mcp_manager:: McpStatus :: Stopped ,
6099+ status : crate :: modal:: mcp_manager:: McpStatus :: Running ,
60916100 tool_count : 0 ,
60926101 error : None ,
60936102 requires_auth : !api_key. is_empty ( ) ,
@@ -6106,13 +6115,26 @@ impl EventLoop {
61066115 url,
61076116 !api_key. is_empty( )
61086117 ) ;
6118+
6119+ // Return to MCP panel
6120+ self . reopen_mcp_panel ( ) ;
6121+ true
61096122 }
61106123 _ => {
61116124 tracing:: warn!( "Unhandled inline form submission: {}" , action_id) ;
6125+ false
61126126 }
61136127 }
61146128 }
61156129
6130+ /// Re-opens the MCP panel to show the list of servers after adding a new one.
6131+ fn reopen_mcp_panel ( & mut self ) {
6132+ use crate :: interactive:: builders:: build_mcp_selector;
6133+ let servers = self . app_state . mcp_servers . clone ( ) ;
6134+ let interactive = build_mcp_selector ( & servers) ;
6135+ self . app_state . enter_interactive_mode ( interactive) ;
6136+ }
6137+
61166138 /// Re-opens the settings menu with current state (to stay in menu after toggle)
61176139 fn reopen_settings_menu ( & mut self ) {
61186140 use crate :: interactive:: builders:: { SettingsSnapshot , build_settings_selector} ;
@@ -7358,10 +7380,10 @@ impl EventLoop {
73587380 return ;
73597381 }
73607382
7361- // Add the new server
7383+ // Add the new server - MCP servers are enabled (Running) by default
73627384 let server = crate :: modal:: mcp_manager:: McpServerInfo {
73637385 name : name. clone ( ) ,
7364- status : crate :: modal:: mcp_manager:: McpStatus :: Stopped ,
7386+ status : crate :: modal:: mcp_manager:: McpStatus :: Running ,
73657387 tool_count : 0 ,
73667388 error : None ,
73677389 requires_auth : false ,
@@ -8733,13 +8755,13 @@ impl EventLoop {
87338755 self . add_system_message ( & format ! ( "Restarted MCP server: {}" , name) ) ;
87348756 }
87358757 CardAction :: AddMcpServer ( config) => {
8736- // Implement MCP server addition
8758+ // Implement MCP server addition - MCP servers are enabled (Running) by default
87378759 tracing:: info!( "Adding MCP server: {}" , config) ;
87388760 use crate :: modal:: mcp_manager:: { McpServerInfo , McpStatus } ;
87398761 if !self . app_state . mcp_servers . iter ( ) . any ( |s| s. name == config) {
87408762 self . app_state . mcp_servers . push ( McpServerInfo {
87418763 name : config. clone ( ) ,
8742- status : McpStatus :: Stopped ,
8764+ status : McpStatus :: Running ,
87438765 tool_count : 0 ,
87448766 error : None ,
87458767 requires_auth : false ,
@@ -9151,7 +9173,7 @@ impl EventLoop {
91519173 command,
91529174 args,
91539175 } => {
9154- // Implement MCP server addition
9176+ // Implement MCP server addition - MCP servers are enabled (Running) by default
91559177 use crate :: modal:: mcp_manager:: { McpServerInfo , McpStatus } ;
91569178
91579179 // Check if server already exists
@@ -9163,7 +9185,7 @@ impl EventLoop {
91639185 // Create new server entry
91649186 let new_server = McpServerInfo {
91659187 name : name. clone ( ) ,
9166- status : McpStatus :: Stopped ,
9188+ status : McpStatus :: Running ,
91679189 tool_count : 0 ,
91689190 error : None ,
91699191 requires_auth : false ,
0 commit comments