Skip to content

Commit d37a1f2

Browse files
committed
add quickstart examples
1 parent 20288a3 commit d37a1f2

File tree

1 file changed

+26
-33
lines changed

1 file changed

+26
-33
lines changed

src/mcp_agent/cli/commands/init.py

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,36 @@ def init(
180180
"elicitation": "Elicitation server example",
181181
"sampling": "Sampling server example",
182182
"notifications": "Notifications server example",
183+
"hello-world": "Basic hello world cloud example",
184+
"mcp": "Comprehensive MCP server example with tools, sampling, elicitation",
185+
"temporal": "Temporal integration with durable workflows",
186+
"chatgpt-app": "ChatGPT App with interactive UI widgets",
183187
}
184188

185189
templates = {**scaffolding_templates, **example_templates}
186190

191+
# Map template names to their source paths (shared by quickstart and template modes)
192+
# Format: "name": (repo_path, dest_name) for repo examples
193+
# "name": (None, dest_name, pkg_rel) for packaged examples
194+
example_map = {
195+
"workflow": (EXAMPLE_ROOT / "workflows", "workflow"),
196+
"researcher": (EXAMPLE_ROOT / "usecases" / "mcp_researcher", "researcher"),
197+
"data-analysis": (EXAMPLE_ROOT / "usecases" / "mcp_financial_analyzer", "data-analysis"),
198+
"state-transfer": (EXAMPLE_ROOT / "workflows" / "workflow_router", "state-transfer"),
199+
"basic-agent-server": (EXAMPLE_ROOT / "mcp_agent_server" / "asyncio", "basic_agent_server"),
200+
"mcp-basic-agent": (None, "mcp_basic_agent", "basic/mcp_basic_agent"),
201+
"token-counter": (None, "token_counter", "basic/token_counter"),
202+
"agent-factory": (None, "agent_factory", "basic/agent_factory"),
203+
"reference-agent-server": (None, "reference_agent_server", "mcp_agent_server/reference"),
204+
"elicitation": (None, "elicitation", "mcp_agent_server/elicitation"),
205+
"sampling": (None, "sampling", "mcp_agent_server/sampling"),
206+
"notifications": (None, "notifications", "mcp_agent_server/notifications"),
207+
"hello-world": (EXAMPLE_ROOT / "cloud" / "hello_world", "hello_world"),
208+
"mcp": (EXAMPLE_ROOT / "cloud" / "mcp", "mcp"),
209+
"temporal": (EXAMPLE_ROOT / "cloud" / "temporal", "temporal"),
210+
"chatgpt-app": (EXAMPLE_ROOT / "cloud" / "chatgpt_app", "chatgpt_app"),
211+
}
212+
187213
if list_templates:
188214
console.print("\n[bold]Available Templates:[/bold]\n")
189215

@@ -220,21 +246,6 @@ def init(
220246
console.print("[dim]Use --list to see all available templates[/dim]")
221247
raise typer.Exit(1)
222248

223-
example_map = {
224-
"workflow": (EXAMPLE_ROOT / "workflows", "workflow"),
225-
"researcher": (EXAMPLE_ROOT / "usecases" / "mcp_researcher", "researcher"),
226-
"data-analysis": (EXAMPLE_ROOT / "usecases" / "mcp_financial_analyzer", "data-analysis"),
227-
"state-transfer": (EXAMPLE_ROOT / "workflows" / "workflow_router", "state-transfer"),
228-
"basic-agent-server": (EXAMPLE_ROOT / "mcp_agent_server" / "asyncio", "basic_agent_server"),
229-
"mcp-basic-agent": (None, "mcp_basic_agent", "basic/mcp_basic_agent"),
230-
"token-counter": (None, "token_counter", "basic/token_counter"),
231-
"agent-factory": (None, "agent_factory", "basic/agent_factory"),
232-
"reference-agent-server": (None, "reference_agent_server", "mcp_agent_server/reference"),
233-
"elicitation": (None, "elicitation", "mcp_agent_server/elicitation"),
234-
"sampling": (None, "sampling", "mcp_agent_server/sampling"),
235-
"notifications": (None, "notifications", "mcp_agent_server/notifications"),
236-
}
237-
238249
mapping = example_map.get(quickstart)
239250
if not mapping:
240251
console.print(f"[red]Quickstart example '{quickstart}' not found[/red]")
@@ -301,24 +312,6 @@ def init(
301312

302313
# Handle example templates (copy from repository or package)
303314
if template in example_templates:
304-
# Map template names to their source paths
305-
# Format: "name": (repo_path, dest_name) for repo examples
306-
# "name": (None, dest_name, pkg_rel) for packaged examples
307-
example_map = {
308-
"workflow": (EXAMPLE_ROOT / "workflows", "workflow"),
309-
"researcher": (EXAMPLE_ROOT / "usecases" / "mcp_researcher", "researcher"),
310-
"data-analysis": (EXAMPLE_ROOT / "usecases" / "mcp_financial_analyzer", "data-analysis"),
311-
"state-transfer": (EXAMPLE_ROOT / "workflows" / "workflow_router", "state-transfer"),
312-
"basic-agent-server": (EXAMPLE_ROOT / "mcp_agent_server" / "asyncio", "basic_agent_server"),
313-
"mcp-basic-agent": (None, "mcp_basic_agent", "basic/mcp_basic_agent"),
314-
"token-counter": (None, "token_counter", "basic/token_counter"),
315-
"agent-factory": (None, "agent_factory", "basic/agent_factory"),
316-
"reference-agent-server": (None, "reference_agent_server", "mcp_agent_server/reference"),
317-
"elicitation": (None, "elicitation", "mcp_agent_server/elicitation"),
318-
"sampling": (None, "sampling", "mcp_agent_server/sampling"),
319-
"notifications": (None, "notifications", "mcp_agent_server/notifications"),
320-
}
321-
322315
mapping = example_map.get(template)
323316
if not mapping:
324317
console.print(f"[red]Example template '{template}' not found[/red]")

0 commit comments

Comments
 (0)