Skip to content

feat(devserver-cli): send server instructions for the app tools in the MCP initialize result - #25369

Merged
kazo0 merged 2 commits into
masterfrom
dev/sb/mcp-proxy-instructions
Oct 15, 2026
Merged

kazo0 merged 2 commits into
masterfrom
dev/sb/mcp-proxy-instructions

Conversation

@kazo0

@kazo0 kazo0 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #25498 (related to unoplatform/uno.app-mcp#191)

PR Type:

✨ Feature

What changed? 🚀

The uno.devserver --mcp-app stdio proxy sent no ServerInstructions, so a client such as Claude Code learned how the uno_app_* tools are meant to be used only from tool descriptions, read once inside a 20k-character catalog, and from whatever skill it loaded. The Uno.UI.App.Mcp add-in sets instructions on the host's MCP server, but the proxy cannot forward them: initialize is 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 called uno_app_start 17 to 26 times per session and asked uno_app_hot_reload_status 1 to 10 times; 27 of 73 restarts after the first start followed nothing but .xaml/.cs edits. The Flutter agent on the same brief used hot_reload 13 times per session; what drives it is the Dart MCP server's two-sentence instructions ("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 ServerInstructions string (McpStdioServer.AppToolsInstructions): when only the meta tools are listed, call uno_discover_tools once and run app tools through uno_execute_tool; start the app with uno_app_start, never dotnet run; after editing a .xaml/.cs file do not build, restart or start again, call uno_app_hot_reload_status(file) then uno_app_find_elements; on a reported RudeEdit (or to reload app data, or after a Release build) call uno_app_restart once, or uno_app_close then uno_app_start on an add-in without it (1.4); to change launch arguments or platform, uno_app_close (desktop) then uno_app_start; locate by automationId/name; close with uno_app_close. The add-in carries the same text for direct host clients (unoplatform/uno.app-mcp, branch dev/sb/server-instructions); the two are documented as kept in step, differing only in the discover/execute sentence and the uno_app_restart fallback the proxy needs because it serves any add-in version.

Uno.UI.DevServer.Cli builds in Release with 0 warnings. The text references tools shipped by Uno.UI.App.Mcp 1.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 ✅

  • 🧪 Runtime tests: none, the change is a string on McpServerOptions
  • 📚 Docs: the instructions are the documentation; XML doc comment names the add-in copy to keep in step
  • 🖼️ Screenshots Compare: not applicable
  • ❗ Contains NO breaking changes

🤖 Generated with Claude Code

https://claude.ai/code/session_017KfqeYY7rsu5aiXBNtzsDQ

…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
Copilot AI balanced review requested due to automatic review settings October 12, 2026 10:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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, and uno_app_close.
  • Wired it to options.ServerInstructions in BuildHost, with comments explaining the rationale and the cross-repo coupling with the Uno.UI.App.Mcp add-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.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 239037 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageBrushInList.png-dark
    • ImageBrushInList.png
    • DropDownButtonPage.png-dark
    • Examples.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
  • skia-windows-screenshots: 2458 changed over 2488

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png-dark
    • AnimatedVisualsTestbedPage.png-dark
    • ApplicationViewMode.png-dark
    • ApplicationViewSpanningRectsPage.png
    • AppWindowPresenters.png
    • AppXamlDefinedResources.png-dark
    • Attributed_text_FontSize_Changing.png
    • AuthenticationBroker_Cancel.png
    • AutoBorderStretchwithrightmargin.png
    • AutoBorderStretchwithtopmargin.png-dark
    • AutoSizedPathCentered.png-dark
    • AutoSizedPathCentered.png
    • AutoSuggestBoxChosenSuggestion.png-dark
    • AutoSuggestBoxChosenSuggestion.png
    • AutoSuggestBox_Reason.png-dark
    • AutoSuggestBox_Reason.png
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png
    • Battery.png-dark
    • Battery.png

@kazo0

kazo0 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@Mergifyio backport servicing/6.8

@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

backport servicing/6.8

✅ Backports have been created

Details

@vatsashah45 vatsashah45 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

It is a minimal, well-documented, low-risk change that assigns a static instructions string to a valid MCP SDK property with no logic changes or identifiable defects.

0 open findings

🧠 Review effort: Balanced

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 239538 found UI Test snapshots differences: skia-linux-screenshots: 118, skia-windows-screenshots: 2458

Details
  • skia-linux-screenshots: 118 changed over 2458

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Buttons.png-dark
    • Buttons.png
    • ClipboardTests.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • CompositionNineGridBrush_Source_Changes.png-dark
    • CompositionNineGridBrush_Source_Changes.png
    • DisplayInformation.png-dark
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageBrushAlignmentXY.png-dark
    • ImageBrushAlignmentXY.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • DropDownButtonPage.png-dark
    • Examples.png
  • skia-windows-screenshots: 2458 changed over 2488

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AnimatedIconPage.png
    • AnimatedVisualsTestbedPage.png-dark
    • ApplicationViewSizing.png-dark
    • AppWindowClosing.png-dark
    • AppWindowPresenters.png-dark
    • ArcSegment.png-dark
    • AuthenticationBroker_Cancel.png-dark
    • AutoBorderStretchwithleftmargin.png
    • AutomationProperties_Landmark.png
    • AutomationProperties_Name.png-dark
    • AutoSuggestBox_Description.png
    • AutoSuggestBox_Icons.png-dark
    • BasicAutoSuggestBox.png-dark
    • BasicAutoSuggestBox.png
    • Basics_Automated.png-dark
    • Basics_Automated.png
    • BitmapIcon_Foreground.png-dark
    • BitmapIcon_Foreground.png
    • BorderTopwithmargins.png-dark
    • BorderTopwithmargins.png

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 239538 has failed on Uno.UI - CI.

@kazo0
kazo0 merged commit 28f2f3a into master Oct 15, 2026
58 checks passed
@kazo0
kazo0 deleted the dev/sb/mcp-proxy-instructions branch October 15, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DevServer CLI: send server instructions for the app tools in the MCP initialize result

6 participants