Skip to content

feat: add PWA automation tools - #2430

Merged
OrKoN merged 14 commits into
ChromeDevTools:mainfrom
LuHuangMSFT:feat-pwa-tools
Aug 10, 2026
Merged

OrKoN merged 14 commits into
ChromeDevTools:mainfrom
LuHuangMSFT:feat-pwa-tools

Conversation

@LuHuangMSFT

@LuHuangMSFT LuHuangMSFT commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

What / Why

Adds an opt-in Progressive Web Apps tool category that exposes the installed web app lifecycle to MCP clients and agents.

The browser-level PWA APIs were introduced in Puppeteer 25.4.0 (puppeteer/puppeteer#15235). The current base uses Puppeteer 25.5.0, which also enforces URL restrictions for browser-level PWA operations (puppeteer/puppeteer#15271).

Tools

  • install_pwa
  • launch_pwa
  • get_os_app_state
  • uninstall_pwa

The category is disabled by default and enabled with --category-pwa.

These are browser-scoped operations and do not require a selected page. Callers provide the resolved manifest ID and, for installation, an explicit page or bundle URL. open_current_page_in_app and automatic current-page installation are intentionally deferred until Puppeteer exposes page-native APIs with reliable loaded-document and browser-context semantics.

Compatibility and safety

  • Requires a pipe-launched browser. The CLI rejects --category-pwa when combined with --auto-connect, --browser-url, or --ws-endpoint.
  • Puppeteer rejects PWA operations when URL allow/block restrictions are configured, preventing browser-internal PWA fetch and redirect flows from bypassing the configured policy.
  • File-based install bundles are validated against the MCP filesystem roots.
  • DevTools installation defaults to browser display mode unless displayMode: "standalone" is supplied. Launch uses the app's saved display preference.

Testing

  • PWA tests cover lifecycle/state, standalone launch, successful explicit-URL launch, use without a selected page, file-bundle path validation, OS-state output, and selected-page fallback after uninstall.
  • Existing off-by-default category tests cover PWA tool registration and opt-in exposure.
  • Generated README, tool reference, CLI metadata, and telemetry metrics are updated.
  • Type checking, formatting, targeted tests, broad supporting repository tests, third-party notice validation, and diff checks pass locally.
  • Validated against Chrome for Testing 150 and a local Chromium/Edge build.
  • A real stdio MCP lifecycle passed end to end with the final four-tool design: category gating, explicit install, OS state, standalone launch, selecting and scripting the returned page, uninstall, selection fallback, and post-uninstall state rejection.

Refs #2270

@LuHuangMSFT

LuHuangMSFT commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor Author

@OrKoN Puppeteer 25.4.0 now contains the merged browser-level PWA APIs, and the MCP integration is ready for review.

@OrKoN OrKoN left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. A few comments below:

Comment thread src/tools/pwa.ts Resolved
Comment thread src/tools/ToolDefinition.ts Resolved
Comment thread tests/cli.test.ts Resolved
Comment thread package.json Resolved
Comment thread src/telemetry/tool_call_metrics.json Resolved
@LuHuangMSFT

LuHuangMSFT commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor Author

@OrKoN Addressed all six review threads and force-pushed the rebased branch at f648aad. The dependency bump is now supplied by merged #2432, the PR body reflects the final four-tool design.

@LuHuangMSFT

Copy link
Copy Markdown
Contributor Author

@OrKoN Puppeteer 25.5.0 is now on main, so I rebased and removed the duplicate MCP network-restriction guard. Ready for another look. Thanks!

Add an off-by-default Progressive Web Apps category backed by the Puppeteer 25.4.0 browser APIs. The tools install, launch, inspect, and uninstall PWAs, plus install the currently selected page using Chrome parsed manifest data.

Reject install and launch operations while URL restrictions are configured because Chromium browser-scoped PWA requests bypass Puppeteer network filtering.

Refs ChromeDevTools#2270
Browser.installPWA requires an install URL and refetches it through the default profile instead of using the selected loaded document. This makes the current-page wrapper unreliable for transient, authenticated, and isolated-context pages.

Remove the tool until the Web Install API provides page-native semantics, keeping this PR focused on the four direct Puppeteer browser wrappers.
PWA install, launch, uninstall, and state operations are browser-scoped and should remain available when the selected page is closed or missing.

Expose the browser through the tool context and cover all four tools without a selected page.
Chromium exposes the privileged PWA domain only to pipe-launched clients. Reject browser URL, WebSocket endpoint, and auto-connect configurations when the PWA category is enabled instead of advertising tools that fail at runtime.
Describe installation as a dialog-free DevTools operation rather than the omnibox flow, and state that launch follows the app's saved display mode instead of always opening a standalone window.
Expose only the four browser-scoped PWA operations required by tools instead of the full Puppeteer Browser.
Use the CLI option conflict configuration instead of custom post-parse validation.
Exercise the yargs conflict through parseArguments and leave the off-by-default flag undefined so conflicts apply only when enabled.
Drop the deprecated metric for a tool that was removed before release and never shipped.
Cover file bundle root validation, explicit URL launch forwarding, OS file-handler output, and selected-page fallback after uninstall.
Keep the declarative yargs conflicts without exposing a test-only exitProcess parameter through parseArguments. Existing connection-mode parser coverage already protects their established behavior.
Puppeteer 25.5.0 rejects PWA APIs whenever network restrictions are configured. Remove the duplicate MCP guard, its context plumbing, and MCP-specific tests so Puppeteer remains the single enforcement layer.
Clarify that manifestId is the resolved manifest id and defaults to start_url when the manifest omits id. This is a documentation-only change and does not alter runtime behavior.
@OrKoN
OrKoN enabled auto-merge August 10, 2026 09:13
@OrKoN
OrKoN added this pull request to the merge queue Aug 10, 2026
Merged via the queue into ChromeDevTools:main with commit 0ea5c8d Aug 10, 2026
19 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.

2 participants