66from rich .console import Console
77from rich .table import Table
88
9- from mcpm .utils .config import ConfigManager
10-
119from mcpm import __version__
1210from mcpm .commands import (
13- search ,
14- remove ,
15- list ,
16- edit ,
17- stash ,
18- pop ,
11+ add ,
1912 client ,
13+ config ,
14+ edit ,
2015 inspector ,
21- add ,
16+ list ,
17+ pop ,
18+ remove ,
19+ search ,
20+ stash ,
2221)
22+ from mcpm .utils .config import ConfigManager
2323
2424console = Console ()
2525config_manager = ConfigManager ()
2626
2727# Set -h as an alias for --help but we'll handle it ourselves
2828CONTEXT_SETTINGS = dict (help_option_names = [])
2929
30+
3031@click .group (context_settings = CONTEXT_SETTINGS , invoke_without_command = True )
31- @click .option ('-h' , '--help' , 'help_flag' , is_flag = True , help = 'Show this message and exit.' )
32+ @click .option (
33+ "-h" , "--help" , "help_flag" , is_flag = True , help = "Show this message and exit."
34+ )
3235@click .version_option (version = __version__ )
3336@click .pass_context
3437def main (ctx , help_flag ):
3538 """MCPM - Model Context Protocol Manager.
36-
39+
3740 A tool for managing MCP servers across various clients.
3841 """
3942 # Check if a command is being executed (and it's not help, no command, or the client command)
40- if ctx .invoked_subcommand and ctx .invoked_subcommand != ' client' and not help_flag :
43+ if ctx .invoked_subcommand and ctx .invoked_subcommand != " client" and not help_flag :
4144 # Check if active client is set
4245 active_client = config_manager .get_active_client ()
4346 if not active_client :
4447 console .print ("[bold red]Error:[/] No active client set." )
45- console .print ("Please run 'mcpm client <client-name>' to set an active client." )
48+ console .print (
49+ "Please run 'mcpm client <client-name>' to set an active client."
50+ )
4651 console .print ("Available clients:" )
47-
52+
4853 # Show available clients
4954 from mcpm .utils .client_registry import ClientRegistry
55+
5056 for client in ClientRegistry .get_supported_clients ():
5157 console .print (f" - { client } " )
52-
58+
5359 # Exit with error
5460 ctx .exit (1 )
5561 # If no command was invoked or help is requested, show our custom help
5662 if ctx .invoked_subcommand is None or help_flag :
57-
5863 # Get active client
5964 active_client = config_manager .get_active_client ()
60-
65+
6166 # Create a nice ASCII art banner with proper alignment using Rich
6267 from rich .panel import Panel
63-
68+
6469 # Create bold ASCII art with thicker characters for a more striking appearance
6570 logo = [
6671 " ███╗ ███╗ ██████╗██████╗ ███╗ ███╗ " ,
@@ -72,65 +77,91 @@ def main(ctx, help_flag):
7277 "" ,
7378 f"v{ __version__ } " ,
7479 "Model Context Protocol Manager" ,
75- "Supports Claude Desktop, Windsurf, Cursor, and more"
80+ "Supports Claude Desktop, Windsurf, Cursor, and more" ,
7681 ]
77-
82+
7883 # No need to convert to joined string since we're formatting directly in the panel
79-
84+
8085 # Create a panel with styled content
8186 panel = Panel (
8287 f"[bold green]{ logo [0 ]} \n { logo [1 ]} \n { logo [2 ]} \n { logo [3 ]} \n { logo [4 ]} \n { logo [5 ]} [/]\n \n [bold yellow]{ logo [7 ]} [/]\n [italic blue]{ logo [8 ]} [/]\n [bold magenta]{ logo [9 ]} [/]" ,
8388 border_style = "bold cyan" ,
8489 expand = False ,
8590 padding = (0 , 2 ),
8691 )
87-
92+
8893 # Print the panel
8994 console .print (panel )
90-
95+
9196 # Get information about installed clients
9297 from mcpm .utils .client_registry import ClientRegistry
98+
9399 installed_clients = ClientRegistry .detect_installed_clients ()
94-
100+
95101 # Display active client information and main help
96102 if active_client :
97- client_status = "[green]✓[/]" if installed_clients .get (active_client , False ) else "[yellow]⚠[/]"
98- console .print (f"[bold magenta]Active client:[/] [yellow]{ active_client } [/] { client_status } " )
103+ client_status = (
104+ "[green]✓[/]"
105+ if installed_clients .get (active_client , False )
106+ else "[yellow]⚠[/]"
107+ )
108+ console .print (
109+ f"[bold magenta]Active client:[/] [yellow]{ active_client } [/] { client_status } "
110+ )
99111 else :
100- console .print ("[bold red]No active client set![/] Please run 'mcpm client <client-name>' to set one." )
112+ console .print (
113+ "[bold red]No active client set![/] Please run 'mcpm client <client-name>' to set one."
114+ )
101115 console .print ("" )
102-
116+
103117 # Display usage info
104- console .print ("[bold green]Usage:[/] [white]mcpm [OPTIONS] COMMAND [ARGS]...[/]" )
118+ console .print (
119+ "[bold green]Usage:[/] [white]mcpm [OPTIONS] COMMAND [ARGS]...[/]"
120+ )
105121 console .print ("" )
106- console .print ("[bold green]Description:[/] [white]A tool for managing MCP servers across various clients.[/]" )
122+ console .print (
123+ "[bold green]Description:[/] [white]A tool for managing MCP servers across various clients.[/]"
124+ )
107125 console .print ("" )
108-
126+
109127 # Display options
110128 console .print ("[bold]Options:[/]" )
111129 console .print (" --version Show the version and exit." )
112130 console .print (" -h, --help Show this message and exit." )
113131 console .print ("" )
114-
132+
115133 # Display available commands in a table
116134 console .print ("[bold]Commands:[/]" )
117135 commands_table = Table (show_header = False , box = None , padding = (0 , 2 , 0 , 0 ))
118- commands_table .add_row (" [cyan]add[/]" , "Add an MCP server directly to a client." )
136+ commands_table .add_row (
137+ " [cyan]add[/]" , "Add an MCP server directly to a client."
138+ )
119139 commands_table .add_row (" [cyan]client[/]" , "Manage the active MCPM client." )
120- commands_table .add_row (" [cyan]edit[/]" , "View or edit the active MCPM client's configuration file." )
121- commands_table .add_row (" [cyan]inspector[/]" , "Launch the MCPM Inspector UI to examine servers." )
140+ commands_table .add_row (" [cyan]config[/]" , "Manage MCPM configuration." )
141+ commands_table .add_row (
142+ " [cyan]edit[/]" ,
143+ "View or edit the active MCPM client's configuration file." ,
144+ )
145+ commands_table .add_row (
146+ " [cyan]inspector[/]" , "Launch the MCPM Inspector UI to examine servers."
147+ )
122148 commands_table .add_row (" [cyan]list[/]" , "List all installed MCP servers." )
123149 commands_table .add_row (" [cyan]remove[/]" , "Remove an installed MCP server." )
124150 commands_table .add_row (" [cyan]search[/]" , "Search available MCP servers." )
125- commands_table .add_row (" [cyan]stash[/]" , "Temporarily store a server configuration aside." )
126- commands_table .add_row (" [cyan]pop[/]" , "Restore a previously stashed server configuration." )
151+ commands_table .add_row (
152+ " [cyan]stash[/]" , "Temporarily store a server configuration aside."
153+ )
154+ commands_table .add_row (
155+ " [cyan]pop[/]" , "Restore a previously stashed server configuration."
156+ )
127157 console .print (commands_table )
128-
129158
130-
131159 # Additional helpful information
132160 console .print ("" )
133- console .print ("[italic]Run [bold]mcpm CLIENT -h[/] for more information on a command.[/]" )
161+ console .print (
162+ "[italic]Run [bold]mcpm CLIENT -h[/] for more information on a command.[/]"
163+ )
164+
134165
135166# Register commands
136167main .add_command (search .search )
@@ -143,6 +174,7 @@ def main(ctx, help_flag):
143174main .add_command (pop .pop )
144175
145176main .add_command (client .client )
177+ main .add_command (config .config )
146178main .add_command (inspector .inspector , name = "inspector" )
147179
148180if __name__ == "__main__" :
0 commit comments