Repository navigation
cmux mcp: agents_<verb> tools with receipts - #20609
Conversation
The MCP server should offer the cmux agents CLI verbs as agents_<verb> tools that send the CLI's owner requests and answer with a receipt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cmux mcp now lists agents_workspace_select, agents_workspace_create, agents_tab_select, agents_terminal_focus, agents_terminal_split, agents_palette_open, agents_dialog_list and agents_dialog_answer. A call builds the words cmux agents takes and runs the CLI's own parser and a shared agents::execute over the MCP Backend, so the tool answers the CLI's receipt: the owner's result plus a fresh composed snapshot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Bead |
agents_dialog_answer must only deny permissions over MCP, a dialog reply lost after sending must report in_progress, an oversized receipt must keep its action, result and idempotency key, palette open over MCP must carry origin mcp, and the CLI's agents receipt and exit codes are pinned through a real daemon. Backend::app now takes a mutation flag; callers keep their current behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agents_dialog_answer now only denies permissions over MCP (approving stays in cmux) and is marked destructive; the dialog tools say they reach other agents' pending tool inputs. A feed reply is a mutation, so a reply lost after sending reports in_progress and not retryable. Receipts name the idempotency key a change carried, an oversized receipt drops only its state, and palette open over MCP runs with origin mcp. The CLI receipt test moves to its own module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
Move the agents unit tests into agents/tests.rs, say plainly that agents_dialog_answer replies to other agents' dialogs, and describe the receipt's idempotency key and truncated state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep both the agents_<verb> tools and the render tool in list(), call(), the MCP tests and plans/cmux-next/mcp.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- cargo fmt in Native/OptChat/optchat-chief Autofix-Run: https://github.com/manaflow-ai/cmux/actions/runs/38578014977
Bugbot needs on-demand usage enabledBugbot uses usage-based billing for this team and requires on-demand usage to be enabled. A team admin can enable on-demand usage in the Cursor dashboard. |
Summary
An MCP client can now drive cmux NEXT the way
cmux agentsdoes, without screenshots.cmux mcplists eight new tools:agents_workspace_select,agents_workspace_create,agents_tab_select,agents_terminal_focus,agents_terminal_split,agents_palette_open,agents_dialog_listandagents_dialog_answer. Each answers the CLI's receipt{action, result, idempotency_key, state}, wherestateis a fresh composed snapshot (same shape asagents_snapshot).There is one code path. A tool call turns its JSON arguments into the words
cmux agents <verb>takes, then runs the CLI's ownnormalize_qualified_targets,command()parser and a newagents::executeover the MCPBackendtrait. The CLI now runsexecutetoo, throughmcp::cli_backend(global). The app-focus follow-up for selects now goes throughBackend::app. It behaves the same way as before: a missing app ornot_foundleaves the daemon's answer as it is.agents_dialog_answeronly denies a permission (modeis"deny"only). Any other mode, such as allow, always or bypassPermissions, is refused asnot_runwith "approve permissions in cmux, not over MCP", and nothing is sent. Questions can still be answered withselections. The tool is markeddestructiveHint: true. The CLI keeps every mode, because a person typed it.Backend::apptakes amutationflag. A feed reply whose transport drops after it was sent reportsin_progresswithretryable: false(outcome unknown), instead ofnot_run.stateis replaced, with{truncated: true, hint: "call agents_snapshot"}, soaction,result(with the new ids) and the key survive.origin: "mcp"over MCP and"agents"from the CLI.additionalProperties: false). Targets take a public id, a unique prefix or<session>:<id>. Values that the CLI grammar would read as flags are refused withnot_run, and a workspace name goes through as--name=<value>. Every change except the dialog tools takesidempotency_key.plans/cmux-next/mcp.mdlists the tools and these rules.Proof
Boundary tests in
cli/mcp/tests.rs, run throughmcp::Serverwith the Fake backend:workspace.focusplus the app'sgoToWorkspaceand returns a receipt;not_runwith nothing sent;failure_result;in_progress;origin: "mcp".tests/cli/agents_cli_receipt.rspins the CLI against a real daemon:agents workspace createexits 0 and prints the receipt with its key and the newws_id, a usage error exits 2, and an owner's refusal exits 3 withdetails.state: rejected.bash scripts/verify-cmux-tui-hosted.sh --filter agents_on f58509f. Run 38554199991: all 5 new tests failed withunknown tool: agents_*.agents_tests passed on Linux.mutationparameter wired through with no behavior change). The deny-only, in_progress, oversized-receipt and mcp-origin tests failed. lint also failed, becausetests/cli.rsgrew past its god-file baseline; the fix commit moves that test into its own module. The CLI receipt test did not run, because the lib tests failed first.--filter agents_on 30ba565. Run 38575568842: test (linux) passed all 19 libagents_tests and the CLI receipt testagents_cli_actions_print_a_receipt_and_owner_exit_codes_through_a_real_daemon. lint (linux), including the god-file check, and Rust MSRV passed too. The macOS jobs were still running when I wrote this. Run 38573532548, on 205cff8 before the last commit, failed lint (agents.rswent past 1000 lines; its unit tests now live inagents/tests.rs) and failed one test, because the answer description did not say "other agents".rendertool. Run 38578027533: test (linux) passed all 19 libagents_tests and the CLI receipt test; lint (linux) and Rust MSRV passed. The macOS jobs were still running when I wrote this.Changelog
Added:
cmux mcpoffers thecmux agentsactions (workspace, tab, terminal, palette, dialogs) as tools that return a receipt with a fresh snapshot; over MCP, permission dialogs can only be denied.🤖 Generated with Claude Code