Skip to content

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
servicing/6.8from
mergify/bp/servicing/6.8/pr-25374
Closed

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

Conversation

@mergify

@mergify mergify Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

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 /mcp HTTP 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.

  • Verbs: 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-defined app_* tools work too.
  • Script-side verbs that compose the tools: 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 only elementRef, --name is resolved through a compact tree snapshot, like the DevFlow CLI resolves --automationId; --automationId cannot be (the tree does not print it) and says so.
  • Exit codes read structuredContent (matched, verdict) when the host sends it (unoplatform/uno.app-mcp#197), and fall back to the text checks on older hosts.
  • --name value becomes a typed tool argument (JSON when it parses as JSON, string otherwise, bare --flag is true). --json prints the raw CallToolResult; an image block goes to --out or a timestamped file.
  • Starts the DevServer the way start does when none is registered for the solution, unless --no-start.
  • Exit codes: 0 ok; 1 the tool reported an error or find matched nothing; 2 bad arguments, no host with --no-start, or tool not offered. hot-reload-status --file maps every HotReloadVerdict: 0 applied/noChanges/superseded/ignored; 1 notApplied/noOperation/probablyNotApplied/unknown, or no verdict at all; 3 rudeEdit; 4 queued/processing/notReceived/applying (call again).
  • --log-level/-l/--file-log/-fl work before or after the app verb and are never sent to the tool.
  • Logs go to stderr, the result to stdout.
  • uno-devserver app --help (also app help and a bare app) prints the full reference: verbs and their tools, parameter typing, wait/assert, exit codes, examples. The global --help points to it.
  • Docs: new doc/articles/features/devserver-app-commands.md (in the Dev Server TOC), linked from dev-server.md and using-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-testing PostToolUse hook in unoplatform/studio#188, which runs app 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_CliCommandProcess list/cleanup/stop nested-workspace, Given_McpRootsFallbackProcess ×2) fail identically on master on 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 tools cold-started the host and listed the tools; app start → info → tree → screenshot --fileType png → close returned the right text and exit codes; app find exits 2 there because that App MCP predates uno_app_find_elements.

  • --no-start: reuses a registered host, exits 2 with a message when none runs, never spawns one.

  • hot-reload-status exit 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 --ready returned after the connection plus the 15 s fallback; app datacontext --name HelloText resolved ^4t through the tree and returned the real result; unknown name → 1, --automationId on an elementRef-only tool → 2, assert without the find tool → 2, wait with no app → 1 after the timeout.

Known

  • The host lists every tool twice over /mcp (host 6.8 + App MCP 1.4); app tools dedupes.
  • When the app call itself spawns the host, the host inherits the CLI's stdout handle, so uno-devserver app ... | tail waits until the host exits. Same spawn path as start; --no-start or 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).

kazo0 and others added 13 commits October 14, 2026 18:06
… 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)
…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)
…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)
@github-actions github-actions Bot added area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation labels Oct 14, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@kazo0 kazo0 closed this Oct 14, 2026
@unodevops

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants