MCP-Assisted Migration to Forge v3¶
Forge v3 introduces an AI-powered migration assistant via the SAIF MCP (Model Context Protocol) server that automates the migration process from Forge v2 to v3.
The challenge: Manual migration involves dozens of file edits across .NET projects, Terraform modules, and pipeline configurationsβtime-consuming and error-prone.
The solution: The SAIF MCP server provides Copilot with migration knowledge, automated file discovery, and step-by-step execution guidance, reducing migration time from hours to minutes.
π Overview¶
| Aspect | Details |
|---|---|
| Goal | Migrate a Forge v2 application to v3 using AI-assisted automation via the SAIF MCP server |
| Prerequisites | VS Code with Copilot, .NET 10 SDK, SAIF CLI 3.0+, Aspire 13.1+ |
| Time estimate | ~30-45 minutes (vs 2-4 hours manual) |
| Difficulty | Intermediate (requires understanding of git, pipelines, and basic troubleshooting) |
π§ Prerequisites¶
Before starting, ensure you have:
- β VS Code installed with the GitHub Copilot extension
- β .NET 10 SDK β Download from dotnet.microsoft.com/download/dotnet/10.0
- β
SAIF CLI 3.0+ β Verify with
saif --version - β
Aspire 13.1+ β Verify with
aspire --version - β Repository access β Clone permissions for your application repository
- β Azure DevOps access β Permissions to create/delete pipelines
π‘ Tip: If your SAIF CLI or Aspire versions are outdated, run
saif updatetwice with a 20-second pause between runs to ensure all updates complete.
π Instructions¶
Signposting: This guide walks through (1) updating prerequisites, (2) initializing the MCP server, (3) running the AI-assisted migration, and (4) cleaning up old pipelines.
Step 1: Update Prerequisites¶
Before starting the migration, ensure all tools are up to date.
# Verify current versions
dotnet --version # Should be 10.0.x
saif --version # Should be 3.0.x
aspire --version # Should be 13.1.x
# If outdated, update SAIF CLI and Aspire
saif update
Start-Sleep -Seconds 20
saif update
Start-Sleep -Seconds 20
# Verify updates
saif --version
aspire --version
Expected result: All version checks pass with minimum required versions.
β οΈ Important: Close all open terminals and VS Code instances after updating to ensure the new Aspire CLI path is loaded.
Step 2: Initialize MCP Server¶
The MCP server connects GitHub Copilot to the Forge platform documentation and migration tools.
- Close all VS Code windows and terminals to pick up the updated Aspire path
- Open VS Code in your application repository root
- Open a new terminal in VS Code (
Ctrl+`) - Initialize MCP configuration:
Expected result: A .vscode/mcp.json configuration file is created in your repository.
π‘ Tip: The
mcp.jsonfile is ignored by git (in.gitignore) and specific to your local environment.
Step 3: Run AI-Assisted Migration¶
Now you'll use Copilot's agent chat to execute the migration.
- Open Copilot Agent Chat in VS Code:
- Click the Copilot icon in the sidebar
-
Switch to the Agent Chat tab (not inline chat)
-
Select the agent model:
- Choose Claude Opus or Claude Sonnet for best results
-
Opus has stronger reasoning for complex migrations; Sonnet is faster
-
Invoke the migration prompt:
What happens next:
- Copilot retrieves the Forge v2 to v3 Migration Guide
- Creates a local copy in
docs/migration/forge-v2-to-v3.mdfor progress tracking - Establishes a todo list with 10 migration tasks
- Systematically executes each task:
- Discovers files that need updates
- Applies changes using multi-file edit operations
- Runs
dotnet buildafter each section - Updates progress checkboxes in the local migration doc
- Marks todos complete before moving to the next task
π‘ Tip: The agent will use
#runSubagentto parallelize file discovery tasks, significantly speeding up the migration.
Expected result: Copilot progressively completes all 10 migration tasks, providing status updates after each section.
Step 4: Review and Test Migration¶
After Copilot completes the migration, verify the changes.
- Review the changes in git:
- Build the project:
- Run tests:
- Start the AppHost locally:
Expected result: All builds succeed, tests pass, and the Aspire dashboard loads successfully.
Step 5: Update Azure DevOps Pipelines¶
The final step is cleaning up old Okta-specific pipelines and creating the new unified auth pipelines.
β οΈ Important: Complete these steps in the Azure DevOps portalβthey cannot be automated via the MCP server.
Delete Legacy Pipelines¶
Navigate to Pipelines in your Azure DevOps project and delete these pipelines:
{project-id}-okta-appauth-pr{project-id}-okta-appauth{project-id}-okta-userauth-pr{project-id}-okta-userauth
How to delete:
- Go to the pipeline in Azure DevOps
- Click the β― (More actions) menu
- Select Delete
- Confirm deletion
Create New Auth Pipelines¶
Create two new pipelines using the updated YAML files:
{project-id}-auth-prβ PR validation for auth infrastructure- Source:
.azdo/azure-pipelines-auth-pr.yml -
Trigger: Pull requests affecting
infra/auth/** -
{project-id}-authβ Production deployment for auth infrastructure - Source:
.azdo/azure-pipelines-auth.yml - Trigger: Manual (same as existing pipelines)
How to create:
- In Azure DevOps, go to Pipelines β New pipeline
- Select Azure Repos Git
- Choose your repository
- Select Existing Azure Pipelines YAML file
- Browse to the YAML file path
- Click Continue β Save (not Run)
- Rename the pipeline to match the naming convention
Expected result: Four legacy Okta pipelines deleted, two new unified auth pipelines created.
β Verify It Worked¶
After completing all steps, verify the migration:
- Check version compatibility:
# All .csproj files should target net10.0
Select-String -Path "**/*.csproj" -Pattern "<TargetFramework>net10.0</TargetFramework>"
- Verify Aspire SDK:
# AppHost project should use Aspire.AppHost.Sdk/13.1.0
Get-Content "src/*AppHost/*.csproj" | Select-String "Aspire.AppHost.Sdk"
-
Check folder structure:
-
β
infra/api/exists (renamed frominfra/app/) - β
infra/auth/corp/exists (new for Entra ID) -
β
infra/auth/ext/contains Okta configuration -
Confirm pipeline updates:
-
β
.azdo/azure-pipelines-api.ymlreferencesazure-dotnet-api-v3.yml@templates - β
Pipeline templates reference
refs/heads/releases/v3 - β New auth pipelines exist in Azure DevOps
Success indicator:
π― Key Takeaways¶
After completing this guide, you will have:
- β Upgraded your application to .NET 10, Aspire 13, and Forge 3.0 packages
- β Restructured infrastructure to support dual authentication (Entra ID + Okta)
- β
Updated pipelines to use v3 templates with
refs/heads/releases/v3 - β Cleaned up legacy Okta-specific pipelines
- β Experienced AI-assisted migration with the SAIF MCP server
π Troubleshooting¶
Problem: MCP server not found¶
Cause: SAIF CLI is outdated or MCP configuration wasn't initialized.
Solution:
# Update SAIF CLI
saif update
Start-Sleep -Seconds 20
saif update
# Reinitialize MCP
saif mcp init
# Restart VS Code
Problem: Copilot doesn't recognize /mcp.forge.migrate-to-v3¶
Cause: MCP server isn't running or the prompt isn't registered.
Solution:
- Verify
mcp.jsonexists in.vscode/ - Restart VS Code to reload MCP configuration
- In Agent Chat, type
/and verifymcp.forge.migrate-to-v3appears in the suggestions - If still missing, run
saif mcp startmanually and check for errors
Problem: Migration stops partway through¶
Cause: Copilot encountered an unexpected file structure or build error.
Solution:
- Check the Copilot chat for error messages
- Review the last completed todo item
- Manually complete the failed step using the manual migration guide
- Ask Copilot to resume from the next task: "Continue with the next migration task"
Problem: Build fails after migration¶
Cause: Package restore issue or stale build artifacts.
Solution:
# Clear NuGet cache and rebuild
dotnet nuget locals all --clear
dotnet clean
dotnet restore
dotnet build
If errors persist, compare your changes to the manual migration guide to identify missing steps.
π Example¶
Complete Example: Migrating IT-API-EXP-EXAMPLE¶
This example shows the complete workflow for migrating an experience API.
# 1. Verify prerequisites
dotnet --version # 10.0.101
saif --version # 3.0.5
aspire --version # 13.1.0
# 2. Close all terminals and VS Code windows
# 3. Reopen VS Code in repository root
cd C:\repos\it-api-exp-example
code .
# 4. Initialize MCP in VS Code terminal
saif mcp init
# 5. Open Copilot Agent Chat
# - Click Copilot icon β Agent Chat tab
# - Select Claude Opus model
# - Type: /mcp.forge.migrate-to-v3
# 6. Monitor progress
# Copilot outputs:
# β
Task 0: Baseline Build complete
# β
Task 1: .NET 10 SDK verified
# β
Task 2: SAIF Tools updated
# β
Task 3: dotnet-outdated-tool installed
# β
Task 4: .NET 10 Upgrade complete
# β
Task 5: Package Updates complete
# β
Task 6: AppHost Changes complete
# β
Task 7: Infrastructure Restructuring complete
# β
Task 8: Terraform Variable Casing complete
# β
Task 9: Entra ID Migration complete
# β
Task 10: Pipeline Updates complete
# 7. Review changes
git status
git diff
# 8. Test locally
dotnet build
dotnet test
cd src/Example.AppHost
aspire run
# 9. Update Azure DevOps pipelines
# - Delete: it-api-exp-example-okta-appauth, it-api-exp-example-okta-appauth-pr
# - Delete: it-api-exp-example-okta-userauth, it-api-exp-example-okta-userauth-pr
# - Create: it-api-exp-example-auth-pr (from .azdo/azure-pipelines-auth-pr.yml)
# - Create: it-api-exp-example-auth (from .azdo/azure-pipelines-auth.yml)
# 10. Commit and create PR
git checkout -b migrate-to-forge-v3
git add .
git commit -m "Migrate to Forge v3.0"
git push origin migrate-to-forge-v3
Result:
- Migration completed in ~35 minutes
- All tests passing
- PR ready for review with automated changes
π Related Documentation¶
- Forge v2 to v3 Migration Guide - Full manual migration steps
- Version Compatibility Matrix - Supported versions for Forge 3.0
- SAIF CLI Reference - MCP commands and capabilities
π Next Steps¶
After completing the migration:
| Task | Guide |
|---|---|
| Configure Entra ID app roles and scopes | Security Configuration |
| Update TypeSpec definitions for auth | Security Configuration |
| Test authentication in local environment | Create JWT for Testing APIs |
| Deploy to development environment | Run your updated pipelines in Azure DevOps |
| Review breaking changes | Forge 3.0 Release Notes |
π€ About the SAIF MCP Server¶
The SAIF MCP (Model Context Protocol) server is a built-in feature of the SAIF CLI that provides AI assistants like GitHub Copilot with direct access to:
- Forge documentation β Migration guides, how-tos, and reference material
- Guided workflows β Pre-built prompts for common tasks (create application, add feature, troubleshoot, migrate)
- Template information β Complete template metadata and parameter descriptions
- CLI commands β Searchable command help and examples
How it works:
saif mcp initcreates a.vscode/mcp.jsonconfiguration file- The MCP server runs locally and connects to GitHub Copilot via VS Code
- Copilot can invoke MCP tools and prompts using
/mcp.forge.*syntax - The server retrieves documentation from the live Forge docs site and caches it locally
Available MCP prompts:
/mcp.forge.create-applicationβ Start a new project on the Golden Path/mcp.forge.add-featureβ Add features like Cosmos DB, events, or frontend/mcp.forge.troubleshoot-issueβ Debug common Forge issues/mcp.forge.explain-architectureβ Learn about Forge concepts/mcp.forge.migrate-to-v3β Automated migration from v2 to v3