Conversation
|
Can test with |
| preset_normalized = "from-mcp" | ||
| env_folder = "from_mcp_template" | ||
| branch = "from-mcp-init" | ||
| else: |
There was a problem hiding this comment.
Bug: MCP URL Handling and Branch Configuration Errors
The --from-mcp flag introduces two issues during environment creation. Providing an empty string for the MCP URL causes a runtime error when attempting to connect to an invalid server. Additionally, the template download uses a hardcoded from-mcp-init branch, which may not exist and causes download failures.
| else: | ||
| hud_console.warning(f"tools.py not found at {tools_file}") | ||
| except Exception as e: | ||
| hud_console.warning(f"Could not fetch tools: {e}") No newline at end of file |
There was a problem hiding this comment.
Bug: MCP Fetch Delays Environment Initialization
When initializing an environment with --from-mcp, MCP server analysis and tool stub generation occur after the "Next steps" and success messages. This creates a confusing user experience and can leave the environment partially initialized without tool stubs if the MCP fetch fails, without clearly indicating the incomplete state.
| env_folder = PRESET_MAP[preset_normalized] | ||
| if env_folder is None: | ||
| # Validate env_folder (already set above based on from_mcp flag) | ||
| if not from_mcp and env_folder is None: |
There was a problem hiding this comment.
Bug: Empty String Handling Causes Validation Mismatch
The validation if not from_mcp and env_folder is None: is logically inconsistent. When from_mcp is an empty string, env_folder is set based on from_mcp, but not from_mcp evaluates to True, creating a mismatch with the earlier branching logic. This could lead to env_folder not being validated as intended.
| @mcp.tool | ||
| async def {tool.name}({params_str}) -> str: | ||
| """{tool.description}""" | ||
| raise NotImplementedError("TODO: Implement {tool.name}") |
There was a problem hiding this comment.
Could make this nicer, if we want to return an MCPToolResult or something that just contains a NotImplemented message
|
📝 Documentation updates detected! New suggestion: Add documentation for hud init --from-mcp feature |
Note
Adds
hud init --from-mcpto scaffold a controller/environment template from an external MCP server and auto-generate tool stubs, plus introduces thefrom_mcp_templateenvironment.hud initnow supports--from-mcp <URL>to scaffold from an external MCP server.create_environment(...)to acceptfrom_mcpand choose template/branch accordingly.environments/from_mcp_template/withDockerfile,pyproject.toml, controller package (controller/__init__.py,__main__.py,tools.py), example.env.example,tasks.json,test_env.ipynb,test_task.py, and README instructions.hud/cli/init.py:_generate_tool_stubs(...)andanalyze_external_mcp_server(...)to derive function signatures from tool schemas and append stubs tocontroller/tools.py.hud/cli/__init__.pyinithelp/examples to mention--from-mcp.Written by Cursor Bugbot for commit 5d7de36. This will update automatically on new commits. Configure here.