Skip to content

Expose the embedded browser as browser_* MCP tools - #332

Merged
arzafran merged 2 commits into
mainfrom
feat/mcp-browser-tools
Sep 3, 2026
Merged

Expose the embedded browser as browser_* MCP tools#332
arzafran merged 2 commits into
mainfrom
feat/mcp-browser-tools

Conversation

@arzafran

@arzafran arzafran commented Sep 3, 2026

Copy link
Copy Markdown
Member

What this does

Agents that talk to Programa over MCP can now drive the embedded browser: open a split, navigate, read the accessibility snapshot or a screenshot, click and fill, and close the tab, without a Chrome extension and without moving the user's focus. Before this the 85 browser.* socket methods were only reachable through the programa browser CLI.

Summary

  • New CLI-MCP/Tools/BrowserTools.swift with 82 browser_* tools, schemas read from the handler bodies in TerminalController+BrowserAutomation.swift.
  • The three focus-intent browser methods (browser.focus_webview, browser.focus, browser.tab.switch) go in FocusTools.swift as focus_browser_*, so the disruptive set stays auditable in one file.
  • docs/mcp-server.md gains a Browser tools section and drops browser automation from the "not exposed" list. Tools that WKWebView cannot support (network routing, viewport, raw input) stay in the list and return not_supported, which the doc says.
  • The e2e catalog test's expected set was already stale: six agent_* tools existed in the catalog but not in EXPECTED_TOOL_NAMES. This PR corrects the baseline (102 before, 187 after) and adds a browser open, read-title, close flow.

Review order: BrowserTools.swift for schemas, then FocusTools.swift, then the test.

Test plan

  • CI test-e2e runs tests_v2/test_mcp_server_e2e.py and passes with 187 tools and 13 focus_ tools.
  • xcodebuild -scheme programa-mcp build succeeds (verified locally).
  • Point Claude Code at the built programa-mcp and call browser_open_split with a URL: a browser split appears next to the pane and the terminal keeps keyboard focus.

…-mcp

Adds the 85 browser.* socket methods to the MCP tool catalog: 82 browser_*
tools plus three focus_browser_* tools for the focus-intent methods. Corrects
the tool count in the e2e catalog test, which had drifted past the six
agent_* tools, and adds an end-to-end open, read-title, close flow.
open_split, tab_new, and design_mode_toggle do focus the new or target
surface inside their workspace even though they never switch workspaces or
raise the window; focus_browser_element and focus_browser_tab_switch do not
select the workspace. Say so in the schemas, and assert in the e2e flow that
the browser tools leave the selected workspace alone.
@arzafran

arzafran commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Codex cross-model review: 3 medium, 1 low. Verified against the handlers: the target_surface_id/pane_id finding was wrong (the handlers read both), the two focus-wording findings were right and are fixed in the follow-up commit, which also adds a selection-preservation assertion to the browser e2e flow. Alias-in-required (low) left as is; the aliases mirror the socket contract.

@arzafran
arzafran merged commit 9e867c9 into main Sep 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant