feat(agent): replace the runtime npx for browser agent chrome devtool mcp with pre-built bundle#22213
feat(agent): replace the runtime npx for browser agent chrome devtool mcp with pre-built bundle#22213gsquared94 merged 24 commits intomainfrom
Conversation
|
Size Change: -4.06 kB (-0.02%) Total Size: 26.1 MB
ℹ️ View Unchanged
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant improvement by bundling the chrome-devtools-mcp server instead of fetching it with npx at runtime, enhancing reliability and startup performance. The implementation is generally well-executed. However, a critical path resolution issue in browserManager.ts has been identified, which violates our guidelines for consistent and robust path handling (Rule 1) and would prevent the bundled script from being located in production builds. Addressing this path issue will bring the changes into excellent shape.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors how the browser agent's underlying Chrome DevTools Protocol (CDP) server, Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively replaces the runtime npx dependency for chrome-devtools-mcp with a locally bundled version, which is a great improvement for stability and performance. The use of a manifest file for excluding tools is also a clean solution.
I've found two critical issues related to path resolution that will likely break the build and prevent the browser agent from starting in the production environment. Please see my comments for the specific fixes.
… mcp with pre-built bundle (google-gemini#22213) Co-authored-by: Gaurav Ghosh <gaghosh@google.com> Co-authored-by: Gaurav <39389231+gsquared94@users.noreply.github.com>
|
This also (effectively) fixes #20587 (thank you) |
|
@cynthialong0-0 @gsquared94 - after starting to use this update, I now see, in the debug log:
It consistently occurs right after
& before
Excerpt from the debug log:
(Ignore the 429 / GaxiosError - it's just that time of the day - this error occurs whether or not the 429's are hit.) |
… mcp with pre-built bundle (google-gemini#22213) Co-authored-by: Gaurav Ghosh <gaghosh@google.com> Co-authored-by: Gaurav <39389231+gsquared94@users.noreply.github.com>
… mcp with pre-built bundle (google-gemini#22213) Co-authored-by: Gaurav Ghosh <gaghosh@google.com> Co-authored-by: Gaurav <39389231+gsquared94@users.noreply.github.com>
The bundle:browser-mcp script (which builds packages/core/dist/bundled/ chrome-devtools-mcp.mjs) was never invoked as part of the root bundle pipeline added in google-gemini#22213. This caused the bundled chrome-devtools-mcp to be missing from published npm packages, resulting in MODULE_NOT_FOUND errors at runtime when using the browser agent. Changes: - Add bundle:browser-mcp step to root bundle script before esbuild - Make copy_bundle_assets.js fail loudly when the bundled directory is missing instead of silently skipping the copy
… mcp with pre-built bundle (google-gemini#22213) Co-authored-by: Gaurav Ghosh <gaghosh@google.com> Co-authored-by: Gaurav <39389231+gsquared94@users.noreply.github.com>


Summary
Replaced the runtime npx dependency for the browser MCP server with a bundled version in packages/core, improved tool exclusion management via a manifest, and removed the custom type_text tool.
Details
bundle-browser-mcp.mjs: Created a thin wrapper that imports chrome-devtools-mcp using esbuild. This script will tree shake out excluded tool files, and output a self-contained js file underpackage/core/distlighthouse,performance,screencast, andextensions.browserManager.tstype_textto consolidate and resolve error for duplicate toolsRelated Issues
Fixes #20984, #20983
How to Validate
1. Enable the agent
Add to
.gemini/settings.json:{ "agents": { "overrides": { "browser_agent": { "enabled": true } } } }2. Prompt the browser agent and verify tools can be used, and excluded tools in manifest cannot be used.
Example Prompt with included tools
Example Prompt with excluded tools
And get response for something like:
Pre-Merge Checklist