Skip to content

Commit 160ccb8

Browse files
committed
update
1 parent 6b19df5 commit 160ccb8

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

docs/cli-reference.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ mcp-agent check
453453
mcp-agent go --model gpt-4o
454454

455455
# Create examples
456-
mcp-agent init --template workflow
456+
mcp-agent init --quickstart workflow
457457
```
458458

459459
### Cloud Deployment

src/mcp_agent/cli/commands/init.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def init(
186186
if list_templates:
187187
console.print("\n[bold]Available Templates:[/bold]\n")
188188

189-
# Scaffolding templates table
190-
console.print("[bold cyan]Scaffolding Templates:[/bold cyan]")
189+
# Templates table
190+
console.print("[bold cyan]Templates:[/bold cyan]")
191191
console.print("[dim]Creates minimal project structure with config files[/dim]\n")
192192
table1 = Table(show_header=True, header_style="cyan")
193193
table1.add_column("Template", style="green")
@@ -196,8 +196,8 @@ def init(
196196
table1.add_row(name, desc)
197197
console.print(table1)
198198

199-
# Example templates table
200-
console.print("\n[bold cyan]Example Templates:[/bold cyan]")
199+
# Quickstart templates table
200+
console.print("\n[bold cyan]Quickstart Templates:[/bold cyan]")
201201
console.print("[dim]Copies complete example projects[/dim]\n")
202202
table2 = Table(show_header=True, header_style="cyan")
203203
table2.add_column("Template", style="green")
@@ -212,24 +212,19 @@ def init(
212212
if ctx.invoked_subcommand:
213213
return
214214

215-
# Handle quickstart mode (backward compatibility with old 'mcp-agent quickstart' command)
216215
if quickstart:
217-
# Map quickstart names to example templates
218216
if quickstart not in example_templates:
219217
console.print(f"[red]Unknown quickstart example: {quickstart}[/red]")
220218
console.print(f"Available examples: {', '.join(example_templates.keys())}")
221219
console.print("[dim]Use --list to see all available templates[/dim]")
222220
raise typer.Exit(1)
223221

224-
# Quickstart mode: copy example to subdirectory, no config files
225222
example_map = {
226-
# Repository examples
227223
"workflow": (EXAMPLE_ROOT / "workflows", "workflow"),
228224
"researcher": (EXAMPLE_ROOT / "usecases" / "mcp_researcher", "researcher"),
229225
"data-analysis": (EXAMPLE_ROOT / "usecases" / "mcp_financial_analyzer", "data-analysis"),
230226
"state-transfer": (EXAMPLE_ROOT / "workflows" / "workflow_router", "state-transfer"),
231227
"basic-agent-server": (EXAMPLE_ROOT / "mcp_agent_server" / "asyncio", "basic_agent_server"),
232-
# Packaged examples (installed with package)
233228
"mcp-basic-agent": (None, "mcp_basic_agent", "basic/mcp_basic_agent"),
234229
"token-counter": (None, "token_counter", "basic/token_counter"),
235230
"agent-factory": (None, "agent_factory", "basic/agent_factory"),
@@ -244,23 +239,18 @@ def init(
244239
console.print(f"[red]Quickstart example '{quickstart}' not found[/red]")
245240
raise typer.Exit(1)
246241

247-
# Resolve target directory
248242
base_dir = dir.resolve()
249243
base_dir.mkdir(parents=True, exist_ok=True)
250244

251-
# Copy example to subdirectory
252245
if len(mapping) == 3:
253-
# Packaged example (None, dst_name, pkg_rel)
254246
_, dst_name, pkg_rel = mapping
255247
dst = base_dir / dst_name
256248
copied = _copy_pkg_tree(pkg_rel, dst, force)
257249
if not copied:
258-
# Fallback to repo if available
259250
src = EXAMPLE_ROOT / pkg_rel.replace("/", "_")
260251
if src.exists():
261252
copied = _copy_tree(src, dst, force)
262253
else:
263-
# Repository example (src, dst_name)
264254
src, dst_name = mapping
265255
dst = base_dir / dst_name
266256
copied = _copy_tree(src, dst, force)
@@ -273,7 +263,6 @@ def init(
273263

274264
return
275265

276-
# Validate template for normal init mode
277266
if template not in templates:
278267
console.print(f"[red]Unknown template: {template}[/red]")
279268
console.print(f"Available templates: {', '.join(templates.keys())}")
@@ -315,13 +304,11 @@ def init(
315304
# Format: "name": (repo_path, dest_name) for repo examples
316305
# "name": (None, dest_name, pkg_rel) for packaged examples
317306
example_map = {
318-
# Repository examples
319307
"workflow": (EXAMPLE_ROOT / "workflows", "workflow"),
320308
"researcher": (EXAMPLE_ROOT / "usecases" / "mcp_researcher", "researcher"),
321309
"data-analysis": (EXAMPLE_ROOT / "usecases" / "mcp_financial_analyzer", "data-analysis"),
322310
"state-transfer": (EXAMPLE_ROOT / "workflows" / "workflow_router", "state-transfer"),
323311
"basic-agent-server": (EXAMPLE_ROOT / "mcp_agent_server" / "asyncio", "basic_agent_server"),
324-
# Packaged examples (installed with package)
325312
"mcp-basic-agent": (None, "mcp_basic_agent", "basic/mcp_basic_agent"),
326313
"token-counter": (None, "token_counter", "basic/token_counter"),
327314
"agent-factory": (None, "agent_factory", "basic/agent_factory"),
@@ -336,19 +323,15 @@ def init(
336323
console.print(f"[red]Example template '{template}' not found[/red]")
337324
raise typer.Exit(1)
338325

339-
# Try packaged examples first (for templates with pkg_rel), then repo examples
340326
if len(mapping) == 3:
341-
# Packaged example (None, dst_name, pkg_rel)
342327
_, dst_name, pkg_rel = mapping
343328
dst = dir / dst_name
344329
copied = _copy_pkg_tree(pkg_rel, dst, force)
345330
if not copied:
346-
# Fallback to repo if available
347331
src = EXAMPLE_ROOT / pkg_rel.replace("/", "_")
348332
if src.exists():
349333
copied = _copy_tree(src, dst, force)
350334
else:
351-
# Repository example (src, dst_name)
352335
src, dst_name = mapping
353336
dst = dir / dst_name
354337
copied = _copy_tree(src, dst, force)
@@ -366,7 +349,6 @@ def init(
366349

367350
return
368351

369-
# Create template-specific files for scaffolding templates
370352
if template == "basic":
371353
# Determine entry script name and handle existing files
372354
script_name = "main.py"

0 commit comments

Comments
 (0)