Skip to content

Commit e763520

Browse files
authored
Replace tables with clearer lists (#408)
1 parent 1beacc0 commit e763520

File tree

1 file changed

+56
-64
lines changed
  • src/mcp_agent/cli/cloud/commands/apps/list

1 file changed

+56
-64
lines changed

src/mcp_agent/cli/cloud/commands/apps/list/main.py

Lines changed: 56 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
from typing import List, Optional
33

44
import typer
5-
from rich.padding import Padding
65
from rich.panel import Panel
7-
from rich.table import Table
86

97
from mcp_agent.cli.auth import load_api_key_credentials
108
from mcp_agent.cli.config import settings
@@ -73,15 +71,19 @@ async def parallel_requests():
7371
print_info(f"Found {num_apps} deployed app(s):")
7472
print_apps(list_apps_res.apps)
7573
else:
74+
console.print("\n[bold blue]📦 Deployed MCP Apps (0)[/bold blue]")
7675
print_info("No deployed apps found.")
7776

77+
console.print("\n" + "─" * 80 + "\n")
78+
7879
if list_app_configs_res.appConfigurations:
7980
num_configs = list_app_configs_res.totalCount or len(
8081
list_app_configs_res.appConfigurations
8182
)
8283
print_info(f"Found {num_configs} configured app(s):")
8384
print_app_configs(list_app_configs_res.appConfigurations)
8485
else:
86+
console.print("\n[bold blue]⚙️ Configured MCP Apps (0)[/bold blue]")
8587
print_info("No configured apps found.")
8688

8789
except UnauthenticatedError as e:
@@ -106,81 +108,71 @@ def print_info_header() -> None:
106108

107109

108110
def print_apps(apps: List[MCPApp]) -> None:
109-
"""Print a summary table of the app information."""
110-
table = Table(
111-
title="Deployed MCP Apps",
112-
expand=False,
113-
border_style="blue",
114-
padding=(0, 1),
115-
)
111+
"""Print a list of deployed apps in a clean, copyable format."""
112+
console.print(f"\n[bold blue]📦 Deployed MCP Apps ({len(apps)})[/bold blue]")
116113

117-
table.add_column("Name", style="cyan", overflow="fold")
118-
table.add_column("ID", style="bright_blue", no_wrap=True)
119-
table.add_column("Description", style="cyan", overflow="fold")
120-
table.add_column("Server URL", style="bright_blue", no_wrap=True)
121-
table.add_column("Status", style="bright_blue", no_wrap=True)
122-
table.add_column("Created", style="cyan", overflow="fold")
123-
124-
for idx, app in enumerate(apps):
125-
is_last_row = idx == len(apps) - 1
126-
table.add_row(
127-
app.name,
128-
app.appId,
129-
app.description,
130-
app.appServerInfo.serverUrl if app.appServerInfo else "",
131-
_server_status_text(
132-
(
133-
app.appServerInfo.status
134-
if app.appServerInfo
135-
else "APP_SERVER_STATUS_OFFLINE"
136-
),
137-
is_last_row,
138-
),
139-
app.createdAt.strftime("%Y-%m-%d %H:%M:%S"),
114+
for i, app in enumerate(apps):
115+
if i > 0:
116+
console.print()
117+
118+
status = _server_status_text(
119+
app.appServerInfo.status
120+
if app.appServerInfo
121+
else "APP_SERVER_STATUS_OFFLINE"
140122
)
141123

142-
console.print(table)
124+
console.print(f"[bold cyan]{app.name or 'Unnamed'}[/bold cyan] {status}")
125+
console.print(f" App ID: {app.appId}")
126+
127+
if app.appServerInfo and app.appServerInfo.serverUrl:
128+
console.print(f" Server: {app.appServerInfo.serverUrl}")
129+
130+
if app.description:
131+
console.print(f" Description: {app.description}")
132+
133+
console.print(f" Created: {app.createdAt.strftime('%Y-%m-%d %H:%M:%S')}")
143134

144135

145136
def print_app_configs(app_configs: List[MCPAppConfiguration]) -> None:
146-
"""Print a summary table of the app configuration information."""
147-
table = Table(title="Configured MCP Apps", expand=False, border_style="blue")
148-
149-
table.add_column("Name", style="cyan", overflow="fold")
150-
table.add_column("ID", style="bright_blue", no_wrap=True)
151-
table.add_column("App ID", style="bright_blue", overflow="fold")
152-
table.add_column("Description", style="cyan", overflow="fold")
153-
table.add_column("Server URL", style="bright_blue", no_wrap=True)
154-
table.add_column("Status", style="bright_blue", no_wrap=True)
155-
table.add_column("Created", style="cyan", overflow="fold")
156-
157-
for idx, config in enumerate(app_configs):
158-
is_last_row = idx == len(app_configs) - 1
159-
table.add_row(
160-
config.app.name if config.app else "",
161-
config.appConfigurationId,
162-
config.app.appId if config.app else "",
163-
config.app.description if config.app else "",
164-
config.appServerInfo.serverUrl if config.appServerInfo else "",
165-
_server_status_text(
166-
(
167-
config.appServerInfo.status
168-
if config.appServerInfo
169-
else "APP_SERVER_STATUS_OFFLINE"
170-
),
171-
is_last_row=is_last_row,
172-
),
173-
config.createdAt.strftime("%Y-%m-%d %H:%M:%S") if config.createdAt else "",
137+
"""Print a list of configured apps in a clean, copyable format."""
138+
console.print(
139+
f"\n[bold blue]⚙️ Configured MCP Apps ({len(app_configs)})[/bold blue]"
140+
)
141+
142+
for i, config in enumerate(app_configs):
143+
if i > 0:
144+
console.print()
145+
146+
status = _server_status_text(
147+
config.appServerInfo.status
148+
if config.appServerInfo
149+
else "APP_SERVER_STATUS_OFFLINE"
150+
)
151+
152+
console.print(
153+
f"[bold cyan]{config.app.name if config.app else 'Unnamed'}[/bold cyan] {status}"
174154
)
155+
console.print(f" Config ID: {config.appConfigurationId}")
156+
157+
if config.app:
158+
console.print(f" App ID: {config.app.appId}")
159+
if config.app.description:
160+
console.print(f" Description: {config.app.description}")
175161

176-
console.print(table)
162+
if config.appServerInfo and config.appServerInfo.serverUrl:
163+
console.print(f" Server: {config.appServerInfo.serverUrl}")
164+
165+
if config.createdAt:
166+
console.print(
167+
f" Created: {config.createdAt.strftime('%Y-%m-%d %H:%M:%S')}"
168+
)
177169

178170

179171
def _server_status_text(status: str, is_last_row: bool = False):
180172
"""Convert server status code to emoji."""
181173
if status == "APP_SERVER_STATUS_ONLINE":
182-
return "🟢 Online"
174+
return "[green]🟢 Online[/green]"
183175
elif status == "APP_SERVER_STATUS_OFFLINE":
184-
return Padding("🔴 Offline", (0, 0, 0 if is_last_row else 1, 0), style="red")
176+
return "[red]🔴 Offline[/red]"
185177
else:
186178
return "❓ Unknown"

0 commit comments

Comments
 (0)