Repository navigation
feat(devserver-cli): send server instructions for the app tools in the MCP initialize result - #25369
Conversation
…e MCP initialize result The stdio proxy sent no ServerInstructions, so nothing told a client how the uno_app_* tools are meant to be used beyond the tool descriptions; the Uno.UI.App.Mcp add-in's own instructions cannot be forwarded because initialize answers before the host is connected. FieldCheck sessions restarted the app 17 to 26 times each and asked Hot Reload 1 to 10 times, while the Dart MCP server's two-sentence instructions keep a Flutter agent on hot reload. The text states: start with uno_app_start, confirm an edit with uno_app_hot_reload_status then uno_app_find_elements, start again only for arguments, platform, data, Release or a RudeEdit, close with uno_app_close, and the discover/execute path for clients that list only the meta tools. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_017KfqeYY7rsu5aiXBNtzsDQ
There was a problem hiding this comment.
🟢 Approval recommended
It is a minimal, well-documented string-constant addition wired to a valid MCP option, with all verifiable tool names and references confirmed consistent and no code-logic risk.
0 open findings
What changed in this PR
This PR gives the uno.devserver --mcp-app stdio proxy a static ServerInstructions string that is returned in the MCP initialize result. Because initialize is answered before the upstream Host connects, the add-in's own ServerInstructions can't be forwarded, so the proxy now carries a parallel static copy that tells MCP clients (e.g. Claude Code) how the uno_app_* tools are meant to be used for the whole session — reducing redundant restarts and encouraging hot-reload-based validation.
Changes:
- Added
McpStdioServer.AppToolsInstructions— a static instruction string covering the discover/execute meta-tool flow,uno_app_start, hot-reload validation, element location, anduno_app_close. - Wired it to
options.ServerInstructionsinBuildHost, with comments explaining the rationale and the cross-repo coupling with theUno.UI.App.Mcpadd-in.
| File | Description |
|---|---|
src/Uno.UI.DevServer.Cli/Mcp/McpStdioServer.cs |
Introduces the AppToolsInstructions constant and assigns it to McpServerOptions.ServerInstructions so the MCP initialize result carries app-tool usage guidance. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25369/wasm-skia-net9/index.html |
|
The build 239037 found UI Test snapshots differences: Details
|
|
@Mergifyio backport servicing/6.8 |
✅ Backports have been createdDetails
|
vatsashah45
left a comment
There was a problem hiding this comment.
Mechanically fine: ServerInstructions goes out in the initialize result and nothing in McpStdioServer overrides it. The text is a copy of unoplatform/uno.app-mcp#194 plus the meta-tool sentence, so it inherits the same three wording problems against what uno.app-mcp main ships now; inline below. Worth a comment on the constant saying "add-in text plus the first sentence" so the two copies can be checked against each other, and a one-line test in Given_McpStdioServer that the built options carry it. The body's "shipped by Uno.UI.App.Mcp 1.4" is not right either: uno_app_hot_reload_status is on main (2.0-dev) and in no release yet.
…rt, with a fallback for older add-ins uno_app_start does not stop a running app, and the add-in's RudeEdit result names uno_app_restart. The proxy serves any add-in version and 1.4 has no uno_app_restart, so the text names close-then-start for that case. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015hsUAwwK5wrG9pkfJK9iJa
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25369/wasm-skia-net9/index.html |
|
The build 239538 found UI Test snapshots differences: Details
|
|
|
GitHub Issue: closes #25498 (related to unoplatform/uno.app-mcp#191)
PR Type:
✨ Feature
What changed? 🚀
The
uno.devserver --mcp-appstdio proxy sent noServerInstructions, so a client such as Claude Code learned how theuno_app_*tools are meant to be used only from tool descriptions, read once inside a 20k-character catalog, and from whatever skill it loaded. TheUno.UI.App.Mcpadd-in sets instructions on the host's MCP server, but the proxy cannot forward them:initializeis answered before the upstream host is connected.Measured effect, from the FieldCheck comparisons in
unoplatform/private(tools/skill-ab, runs of 2026-10-09 and 2026-10-10): the Uno agent calleduno_app_start17 to 26 times per session and askeduno_app_hot_reload_status1 to 10 times; 27 of 73 restarts after the first start followed nothing but.xaml/.csedits. The Flutter agent on the same brief usedhot_reload13 times per session; what drives it is the Dart MCP server's two-sentenceinstructions("After completing Dart/Flutter code changes, always execute a hot reload or hot restart…"), which the client keeps in the system prompt for the whole session.This PR gives the proxy a static
ServerInstructionsstring (McpStdioServer.AppToolsInstructions): when only the meta tools are listed, calluno_discover_toolsonce and run app tools throughuno_execute_tool; start the app withuno_app_start, neverdotnet run; after editing a.xaml/.csfile do not build, restart or start again, calluno_app_hot_reload_status(file)thenuno_app_find_elements; on a reportedRudeEdit(or to reload app data, or after a Release build) calluno_app_restartonce, oruno_app_closethenuno_app_starton an add-in without it (1.4); to change launch arguments or platform,uno_app_close(desktop) thenuno_app_start; locate byautomationId/name; close withuno_app_close. The add-in carries the same text for direct host clients (unoplatform/uno.app-mcp, branchdev/sb/server-instructions); the two are documented as kept in step, differing only in the discover/execute sentence and theuno_app_restartfallback the proxy needs because it serves any add-in version.Uno.UI.DevServer.Clibuilds in Release with 0 warnings. The text references tools shipped byUno.UI.App.Mcp1.4 (uno_app_hot_reload_status,uno_app_find_elements); an older add-in simply does not list them, and the discover/execute sentence still holds.PR Checklist ✅
McpServerOptions🤖 Generated with Claude Code
https://claude.ai/code/session_017KfqeYY7rsu5aiXBNtzsDQ