feat: add Tauri v2 provider for macOS WebKit testing via MCP#921
Open
coreyepstein wants to merge 3 commits intovercel-labs:mainfrom
Open
feat: add Tauri v2 provider for macOS WebKit testing via MCP#921coreyepstein wants to merge 3 commits intovercel-labs:mainfrom
coreyepstein wants to merge 3 commits intovercel-labs:mainfrom
Conversation
Add --provider tauri to enable AI-driven testing of Tauri desktop apps on macOS WebKit (WKWebView) which does not support CDP. The Tauri provider connects to a tauri-plugin-agent-test MCP server running inside the Tauri app via HTTP+SSE and translates agent-browser commands into MCP tool calls. Supported actions: snapshot, click, fill, screenshot, navigate, close. Unsupported (CDP/WebDriver-only) actions return clear error messages. Implementation: - New TauriBackend struct implementing BrowserBackend trait - New BackendType::Tauri variant in DaemonState - Tauri dispatch in handle_snapshot, handle_click, handle_fill, handle_screenshot, handle_navigate, handle_close - Auto-launch skip when Tauri backend is active - SSE event parser for MCP JSON-RPC 2.0 transport Usage: agent-browser --provider tauri # connects to localhost:9876 AGENT_BROWSER_TAURI_PORT=3000 agent-browser --provider tauri Requires tauri-plugin-agent-test in the Tauri app: https://github.com/coreyepstein/tauri-agent-browser Only new dependency: reqwest "stream" feature (reqwest already a dep).
Contributor
|
@coreyepstein is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
- Fix snapshot returning raw string instead of parsed JSON tree (consumers expect `response.snapshot` to be an object, not a string) - Split send_rpc mutex into two scopes to eliminate deadlock risk (lock for POST URL, release, lock again for SSE read) - Add type, press, evaluate to TAURI_UNSUPPORTED_ACTIONS (prevents confusing "Browser not launched" errors)
P1 fixes: - Restrict Tauri provider to loopback hosts only (127.0.0.1, localhost, ::1) — plaintext MCP transport must not expose page content to remote - Wire url/title/content commands through Tauri backend so they return gracefully instead of crashing with "Browser not launched" P2 fixes: - Fix unsupported action list to use actual dispatcher names (cookies_get/set/clear, storage_get/set/clear, not cookies/storage) - Add back/forward/reload/cdp_url/inspect to unsupported list - Add error_for_status() check on POST — prevents 30s hang on 4xx/5xx - Expand test coverage for unsupported action name validation
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.
Summary
--provider taurioption to enable AI-driven testing of Tauri v2 desktop apps on macOS WebKit (WKWebView) — which does not support CDPTauriBackendimplementing theBrowserBackendtrait, connecting to a Tauri app's MCP server via HTTP+SSEios/safariprovider pattern: special-cased inhandle_launch, backend-specific dispatch in action handlersHow it works
The Tauri app runs tauri-plugin-agent-test which starts an MCP server on localhost:9876. The provider connects via SSE, sends JSON-RPC 2.0 requests, and translates agent-browser commands to MCP tool calls:
snapshotsnapshotclickclickfillfillscreenshotscreenshotnavigatenavigateclosecloseUsage
Files changed
cli/src/native/tauri_backend.rs— New file:TauriBackend+ SSE transport +BrowserBackendimpl + unit testscli/src/native/actions.rs— AddBackendType::Tauri,launch_tauri(), Tauri dispatch inhandle_snapshot/click/fill/screenshot/navigate/close, skip auto-launch when Tauri activecli/src/native/mod.rs— Registertauri_backendmodulecli/Cargo.toml— Addstreamfeature toreqwest(already a dep)Test plan
cargo checkpassescargo clippy -- -D warningscleancargo test— 492 passed, 0 failed--provider tauriconnects to a Tauri v2 app (indigo-hq-app), snapshot returns 24 interactive elementsDependencies
Only addition:
streamfeature on existingreqwestdep. No new crates.