Skip to content
Open
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,11 @@ The Chrome DevTools MCP server supports the following configuration option:
- **Type:** boolean
- **Default:** `true`

- **`--sourceMaps`/ `--source-maps`**
Whether to enable source maps in DevTools. Use --no-source-maps to disable.
- **Type:** boolean
- **Default:** `true`

- **`--screenshotFormat`/ `--screenshot-format`**
Override the default output format used by take_screenshot when the caller does not specify one. JPEG and WebP are ~3-5x smaller than PNG, which helps reduce context size in AI conversations. Unset preserves the existing default ("png").
- **Type:** string
Expand Down
3 changes: 3 additions & 0 deletions src/McpContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ interface McpContextOptions {
experimentalIncludeAllPages?: boolean;
// Whether CrUX data should be fetched.
performanceCrux: boolean;
// Whether source maps are enabled in DevTools.
sourceMaps?: boolean;
// The allow list of URL patterns to allow loading resources.
allowList?: string[];
// The block list of URL patterns to block loading resources.
Expand Down Expand Up @@ -556,6 +558,7 @@ export class McpContext implements Context {
page.browserContext(),
),
navigationTimeout: this.#options.navigationTimeout,
sourceMaps: this.#options.sourceMaps,
});
this.#mcpPages.set(page, mcpPage);
await mcpPage.init();
Expand Down
7 changes: 6 additions & 1 deletion src/McpPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export class McpPage implements ContextPage {
#hasNetworkBlockOrAllowlist: boolean;
#locatorClass: typeof Locator;
#navigationTimeout: number;
#sourceMaps: boolean;

constructor(
page: Page,
Expand All @@ -147,11 +148,13 @@ export class McpPage implements ContextPage {
locatorClass: typeof Locator;
isolatedContextName?: string;
navigationTimeout?: number;
sourceMaps?: boolean;
},
) {
this.#hasNetworkBlockOrAllowlist = options.hasNetworkBlockOrAllowlist;
this.#locatorClass = options.locatorClass;
this.#navigationTimeout = options.navigationTimeout ?? NAVIGATION_TIMEOUT;
this.#sourceMaps = options.sourceMaps ?? true;
this.pptrPage = page;
this.id = id;
this.isolatedContextName = options.isolatedContextName;
Expand Down Expand Up @@ -196,7 +199,9 @@ export class McpPage implements ContextPage {
}
try {
const session = await this.pptrPage.createCDPSession();
this.#devtoolsUniverse = await createTargetUniverse(session);
this.#devtoolsUniverse = await createTargetUniverse(session, {
sourceMaps: this.#sourceMaps,
});
} catch (e) {
logger?.('Failed to initialize DevTools universe', e);
}
Expand Down
7 changes: 7 additions & 0 deletions src/config/mcp-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ export const mcpOptions = {
describe:
'Set to false to opt-out of usage statistics collection. Google collects usage data to improve the tool, handled under the Google Privacy Policy (https://policies.google.com/privacy). This is independent from Chrome browser metrics. Disabled if `CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS` or `CI` env variables are set.',
},
sourceMaps: {
type: 'boolean',
default: true,
describe:
'Whether to enable source maps in DevTools. Use --no-source-maps to disable.',
},
clearcutEndpoint: {
type: 'string',
hidden: true,
Expand Down Expand Up @@ -538,6 +544,7 @@ export function parser(
'$0 --no-performance-crux',
'Disable CrUX (field data) integration in performance tools.',
],
['$0 --no-source-maps', 'Disable source maps in DevTools.'],
[
'$0 --slim',
'Only 3 tools: navigation, JavaScript execution and screenshot',
Expand Down
16 changes: 16 additions & 0 deletions src/devtools/DevtoolsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,13 @@
session: CDPSession;
}

export interface CreateTargetUniverseOptions {
sourceMaps?: boolean;
}

export async function createTargetUniverse(
session: CDPSession,
options?: CreateTargetUniverseOptions,
): Promise<TargetUniverse> {
const settingStorage = new DevTools.Common.Settings.SettingsStorage({});
const universe = new DevTools.Foundation.Universe.Universe({
Expand All @@ -156,6 +161,17 @@
supportsEmulation: false,
});

const sourceMaps = options?.sourceMaps ?? true;
const jsSourceMapsSetting = universe.settings.resolve(
DevTools.SDKSettings.jsSourceMapsEnabledSettingDescriptor,

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Check for memory leaks

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / [Required] Check docs updated

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 166 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.
);
jsSourceMapsSetting.set(sourceMaps);

const cssSourceMapsSetting = universe.settings.resolve(
DevTools.SDKSettings.cssSourceMapsEnabledSettingDescriptor,

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Check for memory leaks

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / [Required] Check docs updated

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in src/devtools/DevtoolsUtils.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.
);
cssSourceMapsSetting.set(sourceMaps);

const setting = universe.settings.resolve(
DevTools.SourceMapManager.lazyLoadingSettingDescriptor,
);
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export async function createMcpServer(
experimentalDevToolsDebugging: devtools,
experimentalIncludeAllPages: serverArgs.experimentalIncludeAllPages,
performanceCrux: serverArgs.performanceCrux,
sourceMaps: serverArgs.sourceMaps,
allowList: allowlist,
blocklist: blocklist,
allowUnrestrictedPaths: serverArgs.allowUnrestrictedPaths,
Expand Down
8 changes: 8 additions & 0 deletions src/telemetry/flag_usage_metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,13 @@
{
"name": "page_id_routing",
"flagType": "boolean"
},
{
"name": "source_maps_present",
"flagType": "boolean"
},
{
"name": "source_maps",
"flagType": "boolean"
}
]
15 changes: 15 additions & 0 deletions tests/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('cli args parsing', () => {
memoryDebugging: false,
experimentalStructuredContent: false,
pageIdRouting: true,
sourceMaps: true,
};

it('parses with default args', async () => {
Expand Down Expand Up @@ -338,4 +339,18 @@ describe('cli args parsing', () => {
'https://b.com/*',
]);
});

it('parses source-maps flag', async () => {
const defaultParsed = parseArguments(['main.js']);
assert.strictEqual(defaultParsed.sourceMaps, true);

const disabledArgs = parseArguments(['--no-source-maps']);
assert.strictEqual(disabledArgs.sourceMaps, false);

const explicitFalseArgs = parseArguments(['--source-maps=false']);
assert.strictEqual(explicitFalseArgs.sourceMaps, false);

const explicitTrueArgs = parseArguments(['--source-maps=true']);
assert.strictEqual(explicitTrueArgs.sourceMaps, true);
});
});
45 changes: 45 additions & 0 deletions tests/devtools/DevtoolsUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,51 @@
);
});
});

