Repository navigation
feat(devserver-cli): app verbs that call the App MCP tools from a shell (backport #25374) - #25493
Closed
mergify[bot] wants to merge 13 commits into
Closed
mergify[bot] wants to merge 13 commits into
mergify[bot] wants to merge 13 commits into
Conversation
… a shell `uno-devserver app <verb> [--param value]... [--json] [--out file]` runs one uno_app_* tool over the host's /mcp endpoint, the same channel the stdio proxy uses, so a script, a hook or a shell-only agent gets the tools an MCP client gets, plus an exit code: 1 for an error result or a find that matched nothing, 2 for a tool the host does not offer. Starts the host like `start` when none is registered for the solution. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit bf92149)
…ad verdict A hook or script must never start a DevServer by accident: with --no-start, no running host for the solution is exit code 2, like a tool that is not offered. `app hot-reload --file` exits 0 only when the app runs the edit, 1 when it does not (the text says why), 3 for a rude edit that needs a start, so a PostToolUse hook can act on the code alone. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit 5a14b7e)
…oad-status` Saving the file triggers Hot Reload; the verb only reports whether the edit was applied, and its name said otherwise. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit ce5dc5b)
…n for elementRef-only tools
Three script-side verbs that need nothing new from the host:
- `wait [--timeoutSeconds] [--ready]` polls the runtime info until an app
is connected, then until Hot Reload is Ready (through the status tool
when offered, else 15 s by the clock). Exit 1 on timeout or Disabled.
- `assert <find selectors> [--state tok,..] [--absent] [--count N]` is a
find with a verdict on the {state} tokens of every match; exit 1 on fail.
- On an App MCP whose element tools take only elementRef, `--name` is
resolved through a compact tree snapshot (#Name), like the DevFlow CLI
resolves --automationId. --automationId cannot be resolved there, since
the tree does not print it, and says so (exit 2).
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
(cherry picked from commit c9394d9)
…ad-status exit codes
App MCP hosts that send `{ matched }` and `{ verdict }` decide the exit
code directly; the text checks stay for older hosts.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
(cherry picked from commit 39c3673)
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit 6fadef2)
…t does not list A hook pays this wait on every edit when the App MCP is older than the status tool; with --no-start the host was already running, so a tool it does not list now is not coming. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit a19c1b0)
…eclares a string parameter `--elementRef 1` parsed as a number and the host answered "An error occurred invoking" for every peer-action, data-context and element screenshot call targeted by a snapshot handle. The tool's input schema decides now, for "string" and the nullable ["string", "null"]. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit b06d3ac)
…to the dictionary the handler takes Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ (cherry picked from commit b69bf09)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L (cherry picked from commit cb72082)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L (cherry picked from commit 2aba85d)
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L (cherry picked from commit c73bdbc)
…tions around `app` - hot-reload-status --file: noChanges, superseded and ignored exit 0; queued, processing, notReceived and applying exit 4 (call again); a file query with no verdict (status unavailable) exits 1 instead of 0. - --log-level/-l/--file-log/-fl are applied by Program before or after the verb, and are no longer sent to the tool or rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L (cherry picked from commit f51b144)
Contributor
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25493/docs/index.html |
Contributor
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
uno-devserver app <verb|tool> [--param value]... [--json] [--out <file>] [--no-start]One new command on the existing DevServer CLI. Every verb is one App MCP tool (
uno_app_*) called over the host's/mcpHTTP endpoint with the same MCP client the stdio proxy uses, so a shell, a Claude Code hook, or a CI script gets the same tools as an MCP client, plus an exit code.tools,start,close,info,hot-reload-status,screenshot,tree,find,invoke,action,click,key,type,datacontext,memory,diag. An unknown verb is sent verbatim, so app-definedapp_*tools work too.wait [--timeoutSeconds] [--ready](until an app is connected, then until Hot Reload is Ready),assert <find selectors> [--state tok,..] [--absent] [--count N](a find with a verdict on the{state}tokens). On an App MCP whose element tools take onlyelementRef,--nameis resolved through a compact tree snapshot, like the DevFlow CLI resolves--automationId;--automationIdcannot be (the tree does not print it) and says so.structuredContent(matched,verdict) when the host sends it (unoplatform/uno.app-mcp#197), and fall back to the text checks on older hosts.--name valuebecomes a typed tool argument (JSON when it parses as JSON, string otherwise, bare--flagistrue).--jsonprints the rawCallToolResult; an image block goes to--outor a timestamped file.startdoes when none is registered for the solution, unless--no-start.findmatched nothing; 2 bad arguments, no host with--no-start, or tool not offered.hot-reload-status --filemaps everyHotReloadVerdict: 0applied/noChanges/superseded/ignored; 1notApplied/noOperation/probablyNotApplied/unknown, or no verdict at all; 3rudeEdit; 4queued/processing/notReceived/applying(call again).--log-level/-l/--file-log/-flwork before or after theappverb and are never sent to the tool.uno-devserver app --help(alsoapp helpand a bareapp) prints the full reference: verbs and their tools, parameter typing,wait/assert, exit codes, examples. The global--helppoints to it.doc/articles/features/devserver-app-commands.md(in the Dev Server TOC), linked fromdev-server.mdandusing-the-uno-mcps.md.Why
The App MCP already is the Uno equivalent of the Dart MCP server. What was missing is the half that a shell can drive: hooks and CI cannot call MCP tools, exit codes are assertions, a command line is replayable by a person, and one install serves every agent. The first consumer is the
uno-testingPostToolUse hook in unoplatform/studio#188, which runsapp hot-reload-status --no-start --file <edited>after each edit and reports the verdict to the agent.Testing
Uno.UI.DevServer.Cli.Tests: 394 total, 389 pass. The 5 failures (Given_CliCommandProcesslist/cleanup/stop nested-workspace,Given_McpRootsFallbackProcess×2) fail identically onmasteron the same machine.End to end against a real host and app (Uno.Sdk 6.8.0-dev.12, host 6.8.0-dev.42):
app toolscold-started the host and listed the tools;app start→info→tree→screenshot --fileType png→closereturned the right text and exit codes;app findexits 2 there because that App MCP predatesuno_app_find_elements.--no-start: reuses a registered host, exits 2 with a message when none runs, never spawns one.hot-reload-statusexit codes are unit-tested against the status text format; the tool itself ships with App MCP 2.0 and was not exercised live.Live on testingground (App MCP 1.3-era host):
app wait --readyreturned after the connection plus the 15 s fallback;app datacontext --name HelloTextresolved^4tthrough the tree and returned the real result; unknown name → 1,--automationIdon an elementRef-only tool → 2,assertwithout the find tool → 2,waitwith no app → 1 after the timeout.Known
/mcp(host 6.8 + App MCP 1.4);app toolsdedupes.appcall itself spawns the host, the host inherits the CLI's stdout handle, souno-devserver app ... | tailwaits until the host exits. Same spawn path asstart;--no-startor a redirect to a file avoids it.🤖 Generated with Claude Code
https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
This is an automatic backport of pull request #25374 done by [Mergify](https://mergify.com).