Skip to content

Commit 078b11a

Browse files
authored
add workflow list and runs (#430)
### TL;DR Reorganized workflow commands `mcp-agent cloud workflows runs` `mcp-agent cloud workflows list` `mcp-agent cloud server workflows` (alias of workflows list) ### What changed? - Moved `list_workflows_for_server` from the servers module to the workflows module as `list_workflow_runs` - Added new workflow commands: `list_workflows` and `list_workflow_runs` - Updated CLI command structure to make workflows commands more intuitive - Applied consistent code formatting with black across all server and workflow related files ### How to test? Test the new and reorganized workflow commands: ```bash # List available workflow definitions mcp-agent cloud workflows list app_abc123 # List workflow runs (previously under servers workflows) mcp-agent cloud workflows runs app_abc123 # Test with different output formats mcp-agent cloud workflows list app_abc123 --format json mcp-agent cloud workflows runs app_abc123 --format yaml # Verify existing commands still work mcp-agent cloud servers list mcp-agent cloud workflows describe app_abc123 run_xyz789 ```
1 parent 28a0822 commit 078b11a

File tree

17 files changed

+704
-337
lines changed

17 files changed

+704
-337
lines changed

src/mcp_agent/cli/cloud/commands/servers/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
from .list.main import list_servers
44
from .describe.main import describe_server
55
from .delete.main import delete_server
6-
from .workflows.main import list_workflows_for_server
76

87
__all__ = [
98
"list_servers",
10-
"describe_server",
9+
"describe_server",
1110
"delete_server",
12-
"list_workflows_for_server",
13-
]
11+
]

src/mcp_agent/cli/cloud/commands/servers/delete/main.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import typer
32
from rich.panel import Panel
43

@@ -17,21 +16,25 @@
1716

1817
@handle_server_api_errors
1918
def delete_server(
20-
id_or_url: str = typer.Argument(..., help="Server ID or app configuration ID to delete"),
21-
force: bool = typer.Option(False, "--force", "-f", help="Force deletion without confirmation prompt"),
19+
id_or_url: str = typer.Argument(
20+
..., help="Server ID or app configuration ID to delete"
21+
),
22+
force: bool = typer.Option(
23+
False, "--force", "-f", help="Force deletion without confirmation prompt"
24+
),
2225
) -> None:
2326
"""Delete a specific MCP Server."""
2427
client = setup_authenticated_client()
2528
server = resolve_server(client, id_or_url)
26-
29+
2730
# Determine server type and delete function
2831
if isinstance(server, MCPApp):
2932
server_type = "Deployed Server"
3033
delete_function = client.delete_app
3134
else:
32-
server_type = "Configured Server"
35+
server_type = "Configured Server"
3336
delete_function = client.delete_app_configuration
34-
37+
3538
server_name = get_server_name(server)
3639
server_id = get_server_id(server)
3740

