Skip to content

Commit 5a0e354

Browse files
committed
lint and format
1 parent c913ff7 commit 5a0e354

File tree

14 files changed

+482
-307
lines changed

14 files changed

+482
-307
lines changed

src/mcp_agent/cli/cloud/commands/auth/whoami/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""MCP Agent Cloud whoami command implementation."""
22

3-
43
from rich.console import Console
54
from rich.panel import Panel
65
from rich.table import Table

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66

77
from .tail.main import tail_logs
88

9-
__all__ = ["tail_logs"]
9+
__all__ = ["tail_logs"]

src/mcp_agent/cli/cloud/commands/logger/configure/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from .main import configure_logger
44

5-
__all__ = ["configure_logger"]
5+
__all__ = ["configure_logger"]

src/mcp_agent/cli/cloud/commands/logger/configure/main.py

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ def configure_logger(
3232
),
3333
) -> None:
3434
"""Configure OTEL endpoint and headers for log collection.
35-
35+
3636
This command allows you to configure the OpenTelemetry endpoint and headers
3737
that will be used for collecting logs from your deployed MCP apps.
38-
38+
3939
Examples:
4040
mcp-agent cloud logger configure https://otel.example.com:4318/v1/logs
4141
mcp-agent cloud logger configure https://otel.example.com --headers "Authorization=Bearer token,X-Custom=value"
@@ -44,17 +44,19 @@ def configure_logger(
4444
if not endpoint and not test:
4545
console.print("[red]Error: Must specify endpoint or use --test[/red]")
4646
raise typer.Exit(1)
47-
47+
4848
config_path = _find_config_file()
49-
49+
5050
if test:
5151
if config_path and config_path.exists():
5252
config = _load_config(config_path)
5353
otel_config = config.get("otel", {})
5454
endpoint = otel_config.get("endpoint")
5555
headers_dict = otel_config.get("headers", {})
5656
else:
57-
console.print("[yellow]No configuration file found. Use --endpoint to set up OTEL configuration.[/yellow]")
57+
console.print(
58+
"[yellow]No configuration file found. Use --endpoint to set up OTEL configuration.[/yellow]"
59+
)
5860
raise typer.Exit(1)
5961
else:
6062
headers_dict = {}
@@ -64,54 +66,68 @@ def configure_logger(
6466
key, value = header_pair.strip().split("=", 1)
6567
headers_dict[key.strip()] = value.strip()
6668
except ValueError:
67-
console.print("[red]Error: Headers must be in format 'key=value,key2=value2'[/red]")
69+
console.print(
70+
"[red]Error: Headers must be in format 'key=value,key2=value2'[/red]"
71+
)
6872
raise typer.Exit(1)
69-
73+
7074
if endpoint:
7175
console.print(f"[blue]Testing connection to {endpoint}...[/blue]")
72-
76+
7377
try:
7478
with httpx.Client(timeout=10.0) as client:
7579
response = client.get(
76-
endpoint.replace("/v1/logs", "/health") if "/v1/logs" in endpoint else f"{endpoint}/health",
77-
headers=headers_dict
80+
endpoint.replace("/v1/logs", "/health")
81+
if "/v1/logs" in endpoint
82+
else f"{endpoint}/health",
83+
headers=headers_dict,
7884
)
79-
80-
if response.status_code in [200, 404]: # 404 is fine, means endpoint exists
85+
86+
if response.status_code in [
87+
200,
88+
404,
89+
]: # 404 is fine, means endpoint exists
8190
console.print("[green]✓ Connection successful[/green]")
8291
else:
83-
console.print(f"[yellow]⚠ Got status {response.status_code}, but endpoint is reachable[/yellow]")
84-
92+
console.print(
93+
f"[yellow]⚠ Got status {response.status_code}, but endpoint is reachable[/yellow]"
94+
)
95+
8596
except httpx.RequestError as e:
8697
console.print(f"[red]✗ Connection failed: {e}[/red]")
8798
if not test:
88-
console.print("[yellow]Configuration will be saved anyway. Check your endpoint URL and network connection.[/yellow]")
89-
99+
console.print(
100+
"[yellow]Configuration will be saved anyway. Check your endpoint URL and network connection.[/yellow]"
101+
)
102+
90103
if not test:
91104
if not config_path:
92105
config_path = Path.cwd() / "mcp_agent.config.yaml"
93-
106+
94107
config = _load_config(config_path) if config_path.exists() else {}
95-
108+
96109
if "otel" not in config:
97110
config["otel"] = {}
98-
111+
99112
config["otel"]["endpoint"] = endpoint
100113
config["otel"]["headers"] = headers_dict
101-
114+
102115
try:
103116
config_path.parent.mkdir(parents=True, exist_ok=True)
104117
with open(config_path, "w") as f:
105118
yaml.dump(config, f, default_flow_style=False, sort_keys=False)
106-
107-
console.print(Panel(
108-
f"[green]✓ OTEL configuration saved to {config_path}[/green]\n\n"
109-
f"Endpoint: {endpoint}\n"
110-
f"Headers: {len(headers_dict)} configured" + (f" ({', '.join(headers_dict.keys())})" if headers_dict else ""),
111-
title="Configuration Saved",
112-
border_style="green"
113-
))
114-
119+
120+
console.print(
121+
Panel(
122+
f"[green]✓ OTEL configuration saved to {config_path}[/green]\n\n"
123+
f"Endpoint: {endpoint}\n"
124+
f"Headers: {len(headers_dict)} configured"
125+
+ (f" ({', '.join(headers_dict.keys())})" if headers_dict else ""),
126+
title="Configuration Saved",
127+
border_style="green",
128+
)
129+
)
130+
115131
except Exception as e:
116132
console.print(f"[red]Error saving configuration: {e}[/red]")
117133
raise typer.Exit(1)
@@ -134,4 +150,4 @@ def _load_config(config_path: Path) -> dict:
134150
with open(config_path, "r") as f:
135151
return yaml.safe_load(f) or {}
136152
except Exception as e:
137-
raise CLIError(f"Failed to load config from {config_path}: {e}")
153+
raise CLIError(f"Failed to load config from {config_path}: {e}")

src/mcp_agent/cli/cloud/commands/logger/tail/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from .main import tail_logs
44

5-
__all__ = ["tail_logs"]
5+
__all__ = ["tail_logs"]

0 commit comments

Comments
 (0)