Skip to content

Commit 01050de

Browse files
committed
Clean up version and search
1 parent 9511526 commit 01050de

File tree

4 files changed

+112
-218
lines changed

4 files changed

+112
-218
lines changed

src/mcpm/commands/add.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ def add(server_name, force=False):
5858
# Display server information
5959
display_name = server_metadata.get("display_name", server_name)
6060
description = server_metadata.get("description", "No description available")
61-
available_version = server_metadata.get("version")
6261
author_info = server_metadata.get("author", {})
6362

64-
console.print(f"\n[bold]{display_name}[/] ({server_name}) v{available_version}")
63+
console.print(f"\n[bold]{display_name}[/] ({server_name})")
6564
console.print(f"[dim]{description}[/]")
6665

6766
if author_info:
@@ -90,7 +89,6 @@ def add(server_name, force=False):
9089

9190
# Extract installation information
9291
installations = server_metadata.get("installations", {})
93-
version = available_version
9492

9593
# If no installation information is available, create minimal default values
9694
# This allows us to add the server config without full installation details
@@ -169,7 +167,7 @@ def add(server_name, force=False):
169167
json.dump(server_metadata, f, indent=2)
170168

171169
# Configure the server
172-
progress.add_task(f"Configuring {server_name} v{version}...", total=None)
170+
progress.add_task(f"Configuring {server_name}...", total=None)
173171

174172
# Get all available arguments from the server metadata
175173
all_arguments = server_metadata.get("arguments", {})
@@ -255,7 +253,7 @@ def add(server_name, force=False):
255253
console=console
256254
)
257255
progress.start()
258-
progress.add_task(f"Configuring {server_name} v{version}...", total=None)
256+
progress.add_task(f"Configuring {server_name}...", total=None)
259257

260258
# Now process any remaining environment variables from the installation method
261259
for key, value in env_vars.items():
@@ -294,7 +292,7 @@ def add(server_name, force=False):
294292
console=console
295293
)
296294
progress.start()
297-
progress.add_task(f"Configuring {server_name} v{version}...", total=None)
295+
progress.add_task(f"Configuring {server_name}...", total=None)
298296
else:
299297
# Store reference to environment variable
300298
processed_env[key] = value
@@ -328,7 +326,7 @@ def add(server_name, force=False):
328326

329327
if success:
330328
# Server has been successfully added to the client configuration
331-
console.print(f"[bold green]Successfully added {display_name} v{version} to {client_display_name}![/]")
329+
console.print(f"[bold green]Successfully added {display_name} to {client_display_name}![/]")
332330

333331
# Display usage examples if available
334332
examples = server_metadata.get("examples", [])

src/mcpm/commands/list.py

Lines changed: 53 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -12,153 +12,64 @@
1212
console = Console()
1313

1414
@click.command(name="list")
15-
@click.option("--available", is_flag=True, help="List all available MCP servers")
16-
@click.option("--outdated", is_flag=True, help="List installed servers with updates available")
17-
def list(available, outdated):
15+
def list():
1816
"""List all installed MCP servers.
1917
2018
Examples:
2119
mcpm list
22-
mcpm list --available
23-
mcpm list --outdated
2420
"""
25-
if available:
26-
console.print("[bold green]Available MCP servers:[/]")
27-
28-
# Show available servers that can be installed
29-
table = Table(show_header=True, header_style="bold")
30-
table.add_column("Name")
31-
table.add_column("Description")
32-
table.add_column("Latest Version")
33-
34-
# Example available servers (in a full implementation, this would come from a repository)
35-
available_servers = [
36-
("filesystem", "Access local files and directories", "1.0.0"),
37-
("browser", "Access web content through Claude", "0.9.2"),
38-
("code-interpreter", "Execute and interpret code", "0.7.1"),
39-
("shell", "Run shell commands from Claude", "0.8.5")
40-
]
41-
42-
for name, desc, version in available_servers:
43-
table.add_row(name, desc, version)
44-
45-
console.print(table)
46-
47-
elif outdated:
48-
console.print("[bold yellow]Checking for outdated MCP servers...[/]")
49-
50-
# Get the active client manager and information
51-
client_manager = ClientRegistry.get_active_client_manager()
52-
client = ClientRegistry.get_active_client()
53-
client_info = ClientRegistry.get_client_info(client)
54-
client_name = client_info.get("name", client)
55-
56-
# Check if client is supported
57-
if client_manager is None:
58-
console.print("[bold red]Error:[/] Unsupported active client")
59-
console.print("Please switch to a supported client using 'mcpm client <client-name>'")
60-
return
61-
62-
# Get servers from active client
63-
servers = client_manager.get_servers()
64-
65-
if not servers:
66-
console.print(f"[yellow]No MCP servers found in {client_name}.[/]")
67-
return
68-
69-
# In a full implementation, this would check the repository for newer versions
70-
# For now, just show installed servers with mock version information
71-
72-
# Mock repository versions (would be fetched from a real repository in production)
73-
repo_versions = {
74-
"filesystem": "1.1.0", # Newer than installed
75-
"browser": "0.9.2", # Same as installed
76-
"shell": "0.8.5", # Same as installed
77-
}
78-
79-
# Check for outdated servers
80-
outdated_servers = []
81-
for server_name in servers:
82-
# Mock: filesystem has newer version available
83-
if server_name == "filesystem":
84-
outdated_servers.append({
85-
"name": server_name,
86-
"installed": "1.0.0",
87-
"latest": repo_versions.get(server_name, "unknown")
88-
})
89-
90-
if outdated_servers:
91-
table = Table(show_header=True, header_style="bold")
92-
table.add_column("Name")
93-
table.add_column("Installed Version")
94-
table.add_column("Latest Version")
95-
table.add_column("Status")
96-
97-
for server in outdated_servers:
98-
table.add_row(
99-
server["name"],
100-
server["installed"],
101-
server["latest"],
102-
"[yellow]Update available[/]"
103-
)
21+
# Get the active client manager and information
22+
client_manager = ClientRegistry.get_active_client_manager()
23+
client = ClientRegistry.get_active_client()
24+
client_info = ClientRegistry.get_client_info(client)
25+
client_name = client_info.get("name", client)
26+
27+
# Check if client is supported
28+
if client_manager is None:
29+
console.print("[bold red]Error:[/] Unsupported active client")
30+
console.print("Please switch to a supported client using 'mcpm client <client-name>'")
31+
return
32+
33+
console.print(f"[bold green]MCP servers installed in {client_name}:[/]")
34+
35+
# Get all servers from active client config
36+
servers = client_manager.get_servers()
37+
38+
if not servers:
39+
console.print(f"[yellow]No MCP servers found in {client_name}.[/]")
40+
console.print("Use 'mcpm add <server>' to add a server.")
41+
return
42+
43+
# Count the configured servers
44+
server_count = len(servers)
45+
console.print(f"[bold]Configured servers:[/] {server_count}\n")
46+
47+
# Display detailed information for each server
48+
for server_name, server_info in servers.items():
49+
# Server name and command
50+
console.print(f"[bold cyan]{server_name}[/]")
51+
command = server_info.get("command", "N/A")
52+
console.print(f" Command: [green]{command}[/]")
53+
54+
# Display arguments
55+
args = server_info.get("args", [])
56+
if args:
57+
console.print(" Arguments:")
58+
for i, arg in enumerate(args):
59+
console.print(f" {i}: [yellow]{escape(arg)}[/]")
10460

