Skip to content

Commit 853c7ca

Browse files
Reducing print messages, moving msg to verbose (lastmile-ai#546)
* Reducing print messages, moving msg to verbose * lowercase mcp-agent * Moving ignore file and non-git workspace to verbose * Remove unused imports * adding back logic for default app description
1 parent 13b3ce3 commit 853c7ca

File tree

3 files changed

+45
-48
lines changed

3 files changed

+45
-48
lines changed

src/mcp_agent/cli/cloud/commands/deploy/main.py

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Deploy command for MCP Agent Cloud CLI.
1+
"""Deploy command for mcp-agent cloud CLI.
22
33
This module provides the deploy_config function which processes configuration files
44
with secret tags and transforms them into deployment-ready configurations with secret handles.
@@ -9,7 +9,6 @@
99
from typing import Optional
1010

1111
import typer
12-
from rich.panel import Panel
1312
from rich.progress import Progress, SpinnerColumn, TextColumn
1413

1514
from mcp_agent.cli.auth import load_api_key_credentials
@@ -30,7 +29,6 @@
3029
)
3130
from mcp_agent.cli.utils.retry import retry_async_with_exponential_backoff, RetryError
3231
from mcp_agent.cli.utils.ux import (
33-
console,
3432
print_deployment_header,
3533
print_error,
3634
print_info,
@@ -130,7 +128,7 @@ def deploy_config(
130128
resolve_path=True,
131129
),
132130
) -> str:
133-
"""Deploy an MCP agent using the specified configuration.
131+
"""Deploy an mcp-agent using the specified configuration.
134132
135133
An MCP App is deployed from bundling the code at the specified config directory.
136134
This directory must contain an 'mcp_agent.config.yaml' at its root. The process will look for an existing
@@ -176,18 +174,15 @@ def deploy_config(
176174
if app_name is None:
177175
if default_app_name:
178176
print_info(
179-
f"No app name provided. Using '{default_app_name}' from configuration."
177+
f"Using app name from config.yaml: '{default_app_name}'"
180178
)
181179
app_name = default_app_name
182180
else:
183181
app_name = "default"
184-
print_info("No app name provided. Using 'default' as app name.")
182+
print_info("Using app name: 'default'")
185183

186184
if app_description is None:
187185
if default_app_description:
188-
print_info(
189-
"No app description provided. Using description from configuration."
190-
)
191186
app_description = default_app_description
192187

193188
provided_key = api_key
@@ -203,40 +198,50 @@ def deploy_config(
203198
)
204199
if not effective_api_key:
205200
raise CLIError(
206-
"Must be logged in to deploy. Run 'mcp-agent login', set MCP_API_KEY environment variable or specify --api-key option.",
201+
"You need to be logged in to deploy.\n\n"
202+
"To continue, do one of the following:\n"
203+
" • Run: mcp-agent login\n"
204+
" • Or set the MCP_API_KEY environment variable\n"
205+
" • Or use the --api-key flag with your key",
207206
retriable=False,
208207
)
209-
print_info(f"Using API at {effective_api_url}")
208+
209+
if settings.VERBOSE:
210+
print_info(f"Using API at {effective_api_url}")
210211

211212
mcp_app_client = MCPAppClient(
212213
api_url=effective_api_url, api_key=effective_api_key
213214
)
214215

215-
print_info(f"Checking for existing app ID for '{app_name}'...")
216+
if settings.VERBOSE:
217+
print_info(f"Checking for existing app ID for '{app_name}'...")
218+
216219
try:
217220
app_id = run_async(mcp_app_client.get_app_id_by_name(app_name))
218221
if not app_id:
219-
print_info(
220-
f"No existing app found with name '{app_name}'. Creating a new app..."
221-
)
222+
print_info(f"App '{app_name}' not found — creating a new one...")
222223
app = run_async(
223224
mcp_app_client.create_app(
224225
name=app_name, description=app_description
225226
)
226227
)
227228
app_id = app.appId
228-
print_success(f"Created new app with ID: {app_id}")
229+
print_success(f"Created new app '{app_name}'")
230+
if settings.VERBOSE:
231+
print_info(f"New app id: `{app_id}`")
229232
else:
233+
short_id = f"{app_id[:8]}…"
230234
print_success(
231-
f"Found existing app with ID: {app_id} for name '{app_name}'"
235+
f"Found existing app '{app_name}' (ID: `{short_id}`)"
232236
)
233237
if not non_interactive:
234238
use_existing = typer.confirm(
235-
f"Do you want deploy an update to the existing app ID: {app_id}?",
239+
f"Deploy an update to '{app_name}' (ID: `{short_id}`)?",
236240
default=True,
237241
)
238242
if use_existing:
239-
print_info(f"Will deploy an update to app ID: {app_id}")
243+
if settings.VERBOSE:
244+
print_info(f"Will deploy an update to app ID: `{app_id}`")
240245
else:
241246
print_error(
242247
"Cancelling deployment. Please choose a different app name."
@@ -257,25 +262,21 @@ def deploy_config(
257262
# If a deployed secrets file already exists, determine if it should be used or overwritten
258263
if deployed_secrets_file:
259264
if secrets_file:
260-
print_info(
261-
f"Both '{MCP_SECRETS_FILENAME}' and '{MCP_DEPLOYED_SECRETS_FILENAME}' found in {config_dir}."
262-
)
265+
if settings.VERBOSE:
266+
print_info(
267+
f"Both '{MCP_SECRETS_FILENAME}' and '{MCP_DEPLOYED_SECRETS_FILENAME}' found in {config_dir}."
268+
)
263269
if non_interactive:
264270
print_info(
265-
"--non-interactive specified, using existing deployed secrets file without changes."
271+
"Running in non-interactive mode — reusing previously deployed secrets."
266272
)
267273
else:
268274
reuse = typer.confirm(
269-
f"Do you want to reuse the previously deployed secrets in '{MCP_DEPLOYED_SECRETS_FILENAME}'?",
275+
f"Re-use the deployed secrets from '{MCP_DEPLOYED_SECRETS_FILENAME}'?",
270276
default=True,
271277
)
272278
if not reuse:
273-
print_info(
274-
f"Will update existing '{MCP_DEPLOYED_SECRETS_FILENAME}' by re-processing '{MCP_SECRETS_FILENAME}'."
275-
)
276-
deployed_secrets_file = None # Will trigger re-processing
277-
else:
278-
print_info(f"Using existing '{MCP_DEPLOYED_SECRETS_FILENAME}'.")
279+
deployed_secrets_file = None # Will trigger re-processing)
279280
else:
280281
print_info(
281282
f"Found '{MCP_DEPLOYED_SECRETS_FILENAME}' in {config_dir}, but no '{MCP_SECRETS_FILENAME}' to re-process. Using existing deployed secrets file."
@@ -287,7 +288,7 @@ def deploy_config(
287288

288289
secrets_transformed_path = None
289290
if secrets_file and not deployed_secrets_file:
290-
print_info("Processing secrets file...")
291+
# print_info("Processing secrets file...")
291292
secrets_transformed_path = config_dir / MCP_DEPLOYED_SECRETS_FILENAME
292293

293294
run_async(
@@ -301,21 +302,14 @@ def deploy_config(
301302
)
302303

303304
print_success("Secrets file processed successfully")
304-
print_info(
305-
f"Transformed secrets file written to {secrets_transformed_path}"
306-
)
305+
if settings.VERBOSE:
306+
print_info(
307+
f"Transformed secrets file written to {secrets_transformed_path}"
308+
)
307309

308310
else:
309311
print_info("Skipping secrets processing...")
310312

311-
console.print(
312-
Panel(
313-
"Ready to deploy MCP Agent with processed configuration",
314-
title="Deployment Ready",
315-
border_style="green",
316-
)
317-
)
318-
319313
# Optionally create a local git tag as a breadcrumb of this deployment
320314
if git_tag:
321315
git_meta = get_git_metadata(config_dir)
@@ -325,7 +319,7 @@ def deploy_config(
325319
ts = datetime.now(timezone.utc).strftime("%Y%m%d-%H%M%S")
326320
tag_name = f"mcp-deploy/{safe_name}/{ts}-{git_meta.short_sha}"
327321
msg = (
328-
f"MCP Agent deploy for app '{app_name}' (id {app_id})\n"
322+
f"mcp-agent deploy for app '{app_name}' (ID: `{app_id}`)\n"
329323
f"Commit: {git_meta.commit_sha}\n"
330324
f"Branch: {git_meta.branch or ''}\n"
331325
f"Dirty: {git_meta.dirty}"
@@ -358,7 +352,7 @@ def deploy_config(
358352
)
359353
)
360354

361-
print_info(f"App ID: {app_id}")
355+
print_info(f"App Name '{app_name}'")
362356
if app.appServerInfo:
363357
status = (
364358
"ONLINE"
@@ -463,7 +457,8 @@ async def _perform_api_deployment():
463457
raise
464458

465459
if retry_count > 1:
466-
print_info(f"Deployment API configured with up to {retry_count} attempts")
460+
if settings.VERBOSE:
461+
print_info(f"Deployment API configured with up to {retry_count} attempts")
467462

468463
try:
469464
return await retry_async_with_exponential_backoff(

src/mcp_agent/cli/cloud/commands/deploy/wrangler_wrapper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ def wrangler_deploy(
184184
else:
185185
print_info(f"Using ignore patterns from {ignore_file}")
186186
else:
187-
print_info("No ignore file provided; applying default excludes only")
187+
if settings.VERBOSE:
188+
print_info("No ignore file provided; applying default excludes only")
188189

189190
# Copy the entire project to temp directory, excluding unwanted directories and the live secrets file
190191
def ignore_patterns(path_str, names):
@@ -294,7 +295,8 @@ def ignore_patterns(path_str, names):
294295
},
295296
)
296297
meta_vars.update({"MCP_DEPLOY_WORKSPACE_HASH": bundle_hash})
297-
print_info(f"Deploying from non-git workspace (hash {bundle_hash[:12]}…)")
298+
if settings.VERBOSE:
299+
print_info(f"Deploying from non-git workspace (hash {bundle_hash[:12]}…)")
298300

299301
# Write a breadcrumb file into the project so it ships with the bundle.
300302
# Use a Python file for guaranteed inclusion without renaming.

src/mcp_agent/cli/utils/ux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def print_deployment_header(
196196
f"Configuration: [cyan]{config_file}[/cyan]\n"
197197
f"Secrets file: [cyan]{secrets_file or 'N/A'}[/cyan]\n"
198198
f"Deployed secrets file: [cyan]{deployed_secrets_file or 'Pending creation'}[/cyan]\n",
199-
title="MCP Agent Deployment",
199+
title="mcp-agent deployment",
200200
subtitle="LastMile AI",
201201
border_style="blue",
202202
expand=False,

0 commit comments

Comments
 (0)