Repository navigation
Add MCP controls for screenshots, scrolling, mirroring and viewports - #1565
Merged
Merged
Conversation
Make the MCP server easier for an agent to drive the app with: - screenshot: `fullPage` captures the whole document without changing the preview's viewport size (so vh-based layouts stay intact), and `originalResolution` returns an unscaled PNG. Defaults stay compact JPEGs; reported sizes are actual output pixels, including on Retina. - scroll_to: scroll a preview to a unique CSS selector, visible text (case-insensitive, normalized, or `exact`), or absolute x/y, with `block` alignment and nested scroll containers. Ambiguous matches return an error so the agent can refine its target. - set_mirroring: enable or disable event mirroring for one device or all active previews. Mirroring state moves into Redux so the device toolbar and MCP share it; a disabled preview neither sends nor receives mirrored clicks, typing or scrolling, across reloads. - set_device_options: session-only width, height, orientation and color scheme overrides per preview, plus `reset`. Frame sizing, canvas layout and screenshot labels follow the effective viewport; get_app_state reports it. Saved presets are not modified. Supporting changes: a debugger lease so temporary CDP work (full-page capture, media emulation) and the element inspector don't detach each other; navigation from an isolated preview no longer drives every device through the shared address bar; canvas drag-and-drop reads the latest drag position from a ref so a fast drop isn't lost. The new tools follow the local file rule from #1559: scroll_to and full-page screenshots refuse previews showing a non-.html/.htm file. Co-authored-by: Codex <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An error occurred while trying to automatically change base from
fix/mcp-file-url-html-only
to
main
November 22, 2026 08:10
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.
Stacked on #1564 (MCP
file://limits). Review that first; this PR's base will move tomainonce it merges.Makes the MCP server easier for an agent to drive the app with.
New and extended tools
screenshotfullPagecaptures the whole document without changing the preview's viewport size, sovh-based layouts stay intact.originalResolutionreturns an unscaled PNG. Defaults are unchanged (compact JPEG, max 1000px wide). Reported sizes are actual output pixels, including on Retina.scroll_to(new)selector, visibletext(case-insensitive and whitespace-normalized, orexact), or absolutex/y. Supportsblockalignment and nested scroll containers. Ambiguous matches return an error so the agent can refine its target.set_mirroring(new)set_device_options(new)width,height,orientationandcolorSchemeoverrides per preview, plusreset. Frame sizing, the canvas layout and screenshot labels follow the effective viewport, andget_app_statereports it. Saved presets are not modified.Usage examples are in
responsively-mcp/README.md.Supporting changes
main/debugger-lease.ts): temporary CDP work (full-page capture, media emulation) and the element inspector no longer detach each other.event-mirroringslice), so the UI and MCP share it. It is applied to the BrowserSync socket per preview.scroll_toand full-page screenshots refuse a preview showing a local file that isn't.html/.htm.Overlap with #1553
#1553 also fixes full-page screenshots with
vhunits (for the toolbar capture). Here, full-page capture for MCP uses CDPPage.captureScreenshotwithcaptureBeyondViewportand leaves the toolbar capture untouched.Testing
mainin the same environment: four canvas/present-mode pointer tests under Xvfb, andscroll to top button resets scroll in webview, which is flaky onmain(2/4 locally). macOS CI is the reference.🤖 Generated with Claude Code