1414
1515@click .command ()
1616@click .argument ("query" , required = False )
17- @click .option ("--detailed" , is_flag = True , help = "Show detailed server information" )
1817@click .option ("--table" , is_flag = True , help = "Display results in table format with descriptions" )
1918@click .help_option ("-h" , "--help" )
20- def search (query , detailed = False , table = False ):
19+ def search (query , table = False ):
2120 """Search available MCP servers.
2221
2322 Searches the MCP registry for available servers. Without arguments, lists all available servers.
24- By default, only shows server names. Use --table for more details or --detailed for full information .
23+ By default, only shows server names. Use --table for more details.
2524
2625 Examples:
2726
2827 \b
2928 mcpm search # List all available servers (names only)
3029 mcpm search github # Search for github server
3130 mcpm search --table # Show results in a table with descriptions
32- mcpm search --detailed # Show detailed information
3331 """
3432 # Show appropriate search message
3533 search_criteria = []
@@ -53,9 +51,7 @@ def search(query, detailed=False, table=False):
5351 return
5452
5553 # Show different views based on detail level
56- if detailed :
57- _display_detailed_results (servers )
58- elif table :
54+ if table :
5955 print_servers_table (servers )
6056 else :
6157 print_simple_servers_list (servers )
@@ -65,88 +61,3 @@ def search(query, detailed=False, table=False):
6561
6662 except Exception as e :
6763 print_error ("Error searching for servers" , str (e ))
68-
69-
70- def _display_detailed_results (servers ):
71- """Display detailed information about each server"""
72- for i , server in enumerate (sorted (servers , key = lambda s : s ["name" ])):
73- # Get server data
74- name = server ["name" ]
75- display_name = server .get ("display_name" , name )
76- description = server .get ("description" , "No description" )
77- license_info = server .get ("license" , "Unknown" )
78-
79- # Get author info
80- author_info = server .get ("author" , {})
81- author_name = author_info .get ("name" , "Unknown" )
82- author_email = author_info .get ("email" , "" )
83-
84- # Build categories and tags
85- categories = server .get ("categories" , [])
86- tags = server .get ("tags" , [])
87-
88- # Get installation details
89- installations = server .get ("installations" , {})
90- installation = server .get ("installation" , {})
91- package = installation .get ("package" , "" )
92-
93- # Print server header
94- console .print (f"[bold cyan]{ display_name } [/] [dim]({ name } )[/]" )
95- console .print (f"[italic]{ description } [/]\n " )
96-
97- # Server information section
98- console .print ("[bold yellow]Server Information:[/]" )
99- if categories :
100- console .print (f"Categories: { ', ' .join (categories )} " )
101- if tags :
102- console .print (f"Tags: { ', ' .join (tags )} " )
103- if package :
104- console .print (f"Package: { package } " )
105- console .print (f"Author: { author_name } " + (f" ({ author_email } )" if author_email else "" ))
106- console .print (f"License: { license_info } " )
107- console .print ("" )
108-
109- # Installation details section
110- if installations :
111- console .print ("[bold yellow]Installation Details:[/]" )
112- for method in installations .values ():
113- method_type = method .get ("type" , "unknown" )
114- description = method .get ("description" , f"{ method_type } installation" )
115- recommended = " [green](recommended)[/]" if method .get ("recommended" , False ) else ""
116-
117- console .print (f"[cyan]{ method_type } [/]: { description } { recommended } " )
118-
119- # Show command if available
120- if "command" in method :
121- cmd = method ["command" ]
122- args = method .get ("args" , [])
123- cmd_str = f"{ cmd } { ' ' .join (args )} " if args else cmd
124- console .print (f"Command: [green]{ cmd_str } [/]" )
125-
126- # Show dependencies if available
127- dependencies = method .get ("dependencies" , [])
128- if dependencies :
129- console .print ("Dependencies: " + ", " .join (dependencies ))
130-
131- # Show environment variables if available
132- env_vars = method .get ("env" , {})
133- if env_vars :
134- console .print ("Environment Variables:" )
135- for key , value in env_vars .items ():
136- console .print (f' [bold blue]{ key } [/] = [green]"{ value } "[/]' )
137- console .print ("" )
138-
139- # If there are examples, show the first one
140- examples = server .get ("examples" , [])
141- if examples :
142- console .print ("[bold yellow]Example:[/]" )
143- first_example = examples [0 ]
144- if "title" in first_example :
145- console .print (f"[bold]{ first_example ['title' ]} [/]" )
146- if "description" in first_example :
147- console .print (f"{ first_example ['description' ]} " )
148- console .print ("" )
149-
150- # Add a separator between servers (except for the last one)
151- if i < len (servers ) - 1 :
152- console .print ("[dim]" + "-" * 50 + "[/]\n " )
0 commit comments