Skip to content

Commit 0278787

Browse files
authored
Merge branch 'main' into patch-1
2 parents 21a2e5a + 25638f0 commit 0278787

43 files changed

Lines changed: 1826 additions & 273 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ Add the following config to your MCP client:
7373
> [!NOTE]
7474
> Using `chrome-devtools-mcp@latest` ensures that your MCP client will always use the latest version of the Chrome DevTools MCP server.
7575
76+
If you are intersted in doing only basic browser tasks, use the `--slim` mode:
77+
78+
```json
79+
{
80+
"mcpServers": {
81+
"chrome-devtools": {
82+
"command": "npx",
83+
"args": ["-y", "chrome-devtools-mcp@latest", "--slim", "--headless"]
84+
}
85+
}
86+
}
87+
```
88+
89+
See [Slim tool reference](./docs/slim-tool-reference.md).
90+
7691
### MCP Client configuration
7792

7893
<details>
@@ -399,14 +414,15 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
399414

400415
<!-- BEGIN AUTO GENERATED TOOLS -->
401416

402-
- **Input automation** (8 tools)
417+
- **Input automation** (9 tools)
403418
- [`click`](docs/tool-reference.md#click)
404419
- [`drag`](docs/tool-reference.md#drag)
405420
- [`fill`](docs/tool-reference.md#fill)
406421
- [`fill_form`](docs/tool-reference.md#fill_form)
407422
- [`handle_dialog`](docs/tool-reference.md#handle_dialog)
408423
- [`hover`](docs/tool-reference.md#hover)
409424
- [`press_key`](docs/tool-reference.md#press_key)
425+
- [`type_text`](docs/tool-reference.md#type_text)
410426
- [`upload_file`](docs/tool-reference.md#upload_file)
411427
- **Navigation automation** (6 tools)
412428
- [`close_page`](docs/tool-reference.md#close_page)
@@ -418,10 +434,11 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
418434
- **Emulation** (2 tools)
419435
- [`emulate`](docs/tool-reference.md#emulate)
420436
- [`resize_page`](docs/tool-reference.md#resize_page)
421-
- **Performance** (3 tools)
437+
- **Performance** (4 tools)
422438
- [`performance_analyze_insight`](docs/tool-reference.md#performance_analyze_insight)
423439
- [`performance_start_trace`](docs/tool-reference.md#performance_start_trace)
424440
- [`performance_stop_trace`](docs/tool-reference.md#performance_stop_trace)
441+
- [`take_memory_snapshot`](docs/tool-reference.md#take_memory_snapshot)
425442
- **Network** (2 tools)
426443
- [`get_network_request`](docs/tool-reference.md#get_network_request)
427444
- [`list_network_requests`](docs/tool-reference.md#list_network_requests)
@@ -532,6 +549,10 @@ The Chrome DevTools MCP server supports the following configuration option:
532549
- **Type:** boolean
533550
- **Default:** `true`
534551

552+
- **`--slim`**
553+
Exposes a "slim" set of 3 tools covering navigation, script execution and screenshots only. Useful for basic browser tasks.
554+
- **Type:** boolean
555+
535556
<!-- END AUTO GENERATED OPTIONS -->
536557

537558
Pass them via the `args` property in the JSON configuration. For example:

docs/slim-tool-reference.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->
2+
3+
# Chrome DevTools MCP Slim Tool Reference (~359 cl100k_base tokens)
4+
5+
- **[Navigation automation](#navigation-automation)** (1 tools)
6+
- [`navigate`](#navigate)
7+
- **[Debugging](#debugging)** (2 tools)
8+
- [`evaluate`](#evaluate)
9+
- [`screenshot`](#screenshot)
10+
11+
## Navigation automation
12+
13+
### `navigate`
14+
15+
**Description:** Loads a URL
16+
17+
**Parameters:**
18+
19+
- **url** (string) **(required)**: URL to [`navigate`](#navigate) to
20+
21+
---
22+
23+
## Debugging
24+
25+
### `evaluate`
26+
27+
**Description:** Evaluates a JavaScript script
28+
29+
**Parameters:**
30+
31+
- **script** (string) **(required)**: JS script to run on the page
32+
33+
---
34+
35+
### `screenshot`
36+
37+
**Description:** Takes a [`screenshot`](#screenshot)
38+
39+
**Parameters:** None
40+
41+
---

docs/tool-reference.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->
22

3-
# Chrome DevTools MCP Tool Reference (~6661 cl100k_base tokens)
3+
# Chrome DevTools MCP Tool Reference (~7094 cl100k_base tokens)
44

5-
- **[Input automation](#input-automation)** (8 tools)
5+
- **[Input automation](#input-automation)** (9 tools)
66
- [`click`](#click)
77
- [`drag`](#drag)
88
- [`fill`](#fill)
99
- [`fill_form`](#fill_form)
1010
- [`handle_dialog`](#handle_dialog)
1111
- [`hover`](#hover)
1212
- [`press_key`](#press_key)
13+
- [`type_text`](#type_text)
1314
- [`upload_file`](#upload_file)
1415
- **[Navigation automation](#navigation-automation)** (6 tools)
1516
- [`close_page`](#close_page)
@@ -21,10 +22,11 @@
2122
- **[Emulation](#emulation)** (2 tools)
2223
- [`emulate`](#emulate)
2324
- [`resize_page`](#resize_page)
24-
- **[Performance](#performance)** (3 tools)
25+
- **[Performance](#performance)** (4 tools)
2526
- [`performance_analyze_insight`](#performance_analyze_insight)
2627
- [`performance_start_trace`](#performance_start_trace)
2728
- [`performance_stop_trace`](#performance_stop_trace)
29+
- [`take_memory_snapshot`](#take_memory_snapshot)
2830
- **[Network](#network)** (2 tools)
2931
- [`get_network_request`](#get_network_request)
3032
- [`list_network_requests`](#list_network_requests)
@@ -117,6 +119,17 @@
117119

118120
---
119121

122+
### `type_text`
123+
124+
**Description:** Type text using keyboard into a previously focused input
125+
126+
**Parameters:**
127+
128+
- **text** (string) **(required)**: The text to type
129+
- **submitKey** (string) _(optional)_: Optional key to press after typing. E.g., "Enter", "Tab", "Escape"
130+
131+
---
132+
120133
### `upload_file`
121134

122135
**Description:** Upload a file through a provided element.
@@ -172,6 +185,7 @@
172185

173186
- **url** (string) **(required)**: URL to load in a new page.
174187
- **background** (boolean) _(optional)_: Whether to open the page in the background without bringing it to the front. Default is false (foreground).
188+
- **isolatedContext** (string) _(optional)_: If specified, the page is created in an isolated browser context with the given name. Pages in the same browser context share cookies and storage. Pages in different browser contexts are fully isolated.
175189
- **timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
176190

177191
---
@@ -193,7 +207,7 @@
193207

194208
**Parameters:**
195209

196-
- **text** (string) **(required)**: Text to appear on the page
210+
- **text** (array) **(required)**: Non-empty list of texts. Resolves when any value appears on the page.
197211
- **timeout** (integer) _(optional)_: Maximum wait time in milliseconds. If set to 0, the default timeout will be used.
198212

199213
---
@@ -261,6 +275,16 @@
261275

262276
---
263277

278+
### `take_memory_snapshot`
279+
280+
**Description:** Capture a memory heapsnapshot of the currently selected page to memory leak debugging
281+
282+
**Parameters:**
283+
284+
- **filePath** (string) **(required)**: A path to a .heapsnapshot file to save the heapsnapshot to.
285+
286+
---
287+
264288
## Network
265289

266290
### `get_network_request`

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"prepare": "node --experimental-strip-types scripts/prepare.ts",
2424
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts",
2525
"verify-npm-package": "node scripts/verify-npm-package.mjs",
26-
"eval": "npm run build && CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS=true node --experimental-strip-types scripts/eval_gemini.ts",
26+
"eval": "npm run build && node --experimental-strip-types scripts/eval_gemini.ts",
2727
"count-tokens": "node --experimental-strip-types scripts/count_tokens.ts"
2828
},
2929
"files": [
@@ -54,15 +54,15 @@
5454
"@types/yargs": "^17.0.33",
5555
"@typescript-eslint/eslint-plugin": "^8.43.0",
5656
"@typescript-eslint/parser": "^8.43.0",
57-
"chrome-devtools-frontend": "1.0.1583146",
57+
"chrome-devtools-frontend": "1.0.1587572",
5858
"core-js": "3.48.0",
5959
"debug": "4.4.3",
6060
"eslint": "^9.35.0",
6161
"eslint-import-resolver-typescript": "^4.4.4",
6262
"eslint-plugin-import": "^2.32.0",
6363
"globals": "^17.0.0",
6464
"prettier": "^3.6.2",
65-
"puppeteer": "24.37.4",
65+
"puppeteer": "24.37.5",
6666
"rollup": "4.58.0",
6767
"rollup-plugin-cleanup": "^3.2.1",
6868
"rollup-plugin-license": "^3.6.0",

release-please-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"extra-files": [
1919
{
2020
"type": "generic",
21-
"path": "src/main.ts"
21+
"path": "src/version.ts"
2222
},
2323
{
2424
"type": "json",

scripts/count_tokens.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
import {readFileSync} from 'node:fs';
78
import {parseArgs} from 'node:util';
89

910
import {GoogleGenAI} from '@google/genai';
@@ -16,18 +17,28 @@ const {values, positionals} = parseArgs({
1617
type: 'string',
1718
default: 'gemini-2.5-flash',
1819
},
20+
file: {
21+
type: 'string',
22+
short: 'f',
23+
},
1924
},
2025
allowPositionals: true,
2126
});
2227

23-
if (!positionals[0]) {
24-
console.error('Usage: npm run count-tokens -- -- <text>');
28+
let contents = positionals[0];
29+
30+
if (values.file) {
31+
contents = readFileSync(values.file, 'utf8');
32+
}
33+
34+
if (!contents) {
35+
console.error('Usage: npm run count-tokens -- [-f <file>] [<text>]');
2536
process.exit(1);
2637
}
2738

2839
const response = await ai.models.countTokens({
2940
model: values.model,
30-
contents: positionals[0],
41+
contents,
3142
});
32-
console.log(`Input: ${positionals[0]}`);
43+
console.log(`Input: ${values.file || positionals[0]}`);
3344
console.log(`Tokens: ${response.totalTokens}`);

scripts/eval_gemini.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import fs from 'node:fs';
88
import path from 'node:path';
9+
import {pathToFileURL} from 'node:url';
910
import {parseArgs} from 'node:util';
1011

1112
import {GoogleGenAI, mcpToTool} from '@google/genai';
@@ -35,7 +36,7 @@ export interface TestScenario {
3536
}
3637

3738
async function loadScenario(scenarioPath: string): Promise<TestScenario> {
38-
const module = await import(scenarioPath);
39+
const module = await import(pathToFileURL(scenarioPath).href);
3940
if (!module.scenario) {
4041
throw new Error(
4142
`Scenario file ${scenarioPath} does not export a 'scenario' object.`,
@@ -110,6 +111,7 @@ async function runSingleScenario(
110111
env[key] = value;
111112
}
112113
});
114+
env['CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS'] = 'true';
113115

114116
const args = [serverPath];
115117
if (!debug) {

0 commit comments

Comments
 (0)