105-
console.print(table)
61+
# Get package name (usually the second argument)
62+
if len(args) > 1:
63+
console.print(f" Package: [magenta]{args[1]}[/]")
64+
65+
# Display environment variables
66+
env_vars = server_info.get("env", {})
67+
if env_vars:
68+
console.print(" Environment Variables:")
69+
for key, value in env_vars.items():
70+
console.print(f" [bold blue]{key}[/] = [green]\"{value}\"[/]")
10671
else:
107-
console.print("[green]All MCP servers are up to date.[/]")
108-
109-
else:
110-
# Get the active client manager and information
111-
client_manager = ClientRegistry.get_active_client_manager()
112-
client = ClientRegistry.get_active_client()
113-
client_info = ClientRegistry.get_client_info(client)
114-
client_name = client_info.get("name", client)
115-
116-
# Check if client is supported
117-
if client_manager is None:
118-
console.print("[bold red]Error:[/] Unsupported active client")
119-
console.print("Please switch to a supported client using 'mcpm client <client-name>'")
120-
return
72+
console.print(" Environment Variables: [italic]None[/]")
12173

122-
console.print(f"[bold green]MCP servers installed in {client_name}:[/]")
123-
124-
# Get all servers from active client config
125-
servers = client_manager.get_servers()
126-
127-
if not servers:
128-
console.print(f"[yellow]No MCP servers found in {client_name}.[/]")
129-
console.print("Use 'mcpm add <server>' to add a server.")
130-
return
131-
132-
# Count the configured servers
133-
server_count = len(servers)
134-
console.print(f"[bold]Configured servers:[/] {server_count}\n")
135-
136-
# Display detailed information for each server
137-
for server_name, server_info in servers.items():
138-
# Server name and command
139-
console.print(f"[bold cyan]{server_name}[/]")
140-
command = server_info.get("command", "N/A")
141-
console.print(f" Command: [green]{command}[/]")
142-
143-
# Display arguments
144-
args = server_info.get("args", [])
145-
if args:
146-
console.print(" Arguments:")
147-
for i, arg in enumerate(args):
148-
console.print(f" {i}: [yellow]{escape(arg)}[/]")
149-
150-
# Get package name (usually the second argument)
151-
if len(args) > 1:
152-
console.print(f" Package: [magenta]{args[1]}[/]")
153-
154-
# Display environment variables
155-
env_vars = server_info.get("env", {})
156-
if env_vars:
157-
console.print(" Environment Variables:")
158-
for key, value in env_vars.items():
159-
console.print(f" [bold blue]{key}[/] = [green]\"{value}\"[/]")
160-
else:
161-
console.print(" Environment Variables: [italic]None[/]")
162-
163-
# Add a separator line between servers
164-
console.print(" " + "-" * 50)
74+
# Add a separator line between servers
75+
console.print(" " + "-" * 50)

0 commit comments

Comments
 (0)