@@ -726,9 +726,8 @@ async fn handle_mcp_command(
726726 let enabled_only = mcp_sub_matches. get_flag ( "enabled_only" ) ;
727727 let json_output = mcp_sub_matches. get_flag ( "json" ) ;
728728
729- let transport_filter = transport
730- . map ( |t| if t == "any" { None } else { Some ( t. as_str ( ) ) } )
731- . flatten ( ) ;
729+ let transport_filter =
730+ transport. and_then ( |t| if t == "any" { None } else { Some ( t. as_str ( ) ) } ) ;
732731 let results = mcp_service. search_servers ( query, transport_filter, enabled_only) ;
733732
734733 if results. is_empty ( ) {
@@ -739,61 +738,59 @@ async fn handle_mcp_command(
739738 if transport_filter. is_some ( ) {
740739 println ! ( "💡 Try changing the transport filter or use --transport=any" ) ;
741740 }
742- } else {
743- if json_output {
744- let json_results: Vec < serde_json:: Value > = results
745- . iter ( )
746- . map ( |( id, config) | {
747- serde_json:: json!( {
748- "id" : id,
749- "name" : config. name,
750- "url" : config. url,
751- "transport" : match config. transport_type {
752- McpTransportType :: Http => "http" ,
753- McpTransportType :: Websocket => "websocket" ,
754- McpTransportType :: Stdio => "stdio"
755- } ,
756- "enabled" : config. enabled,
757- "has_auth" : config. auth. is_some( ) ,
758- "github_url" : config. github_url
759- } )
741+ } else if json_output {
742+ let json_results: Vec < serde_json:: Value > = results
743+ . iter ( )
744+ . map ( |( id, config) | {
745+ serde_json:: json!( {
746+ "id" : id,
747+ "name" : config. name,
748+ "url" : config. url,
749+ "transport" : match config. transport_type {
750+ McpTransportType :: Http => "http" ,
751+ McpTransportType :: Websocket => "websocket" ,
752+ McpTransportType :: Stdio => "stdio"
753+ } ,
754+ "enabled" : config. enabled,
755+ "has_auth" : config. auth. is_some( ) ,
756+ "github_url" : config. github_url
760757 } )
761- . collect ( ) ;
762- println ! ( "{}" , serde_json:: to_string_pretty( & json_results) ?) ;
763- } else {
764- println ! (
765- "🔍 Found {} MCP server(s) matching '{}:'" ,
766- results. len( ) ,
767- query
768- ) ;
769- println ! ( ) ;
770-
771- for ( id, config) in results {
772- let status_icon = if config. enabled { "🟢" } else { "🔴" } ;
773- let transport_icon = match config. transport_type {
774- McpTransportType :: Http => "🌐" ,
775- McpTransportType :: Websocket => "🔗" ,
776- McpTransportType :: Stdio => "⚡" ,
777- } ;
778- let auth_badge = if config. auth . is_some ( ) { " 🔐" } else { "" } ;
758+ } )
759+ . collect ( ) ;
760+ println ! ( "{}" , serde_json:: to_string_pretty( & json_results) ?) ;
761+ } else {
762+ println ! (
763+ "🔍 Found {} MCP server(s) matching '{}:'" ,
764+ results. len( ) ,
765+ query
766+ ) ;
767+ println ! ( ) ;
779768
780- println ! (
781- " {} {} {} {}{}" ,
782- status_icon, transport_icon, id, config. name, auth_badge
783- ) ;
784- println ! ( " URL: {}" , config. url) ;
769+ for ( id, config) in results {
770+ let status_icon = if config. enabled { "🟢" } else { "🔴" } ;
771+ let transport_icon = match config. transport_type {
772+ McpTransportType :: Http => "🌐" ,
773+ McpTransportType :: Websocket => "🔗" ,
774+ McpTransportType :: Stdio => "⚡" ,
775+ } ;
776+ let auth_badge = if config. auth . is_some ( ) { " 🔐" } else { "" } ;
785777
786- if let Some ( github_url) = & config. github_url {
787- println ! ( " GitHub: {}" , github_url) ;
788- }
778+ println ! (
779+ " {} {} {} {}{}" ,
780+ status_icon, transport_icon, id, config. name, auth_badge
781+ ) ;
782+ println ! ( " URL: {}" , config. url) ;
789783
790- if let Some ( local_path ) = & config. local_path {
791- println ! ( " Local : {}" , local_path ) ;
792- }
784+ if let Some ( github_url ) = & config. github_url {
785+ println ! ( " GitHub : {}" , github_url ) ;
786+ }
793787
794- println ! ( " Transport: {:?}" , config. transport_type ) ;
795- println ! ( ) ;
788+ if let Some ( local_path ) = & config. local_path {
789+ println ! ( " Local: {}" , local_path ) ;
796790 }
791+
792+ println ! ( " Transport: {:?}" , config. transport_type) ;
793+ println ! ( ) ;
797794 }
798795 }
799796 }
@@ -1690,7 +1687,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
16901687 . arg ( "Content-Type: application/json" )
16911688 . arg ( "-d" )
16921689 . arg ( r#"{"jsonrpc":"2.0","id":1,"method":"getHealth"}"# )
1693- . arg ( & format ! ( "http://localhost:{}" , rpc_port) )
1690+ . arg ( format ! ( "http://localhost:{}" , rpc_port) )
16941691 . output ( ) ;
16951692
16961693 if let Ok ( health_result) = health_check {
@@ -1799,7 +1796,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
17991796 . arg ( "Content-Type: application/json" )
18001797 . arg ( "-d" )
18011798 . arg ( r#"{"jsonrpc":"2.0","id":1,"method":"getHealth"}"# )
1802- . arg ( & format ! ( "http://localhost:{}" , rpc_port) )
1799+ . arg ( format ! ( "http://localhost:{}" , rpc_port) )
18031800 . output ( ) ;
18041801
18051802 if let Ok ( health_result) = health_check {
0 commit comments