Skip to content

Commit 039d378

Browse files
committed
packed only
1 parent eada515 commit 039d378

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

src/mcp_agent/cli/commands/init.py

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from pathlib import Path
88
from importlib import resources
9-
from importlib.resources import files as _pkg_files
109

1110
import typer
1211
from rich.console import Console
@@ -84,8 +83,7 @@ def _copy_pkg_tree(pkg_rel: str, dst: Path, force: bool) -> int:
8483
"""
8584
try:
8685
root = (
87-
_pkg_files("mcp_agent")
88-
.joinpath("data")
86+
resources.files("mcp_agent.data")
8987
.joinpath("examples")
9088
.joinpath(pkg_rel)
9189
)
@@ -164,24 +162,24 @@ def init(
164162
templates = {**scaffolding_templates, **example_templates}
165163

166164
# Map template names to their source paths (shared by quickstart and template modes)
167-
# Format: "name": (None, dest_name, pkg_rel) for packaged examples
165+
# Format: "name": (dest_name, pkg_rel) - all examples are packaged in mcp_agent.data/examples
168166
example_map = {
169-
"workflow": (None, "workflow", "workflows"),
170-
"researcher": (None, "researcher", "usecases/mcp_researcher"),
171-
"data-analysis": (None, "data-analysis", "usecases/mcp_financial_analyzer"),
172-
"state-transfer": (None, "state-transfer", "workflows/workflow_router"),
173-
"basic-agent-server": (None, "basic_agent_server", "mcp_agent_server/asyncio"),
174-
"mcp-basic-agent": (None, "mcp_basic_agent", "basic/mcp_basic_agent"),
175-
"token-counter": (None, "token_counter", "basic/token_counter"),
176-
"agent-factory": (None, "agent_factory", "basic/agent_factory"),
177-
"reference-agent-server": (None, "reference_agent_server", "mcp_agent_server/reference"),
178-
"elicitation": (None, "elicitation", "mcp_agent_server/elicitation"),
179-
"sampling": (None, "sampling", "mcp_agent_server/sampling"),
180-
"notifications": (None, "notifications", "mcp_agent_server/notifications"),
181-
"hello-world": (None, "hello_world", "cloud/hello_world"),
182-
"mcp": (None, "mcp", "cloud/mcp"),
183-
"temporal": (None, "temporal", "cloud/temporal"),
184-
"chatgpt-app": (None, "chatgpt_app", "cloud/chatgpt_app"),
167+
"workflow": ("workflow", "workflows"),
168+
"researcher": ("researcher", "usecases/mcp_researcher"),
169+
"data-analysis": ("data-analysis", "usecases/mcp_financial_analyzer"),
170+
"state-transfer": ("state-transfer", "workflows/workflow_router"),
171+
"basic-agent-server": ("basic_agent_server", "mcp_agent_server/asyncio"),
172+
"mcp-basic-agent": ("mcp_basic_agent", "basic/mcp_basic_agent"),
173+
"token-counter": ("token_counter", "basic/token_counter"),
174+
"agent-factory": ("agent_factory", "basic/agent_factory"),
175+
"reference-agent-server": ("reference_agent_server", "mcp_agent_server/reference"),
176+
"elicitation": ("elicitation", "mcp_agent_server/elicitation"),
177+
"sampling": ("sampling", "mcp_agent_server/sampling"),
178+
"notifications": ("notifications", "mcp_agent_server/notifications"),
179+
"hello-world": ("hello_world", "cloud/hello_world"),
180+
"mcp": ("mcp", "cloud/mcp"),
181+
"temporal": ("temporal", "cloud/temporal"),
182+
"chatgpt-app": ("chatgpt_app", "cloud/chatgpt_app"),
185183
}
186184

187185
if list_templates:
@@ -228,7 +226,7 @@ def init(
228226
base_dir = dir.resolve()
229227
base_dir.mkdir(parents=True, exist_ok=True)
230228

231-
_, dst_name, pkg_rel = mapping
229+
dst_name, pkg_rel = mapping
232230
dst = base_dir / dst_name
233231
copied = _copy_pkg_tree(pkg_rel, dst, force)
234232

@@ -282,7 +280,7 @@ def init(
282280
console.print(f"[red]Example template '{template}' not found[/red]")
283281
raise typer.Exit(1)
284282

285-
_, dst_name, pkg_rel = mapping
283+
dst_name, pkg_rel = mapping
286284
dst = dir / dst_name
287285
copied = _copy_pkg_tree(pkg_rel, dst, force)
288286

0 commit comments

Comments
 (0)