-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Labels
Description
Severity: CRITICAL
User's existing project was deleted when asking to add MCP support to an existing function.
What Happened
- User had working Azure Function deployed at
~/random-func/ - User asked: "make this an MCP server and redeploy"
- Agent ran:
rm -rf random-func❌ DELETED USER'S PROJECT - Agent created new project from template at
~/random-mcp/ - User's original code was permanently lost
Expected Behavior
Agent should have:
- Modified
~/random-func/src/functions/httpTrigger.jsto add MCP support - Added any required dependencies to existing
package.json - Redeployed the modified project
- NEVER deleted the existing workspace
Root Cause
The MCP recipe at references/services/functions/templates/mcp.md shows template commands like:
azd init -t remote-mcp-functions-typescript
This suggests starting fresh from a template rather than modifying existing code. The agent interpreted "use the recipe" as "use the template" which led to destructive behavior.
Suggested Fixes
-
Add explicit warning in SKILL.md:
## ⛔ NEVER DELETE USER CODE When adding features to existing projects: - MODIFY existing files, do not replace the project - Templates are for NEW projects only - Use recipe SOURCE CODE snippets for existing projects
-
Clarify MCP recipe for existing projects:
- Add section: "Adding MCP to Existing Functions"
- Reference
recipes/mcp/source/{lang}.mdfor code snippets - Explicitly state: "Do NOT use
azd initon existing projects"
-
Global rules enforcement:
rm -rfon user project directories should require explicitask_userconfirmation- The existing global-rules.md mentions destructive actions but this wasn't enforced
Impact
- Data Loss: User's custom function code permanently deleted
- Trust: User cannot rely on agent to safely modify projects
- Time Lost: Must recreate original implementation
Files Involved
plugin/skills/azure-prepare/references/services/functions/templates/mcp.md- shows templates without warningplugin/skills/azure-prepare/references/global-rules.md- has destructive action rules but not enforcedplugin/skills/azure-prepare/SKILL.md- needs explicit "never delete user code" guidance
Reactions are currently unavailable