You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cfd3b95
Browse filesBrowse the repository at this point in the historyBrowse files
feat(native-mcp): one-command launcher and MCP registration for agent driving (#2272)
## Why
Agents can only drive the native desktop app through macOS UI
automation, which is slow and brittle. #1528 added an opt-in
`native-mcp` bridge that lets MCP tools read and click the real
webview's DOM. Nobody uses it: launching takes five hand-set inputs, and
no MCP client is set up.
## What
- `bin/node scripts/desktop-mcp.mjs` launches a test instance with all
the required settings. `--print` shows its identifier and port.
- `.mcp.json` registers the matching MCP client as `buzz-native`.
- `docs/native-mcp.md` explains which identity the instance runs as and
what agents must not do.
## How
The launcher wraps `just desktop`. It derives a test identifier and
bridge port from the worktree path, so each worktree gets its own
instance. It also sets `BUZZODZ_PROFILE` per worktree, so the instance
does not restore another debug build's org sign-in.
`scripts/native-mcp-client.mjs` runs `@hypothesi/tauri-mcp-server`,
pinned at 0.13.1 as a devDependency. The client connects to whichever
app answers in the port range, and two worktrees can share a range. So
the script points it at a loopback relay built on `ws`. The relay
forwards commands only to an app that reports this worktree's
identifier, a debug build and a `main` window. Otherwise each command
fails with a clear error.
No Rust, capability, or identity code changes.
## Risk
Low. Only developers who run the new script are affected. Normal
launches and release builds are untouched. After approval, Claude Code
offers the `buzz-native` tools in every session in this repo, and they
fail harmlessly when no test instance is running.
The instance signs with the shared debug key, so an agent acts as the
developer. The docs say to supervise live use, never let an agent sign
out, and use a disposable account or VM for unsupervised automation.
## Testing
On macOS, through `.mcp.json`, against the real app with the org sign-in
config:
- An agent started a session, opened a channel, clicked between sidebar
tabs and took a screenshot. The live community and its channels loaded.
- After the app quit mid-session, each later command failed at once with
the relay's error instead of hanging.
Against fake bridges, through the stock client: another app on the base
port, a release build, no `main` window, an app swapped after
connecting, a restart on another port, and a late launch. Each reached
only the matching app or failed cleanly. A browser `Origin` gets 401.
## Open questions
1. **Shared key.** Every debug build uses the same Keychain key. Should
test instances get their own throwaway key? That touches
`crates/credential-store`, so it belongs in a separate PR.
2. **Explicit port.** A port passed to `driver_session` skips the relay.
The docs say not to pass one. Closing that gap needs a client change.
buzz-review-completed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Signed-off-by: Kevin Chung <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Replace the example identifier suffix for each owned test instance. Keep `BUZZ_DEV_VIEWER` explicitly empty to disable any inherited legacy broker pin.
64
+
The repository's `buzz-native` client accepts only the instance the launcher
65
+
derives for this worktree, so it refuses one launched with another identifier
66
+
or port.
36
67
Do not add
37
68
this configuration to ordinary desktop or release recipes. A helper that uses
38
69
`TAURI_CONFIG` must merge the test overlay and its identifier into that JSON
@@ -46,13 +77,22 @@ and `huddle-window`. It is outside the auto-loaded `capabilities/` directory.
46
77
It grants neither the bridge's default permission set nor `execute-command`.
47
78
The existing signed host commands and plugin sandbox still apply.
48
79
49
-
## Connect and verify the target
80
+
## Connect
81
+
82
+
The bridge binds only to `127.0.0.1` and takes the first free port of the 100
83
+
from its base port. The repository's `.mcp.json` registers
0 commit comments