Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- windows-latest
- macos-latest
node:
- 22.12.0
- 20
- 22
- 23
- 24
Expand All @@ -34,19 +34,34 @@ jobs:
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
cache: npm
node-version: ${{ matrix.node }}
node-version: 22 # build works only with 22+.

- name: Install dependencies
shell: bash
run: npm ci

- name: Build
run: npm run build

- name: Set up Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
cache: npm
node-version: ${{ matrix.node }}

- name: Disable AppArmor
if: ${{ matrix.os == 'ubuntu-latest' }}
shell: bash
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns

- name: Run tests (node20)
if: ${{ matrix.node == '20' }}
shell: bash
run: npm run test:node20

- name: Run tests
shell: bash
if: ${{ matrix.node != '20' }}
run: npm run test

# Gating job for branch protection.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ MCP clients.

## Requirements

- [Node.js 22.12.0](https://nodejs.org/) or newer.
- [Node.js 20](https://nodejs.org/) or a newer [latest maintainance LTS](https://github.com/nodejs/Release#release-schedule) version.
- [Chrome](https://www.google.com/chrome/) current stable version or newer.
- [npm](https://www.npmjs.com/).

Expand Down
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"docs:generate": "node --experimental-strip-types scripts/generate-docs.ts",
"start": "npm run build && node build/src/index.js",
"start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/index.js",
"test:node20": "node --require ./build/tests/setup.js --test-reporter spec --test-force-exit --test build/tests",
"test": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test \"build/tests/**/*.test.js\"",
"test:only": "npm run build && node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
"test:only:no-build": "node --require ./build/tests/setup.js --no-warnings=ExperimentalWarning --test-reporter spec --test-force-exit --test --test-only \"build/tests/**/*.test.js\"",
Expand All @@ -37,6 +38,7 @@
"mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
"dependencies": {
"@modelcontextprotocol/sdk": "1.18.2",
"core-js": "3.45.1",
"debug": "4.4.3",
"puppeteer-core": "24.22.3",
"yargs": "18.0.0"
Expand All @@ -53,14 +55,14 @@
"@typescript-eslint/parser": "^8.43.0",
"chrome-devtools-frontend": "1.0.1520535",
"eslint": "^9.35.0",
"eslint-plugin-import": "^2.32.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
"globals": "^16.4.0",
"prettier": "^3.6.2",
"puppeteer": "24.22.3",
"sinon": "^21.0.0",
"typescript-eslint": "^8.43.0",
"typescript": "^5.9.2"
"typescript": "^5.9.2",
"typescript-eslint": "^8.43.0"
},
"engines": {
"node": ">=22.12.0"
Expand Down
11 changes: 9 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ import {version} from 'node:process';

const [major, minor] = version.substring(1).split('.').map(Number);

if (major < 22 || (major === 22 && minor < 12)) {
if (major === 22 && minor < 12) {
console.error(
`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 22.12.0 or newer.`,
`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 22.12.0 LTS or a newer LTS.`,
);
process.exit(1);
}

if (major < 20) {
console.error(
`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20 LTS or a newer LTS.`,
);
process.exit(1);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import './polyfill.js';

import assert from 'node:assert';
import fs from 'node:fs';
import path from 'node:path';
Expand Down
8 changes: 8 additions & 0 deletions src/polyfill.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @license
* Copyright 2025 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/

import 'core-js/modules/es.promise.with-resolvers.js';
import 'core-js/proposals/iterator-helpers.js';
2 changes: 2 additions & 0 deletions tests/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import '../src/polyfill.js';

import path from 'node:path';
import {it} from 'node:test';

Expand Down
1 change: 0 additions & 1 deletion tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import logger from 'debug';
import type {Browser} from 'puppeteer';
import puppeteer from 'puppeteer';
Expand Down
Loading