it('enables source maps by default', async () => {
await withBrowser(async (browser, page) => {
const targetUniverse = await createTargetUniverse(
await page.createCDPSession(),
);
assert.ok(targetUniverse);

assert.strictEqual(
targetUniverse.universe.settings
.resolve(DevTools.SDKSettings.jsSourceMapsEnabledSettingDescriptor)

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Check for memory leaks

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / [Required] Check docs updated

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 165 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.
.get(),
true,
);
assert.strictEqual(
targetUniverse.universe.settings
.resolve(DevTools.SDKSettings.cssSourceMapsEnabledSettingDescriptor)

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Check for memory leaks

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / [Required] Check docs updated

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 171 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.
.get(),
true,
);
});
});

it('disables source maps when sourceMaps is false', async () => {
await withBrowser(async (browser, page) => {
const targetUniverse = await createTargetUniverse(
await page.createCDPSession(),
{sourceMaps: false},
);
assert.ok(targetUniverse);

assert.strictEqual(
targetUniverse.universe.settings
.resolve(DevTools.SDKSettings.jsSourceMapsEnabledSettingDescriptor)

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Check for memory leaks

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / [Required] Check docs updated

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 188 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.
.get(),
false,
);
assert.strictEqual(
targetUniverse.universe.settings
.resolve(DevTools.SDKSettings.cssSourceMapsEnabledSettingDescriptor)

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Check for memory leaks

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on ubuntu-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / [Required] Check docs updated

Property 'SDKSettings' does not exist on type 'typeof import("/home/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on macos-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("/Users/runner/work/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 24

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 22

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.

Check failure on line 194 in tests/devtools/DevtoolsUtils.test.ts

View workflow job for this annotation

GitHub Actions / Tests on windows-latest with node 26

Property 'SDKSettings' does not exist on type 'typeof import("D:/a/chrome-devtools-mcp/chrome-devtools-mcp/third_party/devtools-frontend/mcp/mcp")'.
.get(),
false,
);
});
});
});

