文件历史

96 次代码提交

作者 SHA1 备注 提交日期
Gustav Ernberg von Heijne d845ad4858 feat: Add ability to inject script to run on page load (#568)
Adds a parameter "initScript" to be used to inject a script into the
page load before other scripts execute.

[Page.evaluateOnNewDocument](https://pptr.dev/api/puppeteer.page.evaluateonnewdocument)

See #567

---------

Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2026-01-28 12:29:33 +00:00
adam jones d7568881ba feat: add background parameter to new_page tool (#837)
## Summary

- Add `background` boolean parameter to the `new_page` tool
- When set to `true`, the new page opens in the background without
bringing it to the front
- Uses Puppeteer's existing `background` option for `browser.newPage()`

Fixes #826

---------

Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2026-01-26 16:06:59 +00:00
Alex Rudenko 4b8e9f2875 feat: allow skipping snapshot generation for input tools (#821)
Input tools have snapshots not re-generated by default now with an
option to opt-in to get a snapshot.

Refs: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/726
2026-01-23 13:43:00 +00:00
Alex Rudenko a8169676f9 feat: support device viewport and user agent emulation (#798)
This PR adds two emulation attributes `viewport` and `userAgent` that
allow emulating a mobile or a different desktop device.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/272
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/619
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/410
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/280
(the recommended way is to emulate via the MCP server instead of a
parallel DevTools session)
2026-01-20 14:07:57 +00:00
Alex Rudenko aa9a176956 fix: improve performance tool description (#800)
Drive-by: refactor and improve eval scripts.
2026-01-20 11:38:51 +00:00
Alex Rudenko 6d0e4cab28 feat: support filePath for network request and response bodies (#795)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/377
2026-01-19 12:44:59 +00:00
Alex Rudenko 9b21f8b2e9 fix: handle beforeunload dialogs in navigations (#788)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/713
2026-01-19 10:04:45 +00:00
Alex Rudenko 68ae2f8253 feat: support filePath in performance tools (#686)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/680
2026-01-13 11:22:14 +00:00
Alex Rudenko a23c6ba8c9 refactor: change pageIdx to page ids (#741)
This allows for order-independent page IDs that are still easy to
consume by LLMs (incremental integers).
2026-01-08 15:59:30 +01:00
Alex Rudenko 81cbd99f52 docs: enhance cli docs + sort required vs opt params (#674) 2025-12-13 09:16:04 +00:00
Alex Rudenko ceae17be26 fix: make bringToFront optional in select_page (#668)
bringToFront() not only brings the tab to front in the browser but also
the browser window itself. This PR fixes the issue by making the call to
bringToFront() optional allowing agents to bring a tab to the user's
attention if needed but not always. To mitigate the risk of selected
page that is in the background being throttled, this PR implements
emulation of the focused page to make background tabs run as usual.
2025-12-12 11:04:04 +00:00
JustasM 3991e4c2a9 feat(emulation): add geolocation emulation tool (#634)
Adding emulate_geolocation tool to emulate device location for testing
location-based features. Supports setting latitude/longitude or clearing
the override.

Closing https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/296
2025-12-02 08:57:55 +01:00
Connor Clark 36504d29ca feat: add insightSetId to performance_analyze_insight (#518)
This should land with / after
https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/508
2025-11-04 08:18:04 +00:00
Alex Rudenko 4a83574961 feat: fetch DOM node selected in the DevTools Elements panel (#486)
Refs https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/129
2025-10-31 11:07:10 +01:00
Alex Rudenko 2f448e84ea fix: improve get_network_request description (#500)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/497
2025-10-30 11:52:09 +01:00
Alex Rudenko c06f4522ee refactor: merge emulate tools into one (#494)
Merges emulateCpu and emulateNetwork into a single tool to reduce token
consumption. Changes descriptions to be more concise.
2025-10-30 08:50:36 +00:00
Alex Rudenko 8e56307d62 feat: an option to ignore cache on reload (#485)
This CL implements an option to ignore cache on reload. Since the
configuration is passed as-is we rely on tests in Puppeteer to verify
the cache behavior.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/374
2025-10-29 10:32:27 +01:00
Alex Rudenko 796aed72b7 feat: detect network requests inspected in DevTools UI (#477)
If you manually inspect a network request in the DevTools UI, the Chrome
DevTools MCP server is now able to detect it and allow you to refer to
the selected request. The approach was tested in a couple of models.

In the list of the network requests we have a short indication about
which request is selected in DevTools UI. We refer to the DevTools as
"DevTools UI" to disambiguate from the DevTools MCP server.
2025-10-28 10:52:09 +01:00
Alex Rudenko b0ce08ae2c feat: support saving snapshots to file (#463)
Refs https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/153

---------

Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2025-10-24 09:20:14 +00:00
Alex Rudenko d177087981 feat: support page reload (#462)
- merges navigation tools into a single tool.
- adds reload functionality.
- in a follow-up we will add options to reload.
2025-10-24 09:00:04 +00:00
Alex Rudenko b427392392 feat: add a press_key tool (#458)
Press key can be used to test shortcuts and individual key presses.
2025-10-23 16:18:58 +00:00
Nikolay Vitkov 70cd290986 chore: rename options to includePreserved<Data> (#455) 2025-10-22 10:54:12 +00:00
Nikolay Vitkov 6f24362039 feat: support previous navigation for Console messages (#452) 2025-10-22 01:03:01 +02:00
Nikolay Vitkov 165cf9c70b feat: expose previous navigations to the MCP (#419)
We should consider changing the order of element shown in the from the
collectors to be show newest first rather then the current oldest first
approach.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/88
2025-10-21 12:25:08 +00:00
Alina Varkki 92055933dc feat: tool to get a verbose single console message (#435) 2025-10-20 11:18:41 +02:00
Nikolay Vitkov 2313fdacad fix: better wording for evaluate_script (#392)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/390
2025-10-16 11:53:04 +02:00
Alina Varkki 15d942c4f3 feat: add filters and pagination to the console messages tool (#387)
In the next pr, we will add ids to messages and another tool to get more
details by id
2025-10-15 18:22:15 +02:00
Alex Rudenko d47aaa96ff feat: support verbose snapshots (#388)
As an option allow verbose snapshots
https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/363

---------

Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
2025-10-15 12:16:34 +00:00
Nikolay Vitkov 579819b5e7 feat: use stable id for network request querying (#382)
Provides stable id when selecting a network request, this should fix
issues with multiple same places and long URL selection.
2025-10-14 14:35:15 +02:00
Alex Rudenko 9ad7cbb2de fix: document that console and requests are since the last nav (#335)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/240
2025-10-10 13:51:36 +00:00
iamitesh 139ce60781 feat: Add offline network emulation support to emulate_network command (#326)
https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/320
Issue:
It would be very useful to have the ability to simulate offline network
conditions directly through the MCP emulate_network command, similar to
how it's possible in DevTools.
Currently, the command doesn’t support an Offline state, which limits
testing for PWA and offline-first web applications. Adding this option
would make it easier to automate and validate offline behavior through
MCP scripts or tools that rely on this API.

Solution
- Add 'Offline' option to throttlingOptions for simulating offline
network conditions
- Update emulate_network tool to handle offline mode with proper network
conditions
- Update documentation to include offline option and usage instructions
- Add test coverage for offline network emulation functionality
- Enable testing of PWA and offline-first web applications through MCP
2025-10-10 09:22:16 +02:00
Nikolay Vitkov 2714158eb3 docs: fix typos (#260)
This also implements the suggestion from
https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/244
but that includes other parts that I am not sure we would want for now.
2025-10-02 16:59:09 +02:00
Alex Rudenko 36e64d5ae2 feat: support timeouts in wait_for and navigations (#228)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/223
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/116
2025-10-01 10:48:53 +02:00
Coquinate 03e02a2d76 feat(screenshot): add WebP format support with quality parameter (#220)
## Summary

This PR adds WebP format support to the screenshot tool, providing
superior compression compared to JPEG while maintaining image quality.

## Problem

Currently, the Chrome DevTools MCP only supports PNG and JPEG formats
for screenshots. This leads to:
- Missing out on WebP's superior compression (25-34% better than JPEG at
equivalent quality)
- Larger file sizes than necessary for AI assistants with image size
limits
- No access to a modern format that offers both better compression and
transparency support
- Bug: `saveTemporaryFile` always saved files with `.png` extension
regardless of the specified format

## Solution

Added WebP as a supported format in the screenshot tool schema and
extended the quality parameter to work with WebP (0-100 range, same as
JPEG). Also fixed the file extension bug in `saveTemporaryFile`.

## Changes

-  Added `webp` to screenshot format enum alongside `png` and `jpeg`
-  Extended quality parameter description to include WebP support
-  Updated `saveTemporaryFile` to properly handle WebP MIME type and
file extension
-  Fixed bug where all screenshots were saved as `.png` regardless of
format
-  Updated type definitions in `ToolDefinition.ts` for WebP support
-  Updated documentation via `npm run docs`

## Testing

Puppeteer 24.22.3 (used by this project) has full WebP support including
quality parameter. Expected compression improvements based on WebP
benchmarks:
- **PNG (baseline):** 128 KB
- **JPEG quality 50:** 84 KB (34% reduction vs PNG)
- **WebP quality 50:** ~60 KB (53% reduction vs PNG, 29% better than
JPEG)
- **WebP quality 75:** ~90 KB (optimal quality/size balance)

All existing tests pass (131/131).

## Impact

This change is **backward compatible** - WebP is an optional format that
doesn't affect existing PNG/JPEG usage. It particularly helps with:
- AI assistants that have image size limits
- Reducing bandwidth when capturing many screenshots  
- Providing transparency support with better compression than PNG
- Offering a modern, universally-supported image format (Chrome,
Firefox, Safari, Edge)

## Example Usage

```javascript
// High quality WebP
await take_screenshot({
  format: 'webp',
  quality: 85,
  fullPage: false
})

// Optimized for size
await take_screenshot({
  format: 'webp',
  quality: 50,  // ~29% smaller than JPEG quality 50
  fullPage: true
})
```

## Checklist

- [x] Code follows conventional commits
- [x] Documentation updated with `npm run docs`
- [x] All tests passing (131/131)
- [x] Backward compatible
- [x] Bug fix included (file extension handling)
- [ ] CLA signed (will complete if needed)

Fixes #[issue-number] (if applicable)

---------

Co-authored-by: aberemia24 <aberemia@gmail.com>
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2025-10-01 10:11:04 +02:00
James Doyle f03072698d feat(screenshot): adds ability to output screenshot to a specific pat… (#172)
…h. Closes #152. Closes #153
2025-09-30 19:56:46 +02:00
Coquinate 139cfd135c feat(screenshot): add JPEG quality parameter support (#184)
## Summary

This PR adds support for the `quality` parameter when taking JPEG
screenshots, allowing users to control compression levels and
significantly reduce file sizes.

## Problem

Currently, the Chrome DevTools MCP doesn't expose the `quality`
parameter that Puppeteer natively supports. This leads to:
- Large screenshot file sizes (especially problematic for AI assistants
with image size limits)
- No control over JPEG compression 
- Inability to optimize screenshots for different use cases

## Solution

Added the `quality` parameter (0-100) to the screenshot tool schema and
passed it through to Puppeteer's screenshot method.

## Changes

-  Added `quality` parameter to screenshot schema with proper
validation (0-100 range)
-  Pass quality parameter to Puppeteer's `screenshot()` method
-  Added `optimizeForSpeed` flag for improved encoding performance
-  Updated documentation via `npm run docs`

## Testing

Tested locally with various quality settings:
- **PNG (baseline):** 128 KB
- **JPEG quality 100:** 245 KB
- **JPEG quality 50:** 84 KB (35% reduction)
- **JPEG quality 30:** 66 KB (49% reduction)

## Impact

This change is **backward compatible** - the quality parameter is
optional and doesn't affect existing usage. It particularly helps with:
- AI assistants that have image size limits (e.g., 8000px max dimension
errors)
- Reducing bandwidth when capturing many screenshots
- Optimizing storage for screenshot-heavy workflows

## Example Usage

```javascript
// New capability - control JPEG quality
await take_screenshot({
  format: 'jpeg',
  quality: 50,  // New parameter!
  fullPage: false
})
```

## Checklist

- [x] Code follows conventional commits
- [x] Documentation updated with `npm run docs`
- [x] Tested locally
- [x] Backward compatible
- [ ] CLA signed (will complete if needed)

Fixes #[issue-number] (if applicable)

Co-authored-by: aberemia24 <aberemia@gmail.com>
2025-09-29 14:00:36 +00:00
Oz Tamir 59d81a3325 feat: add network request filtering by resource type (#162)
### Summary
This PR build upon #145 to also adds filtering by resource type to
`list_network_requests` (Also see: #137 and #107).

### Motivation
Agents often need specific request types (e.g., scripts, stylesheets,
images). Filtering reduces noise and improves performance.

### Changes
- **New parameter**: `resourceType` (array) to filter by resource types
- **Supported types**: all resource types supported by Puppeteer
- **Backward compatible**: when omitted, returns all requests

Filtering runs before pagination, so pagination applies to the filtered
results.
2025-09-26 13:17:58 +00:00
Jack Franklin 6cfc9774f4 fix: add core web vitals to performance_start_trace description (#168)
Fixes #124 and #159. People have reported that when asked for CWV
metrics, the AI will use `evaluate_script` to inject some code into the
page to gather them. But, we want to encourage it to record a trace
instead and use those values.

After some testing locally, adding CWV explicitly to the description
makes it much more reliable that the AI will reach for trace recording
when asked about CWVs.
2025-09-26 13:14:27 +00:00
Oz Tamir 4c909bb8d7 feat: Add pagination list_network_requests (#145)
## Summary

This PR enhances the `list_network_requests` tool with pagination
support to handle large numbers of network requests efficiently. See
[this
issue](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/136).

## Motivation

In my experience, the `list_network_requests` tool frequently hits LLM
token limits on pages with many requests, making it unusable for modern
web applications. I wanted to add pagination to allow agents to be more
flexible and manage token limits on their own.

## Changes

### Pagination Support
- Added `pageSize` parameter to limit requests per call
- Added `pageToken` parameter for navigation between pages
- Added pagination metadata in responses (nextPageToken,
previousPageToken, startIndex, endIndex, total)

### Implementation Details
- **New utility**: `src/utils/pagination.ts` - generic pagination
function
- **Enhanced McpResponse**: Added pagination options to
`setIncludeNetworkRequests()`
- **Updated network tool**: Added pagination parameters to schema
- **Offset-based pagination**: Uses numeric tokens, handles invalid
tokens gracefully

## Testing
- Comprehensive test coverage for pagination scenarios
- Tests for first page, subsequent pages, invalid tokens, and edge cases
- All existing tests continue to pass

## Backward Compatibility
- If no pagination parameters are provided, the MCP will return all
requests (same as before)
2025-09-25 16:26:43 +02:00
Alex Rudenko 0ca2434a29 fix: forbid closing the last page (#90)
McpContext currently assumes that there is a page. Eventually we might
support closing the browser by closing the last page but right now we do
not really have responses that indicate that the browser was closed. So
this PR helps the LLM understand that it is okay to keep the last page
running (and there are platform-specific differences as to what happens
if the last page is closed).

Ref https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/87
2025-09-24 07:23:53 +00:00
Jack Franklin b877f7a305 fix: add 'on the selected page' to performance tools (#69)
To hopefully ensure the client makes sure to navigate to and select a
page before starting the trace.

Bug: 446171427
2025-09-22 17:03:26 +02:00
Sebastian Benz 0c7daa0b86 chore: refactor docs generating (#55)
* add script `npm run docs` that builds, generate docs and runs
formatter to auto fix formatting after doc generation
* rename generate-docs to docs:generate
* update presubmit workflow
* add docs process to contributing.md
2025-09-19 15:57:10 +02:00
Jack Franklin 21e175b862 feat: add performance_analyze_insight tool. (#42) 2025-09-17 12:25:40 +00:00
Alex Rudenko c663f4d7f9 feat: support script evaluate arguments (#40)
This change allows clients to pass snapshot elements as arguments.
2025-09-16 17:44:53 +02:00
Alex Rudenko 014a8bc52e feat: validate uids (#37)
- generate snapshot IDs.
- change uid to be a string.
- validate that uid is not coming from a stale snapshot.
2025-09-16 11:54:35 +00:00
Alex Rudenko 31a0bdce26 feat: initial version 2025-09-11 12:46:05 +02:00