Repository navigation
Description
Current behavior
The DevServer MCP bridge (dnx uno.devserver --mcp-app) can resolve the right solution and then start the DevServer host with another one. An explicit uno_app_select_solution cannot always correct it.
Repro layout (one global.json at the repository root, an app solution four levels below it, a library-only solution higher up):
root/
├── global.json (msbuild-sdks: Uno.Sdk)
└── a/
├── Lib/Lib.sln (class libraries only)
└── b/c/d/App.sln (the app head)
Start the MCP bridge in root/a/b/c/d. Workspace discovery reports selectedSolutionPath: …/a/b/c/d/App.sln (AutoDiscovered), but the host is launched with --solution …/a/Lib/Lib.sln. No app ever registers, and CsprojUserGenerator writes the DevServer port into the library projects' .csproj.user. uno_app_select_solution with the absolute path of App.sln does not help: the path is accepted as a candidate, resolves to the same workspace (Refresh, no-op), and even forceRestart relaunches through the same rescan.
Cause
Line numbers are on master (9e17b82), under src/Uno.UI.DevServer.Cli/. The solution is decided again in several places after the resolver has chosen it, and only the first one honors the choice:
WorkspaceResolverselectsApp.slncorrectly; its effective workspace directory is the folder of the nearest Unoglobal.json, hereroot(Helpers/WorkspaceResolver.cs:37-60,208-240).DevServerMonitor.RunMonitorrescans that directory on every cycle withSolutionFileFinder.FindSolutionFiles(max depth 3,Mcp/DevServerMonitor.cs:159).DetermineSolutionToLaunch(426-444) usesSelectedSolutionPathonly if the rescan contains it, and otherwise launches the first scanned solution in sorted order. An empty rescan never launches at all (SolutionNotFound,173). The value drives--solution(648-652), the.csproj.userport (629) and ambient-host reuse (281,611).uno_app_select_solutionrejects any path that is not in a depth-3 candidate scan of the observed root (Mcp/ProxyLifecycleManager.cs:278-299,1003-1015;WorkspaceResolver.cs:166-167), so a solution outside the directory the bridge started in, or deeper than the scan, cannot be selected.- The workspace watcher re-resolves on any
global.json,project.assets.json,.slnor.slnxchange with plainResolveAsync(root), ignoring the selection, and may restart onto another solution or stop (ProxyLifecycleManager.cs:428-440,560-572;Mcp/WorkspaceTransitionDecisions.cs:35-53). Adotnet restoreis enough to trigger it. - MCP roots still drive discovery, and roots pointing elsewhere degrade the session (
ProxyLifecycleManager.cs:372-426,519-543,1163-1234).
Add-in discovery has the same depth limit (#24311): UnoToolsLocator scans root/obj and root/*/obj only, so for this layout Uno.UI.App.Mcp is also missing from --addins and the host exposes no MCP tools, even once --solution is right.
Expected behavior
A solution the agent selects is authoritative; discovery helps choose, it does not restrict. This also follows the MCP 2026-07-28 revision, which deprecates roots (SEP-2577) and points servers at tool parameters and server configuration instead.
uno_app_select_solutionaccepts any absolute, existing.sln/.slnx, inside or outside the directory the bridge started in; it is refused only when the DevServer cannot start for it (no resolvable Uno.Sdk), with that reason.uno_healthkeeps listing discovered candidates as suggestions.- With a selection, the monitor launches exactly that solution; the rescan and its sorted fallback apply only when nothing is selected (with a warning when the fallback picks among several), and an empty rescan does not block a selected solution.
- File changes do not replace a selected solution: a change to its
global.jsonor to the solution restarts the same solution; deleting it degrades the session with a message. - Roots are hints for auto-discovery only and never override a selection.
- A
--solution <path>startup argument, next to--solution-dir, for MCP server configurations. - Add-in discovery reads the restored assets of the projects listed in the selected solution (DevServer add-in discovery misses project.assets.json when projects sit more than one level below the workspace root #24311).
Security: accepting any solution adds no trust boundary. The stdio bridge is started locally by the user, and the agent already has its own access to the files; the selection stays logged and visible in uno_health.
Workaround
Copy the root global.json, unchanged, next to the app solution: the resolver stops at the nearest global.json, so the app solution's folder becomes the effective workspace (depth 0 for the rescan, */obj for add-in discovery).
Environment
Reported with Uno.WinUI.DevServer 6.7.103 (Uno.Sdk 6.7.22) on macOS with the Codex CLI; the code involved is unchanged on master.
Activity
fix(devserver): launch the resolved solution
feat(devserver): accept any selected solution
fix(devserver): keep a selected solution
feat(devserver): treat MCP roots as hints
feat(devserver): add --solution to the MCP bridge
test(devserver): cover SDK change of a selection
docs(devserver): document solution selection
fix(devserver): find add-ins via the solution's projects
fix(devserver): launch the resolved solution
feat(devserver): accept any selected solution
fix(devserver): keep a selected solution
feat(devserver): treat MCP roots as hints
feat(devserver): add --solution to the MCP bridge
test(devserver): cover SDK change of a selection
docs(devserver): document solution selection
fix(devserver): find add-ins via the solution's projects