describe('SymbolizedError', () => {
Expand Down
33 changes: 33 additions & 0 deletions tests/tools/console.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,39 @@ describe('console', () => {
});
});

it('does not apply source maps when sourceMaps is false', async () => {
server.addRoute('/main.min.js', (_req, res) => {
res.setHeader('Content-Type', 'text/javascript');
res.statusCode = 200;
res.end(`function n(){throw new Error("b00m!")}function o(){n()}(function n(){o()})();
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJiYXIiLCJFcnJvciIsImZvbyIsIklpZmUiXSwic291cmNlcyI6WyIuL21haW4uanMiXSwic291cmNlc0NvbnRlbnQiOlsiXG5mdW5jdGlvbiBiYXIoKSB7XG4gIHRocm93IG5ldyBFcnJvcignYjAwbSEnKTtcbn1cblxuZnVuY3Rpb24gZm9vKCkge1xuICBiYXIoKTtcbn1cblxuKGZ1bmN0aW9uIElpZmUoKSB7XG4gIGZvbygpO1xufSkoKTtcblxuIl0sIm1hcHBpbmdzIjoiQUFDQSxTQUFTQSxJQUNQLE1BQU0sSUFBSUMsTUFBTSxRQUNsQixDQUVBLFNBQVNDLElBQ1BGLEdBQ0YsRUFFQSxTQUFVRyxJQUNSRCxHQUNELEVBRkQiLCJpZ25vcmVMaXN0IjpbXX0=
`);
});
server.addHtmlRoute(
'/index.html',
`<script src="${server.getRoute('/main.min.js')}"></script>`,
);

await withMcpContext(
async (response, context) => {
const page = context.getSelectedMcpPage();
await page.pptrPage.goto(server.getRoute('/index.html'));

await getConsoleMessage.handler(
{params: {msgid: 1}, page: context.getSelectedMcpPage()},
response,
context,
);
const formattedResponse = await response.handle(context);
const rawText = getTextContent(formattedResponse.content[0]);

assert.ok(rawText.includes('main.min.js'));
assert.ok(!rawText.includes('main.js'));
},
{sourceMaps: false},
);
});

it('ignores frames from ignore listed URLs', async t => {
server.addHtmlRoute(
'/index.html',
Expand Down
2 changes: 2 additions & 0 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export async function withMcpContext(
debug?: boolean;
autoOpenDevTools?: boolean;
performanceCrux?: boolean;
sourceMaps?: boolean;
executablePath?: string;
args?: string[];
blockedUrlPattern?: string[];
Expand All @@ -181,6 +182,7 @@ export async function withMcpContext(
{
experimentalDevToolsDebugging: false,
performanceCrux: options.performanceCrux ?? true,
sourceMaps: options.sourceMaps ?? true,
allowList: options.allowedUrlPattern,
blocklist: options.blockedUrlPattern,
allowUnrestrictedPaths: options.allowUnrestrictedPaths ?? false,
Expand Down
Loading