Skip to content

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

Open
mergify[bot] wants to merge 2 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-25369
Open

mergify[bot] wants to merge 2 commits into
servicing/6.8from
mergify/bp/servicing/6.8/pr-25369

Conversation

@mergify

@mergify mergify Bot commented Oct 15, 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


This is an automatic backport of pull request #25369 done by [Mergify](https://mergify.com).

@unodevops

Copy link
Copy Markdown
Contributor

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

@mergify

mergify Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@carldebilly

Copy link
Copy Markdown
Member

@Mergifyio rebase

kazo0 and others added 2 commits November 25, 2026 14:37
…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
(cherry picked from commit e5322e3)
…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
(cherry picked from commit af77948)
@mergify

mergify Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

rebase

✅ Branch has been successfully rebased

@carldebilly
carldebilly force-pushed the mergify/bp/servicing/6.8/pr-25369 branch from 8bdffee to ce21503 Compare November 25, 2026 19:37
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

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.

3 participants