@@ -47,8 +50,10 @@ def delete_server(
4750
expand=False,
4851
)
4952
)
50-
51-
confirm = typer.confirm(f"\nAre you sure you want to delete this {server_type.lower()}?")
53+
54+
confirm = typer.confirm(
55+
f"\nAre you sure you want to delete this {server_type.lower()}?"
56+
)
5257
if not confirm:
5358
print_info("Deletion cancelled.")
5459
return
@@ -57,14 +62,14 @@ def delete_server(
5762
can_delete = run_async(client.can_delete_app(server_id))
5863
else:
5964
can_delete = run_async(client.can_delete_app_configuration(server_id))
60-
65+
6166
if not can_delete:
6267
raise CLIError(
6368
f"You do not have permission to delete this {server_type.lower()}. "
6469
f"You can only delete servers that you created."
6570
)
6671
deleted_id = run_async(delete_function(server_id))
67-
72+
6873
console.print(
6974
Panel(
7075
f"[green]✅ Successfully deleted {server_type.lower()}[/green]\n\n"
@@ -75,4 +80,3 @@ def delete_server(
7580
expand=False,
7681
)
7782
)
78-

src/mcp_agent/cli/cloud/commands/servers/describe/main.py

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@
99
from mcp_agent.cli.mcp_app.api_client import MCPApp, MCPAppConfiguration
1010
from ...utils import (
1111
setup_authenticated_client,
12-
validate_output_format,
12+
validate_output_format,
1313
resolve_server,
1414
handle_server_api_errors,
1515
clean_server_status,
1616
)
1717
from mcp_agent.cli.utils.ux import console
1818

1919

20-
@handle_server_api_errors
20+
@handle_server_api_errors
2121
def describe_server(
22-
id_or_url: str = typer.Argument(..., help="Server ID or app configuration ID to describe"),
23-
format: Optional[str] = typer.Option("text", "--format", help="Output format (text|json|yaml)"),
22+
id_or_url: str = typer.Argument(
23+
..., help="Server ID or app configuration ID to describe"
24+
),
25+
format: Optional[str] = typer.Option(
26+
"text", "--format", help="Output format (text|json|yaml)"
27+
),
2428
) -> None:
2529
"""Describe a specific MCP Server."""
2630
validate_output_format(format)
@@ -29,13 +33,17 @@ def describe_server(
2933
print_server_description(server, format)
3034

3135

32-
def print_server_description(server: Union[MCPApp, MCPAppConfiguration], output_format: str = "text") -> None:
36+
def print_server_description(
37+
server: Union[MCPApp, MCPAppConfiguration], output_format: str = "text"
38+
) -> None:
3339
"""Print detailed description information for a server."""
34-
40+
3541
valid_formats = ["text", "json", "yaml"]
3642
if output_format not in valid_formats:
37-
raise CLIError(f"Invalid format '{output_format}'. Valid options are: {', '.join(valid_formats)}")
38-
43+
raise CLIError(
44+
f"Invalid format '{output_format}'. Valid options are: {', '.join(valid_formats)}"
45+
)
46+
3947
if output_format == "json":
4048
_print_server_json(server)
4149
elif output_format == "yaml":
@@ -73,30 +81,29 @@ def _server_to_dict(server: Union[MCPApp, MCPAppConfiguration]) -> dict:
7381
server_description = server.app.description if server.app else None
7482
created_at = server.createdAt
7583
server_info = server.appServerInfo
76-
underlying_app = {
77-
"app_id": server.app.appId,
78-
"name": server.app.name
79-
} if server.app else None
84+
underlying_app = (
85+
{"app_id": server.app.appId, "name": server.app.name}
86+
if server.app
87+
else None
88+
)
8089

8190
status_raw = server_info.status if server_info else "APP_SERVER_STATUS_OFFLINE"
8291
server_url = server_info.serverUrl if server_info else None
83-
92+
8493
data = {
8594
"id": server_id,
8695
"name": server_name,
8796
"type": server_type,
8897
"status": clean_server_status(status_raw),
8998
"server_url": server_url,
9099
"description": server_description,
91-
"created_at": created_at.isoformat() if created_at else None
100+
"created_at": created_at.isoformat() if created_at else None,
92101
}
93-
102+
94103
if underlying_app:
95104
data["underlying_app"] = underlying_app
96-
97-
return data
98-
99105

106+
return data
100107

101108

102109
def _print_server_text(server: Union[MCPApp, MCPAppConfiguration]) -> None:
@@ -118,7 +125,7 @@ def _print_server_text(server: Union[MCPApp, MCPAppConfiguration]) -> None:
118125

119126
status_text = "❓ Unknown"
120127
server_url = "N/A"
121-
128+
122129
if server_info:
123130
status_text = _server_status_text(server_info.status)
124131
server_url = server_info.serverUrl
@@ -129,20 +136,24 @@ def _print_server_text(server: Union[MCPApp, MCPAppConfiguration]) -> None:
129136
f"Status: {status_text}",
130137
f"Server URL: [cyan]{server_url}[/cyan]",
131138
]
132-
139+
133140
if server_description:
134141
content_lines.append(f"Description: [cyan]{server_description}[/cyan]")
135-
142+
136143
if created_at:
137-
content_lines.append(f"Created: [cyan]{created_at.strftime('%Y-%m-%d %H:%M:%S')}[/cyan]")
144+
content_lines.append(
145+
f"Created: [cyan]{created_at.strftime('%Y-%m-%d %H:%M:%S')}[/cyan]"
146+
)
138147

139148
if isinstance(server, MCPAppConfiguration) and server.app:
140-
content_lines.extend([
141-
"",
142-
"[bold]Underlying App:[/bold]",
143-
f" App ID: [cyan]{server.app.appId}[/cyan]",
144-
f" App Name: [cyan]{server.app.name}[/cyan]",
145-
])
149+
content_lines.extend(
150+
[
151+
"",
152+
"[bold]Underlying App:[/bold]",
153+
f" App ID: [cyan]{server.app.appId}[/cyan]",
154+
f" App Name: [cyan]{server.app.name}[/cyan]",
155+
]
156+
)
146157

147158
console.print(
148159
Panel(
@@ -161,4 +172,4 @@ def _server_status_text(status: str) -> str:
161172
elif status == "APP_SERVER_STATUS_OFFLINE":
162173
return "[red]🔴 Offline[/red]"
163174
else:
164-
return "❓ Unknown"
175+
return "❓ Unknown"

0 commit comments

Comments
 (0)