文件历史

提交图

40 次代码提交

作者 SHA1 备注 提交日期
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
Nikolay Vitkov 0412878bf5 fix: PageCollector subscribing multiple times (#241)
We were setting the storage inside the first collect callback which mean
that we double subscribed to the events.

This affected Network request and Console messages
2025-10-01 16:33:55 +02:00
Nikolay Vitkov 73f0aecd8a fix(network): show only selected request (#236) 2025-10-01 14:12:41 +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
Alex Rudenko ef61a08707 feat: support initial viewport in the CLI (#229)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/165

This PR uses page_resize logic to set the initial viewport size. Not
using the emulation because it looks buggy in headful which is our
default mode.
2025-10-01 10:11:35 +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
Alina Varkki ce356f2565 fix: snapshot does not capture Iframe content (#217)
Closes: #186
2025-09-30 09:38:08 +02:00
Alex Rudenko 205eef5cdf fix: reference to handle_dialog tool (#209) 2025-09-29 14:12:05 +00:00
Alex Rudenko d9f77f8509 fix: do not error if the dialog was already handled (#208)
users report that the MCP client gets stuck if the dialog was closed
manually as the MCP state never updates.
2025-09-29 13:53:25 +00:00
Alex Rudenko 13613b4a33 fix: support node20 (#52)
Initially, we started with the support of Node22+ but since Node20 is an
LTS that is still in the maintenance mode it makes sense to support it.
2025-09-29 13:43:35 +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 869dd4273e fix: add data format information to trace summary (#166)
This CL adds the descriptions of the call frame format and the network
request format to the summary so that as the AI sees these responses it
can fully parse them.
2025-09-26 14:12:00 +01:00
Jack Franklin 2dbdd2de4f chore: roll latest chrome-devtools-frontend (#163)
This includes a better fix for the circular dependency problem and makes
the changes in the MCP server based on the upstream DevTools
implementation changes.
2025-09-26 09:44:03 +01:00
Alex Rudenko 03b59f0bca fix: do not set channel if executablePath is provided (#150)
Fixes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/148
2025-09-25 18:44:31 +02:00
Jack Franklin b2e1e3944c fix: roll latest DevTools to handle Insight errors (#149)
This commit updates DevTools to the latest release. This most
importantly includes a fix for #124 and other reported issues where
Insights that were actually errors were not handled correctly. They are
now formatted correctly on the DevTools side and now will not break
performance traces in the MCP server.
2025-09-25 18:25:35 +02:00
Nikolay Vitkov 15277541d8 chore: add additional EsLint rule (#147) 2025-09-25 17:20:01 +02: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 44cfc8f945 fix: avoid reporting page close errors as errors (#127)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/125
2025-09-25 10:40:51 +00:00
Alex Rudenko adfcecf987 fix: validate and report incompatible Node versions (#113)
Ref https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/92
2025-09-24 14:45:27 +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
Alex Rudenko 1a4ba4d3e0 fix: add a message indicating that no console messages exist (#91)
To avoid clients being confused about the lack of console messages.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/87
2025-09-23 22:10:46 +02:00
Alex Rudenko 9c8da4a449 test: use cft for e2e tests (#80)
we were using the Chrome version pre-installed on the GitHub actions and
I wonder if it could have been the source for the flakiness.
2025-09-23 19:53:33 +02:00
Alex Rudenko 92046183d4 chore(deps): bump puppeteer (#79)
Contains fixes for the pipe transport.
2025-09-23 17:01:19 +00:00
Alex Rudenko 74fa209145 test: skip flaky test (#77) 2025-09-23 14:03:44 +00:00
Jack Franklin e8fb30c1bf fix: rework performance parsing & error handling (#75)
This PR tidies up the code around performance parsing and what we
respond with from our tools. It introduces the ability to have no
Insights from a trace (relatively rare, but can happen), and also adds
more information to the output in the event that something went wrong.

Previously we just logged errors, but if we respond with them here that
will also help users report issues and increase the chances that we can
debug them.
2025-09-23 15:42:35 +02:00
Nikolay Vitkov 0208bfdcf6 fix: expose timeout when Emulation is enabled (#73)
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
2025-09-23 11:17:53 +02:00
Alex Rudenko 91d83c4190 test: fix shell for windows tests (#72) 2025-09-23 09:37:22 +02:00
Nikolay Vitkov c509c64576 fix: increase timeouts in case of Emulation (#71) 2025-09-22 18:13:49 +02:00
Alex Rudenko a9cf9d77f7 test: await dialog dismiss to prevent async activity errors (#70) 2025-09-22 17:11:04 +02:00
Nikolay Vitkov 1e8662f068 fix(emulation): correctly report info for selected page (#63)
Previously if one page was setting emulation all were reporting it.
2025-09-22 16:03:47 +02:00
Jack Franklin b830b436f9 chore: roll devtools-frontend and update snapshots (#59) 2025-09-22 09:29:21 +00:00
Jack Franklin 21e175b862 feat: add performance_analyze_insight tool. (#42) 2025-09-17 12:25:40 +00:00
Jack Franklin 0cb6147b87 feat: use Performance Trace Formatter in trace output (#36)
Note: this will error until a chrome-devtools-frontend with this change

https://chromiumdash.appspot.com/commit/62e1652b2bf044ec53a2ec212cf53b1a62bc357e
is released on npm.
2025-09-16 17:07:58 +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 3fcea791eb chore: roll puppeteer (#25)
This should solve flakiness related to multiple browser instances.
2025-09-15 16:12:13 +02:00
Alex Rudenko e5e0616433 chore: switch to spec and clean up deps (#17) 2025-09-15 11:18:32 +02:00
Alex Rudenko 732267db5f fix: detect multiple instances and throw (#12)
We should be checking for browser logs in Puppeteer instead.
2025-09-11 16:42:27 +02:00
Alex Rudenko 31a0bdce26 feat: initial version 2025-09-11 12:46:05 +02:00