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
26 changes: 20 additions & 6 deletions package-lock.json

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

10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@
},
"homepage": "https://github.com/ChromeDevTools/chrome-devtools-mcp#readme",
"mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
"dependencies": {
"core-js": "3.46.0",
"debug": "4.4.3",
"yargs": "18.0.0"
},
"devDependencies": {
"@eslint/js": "^9.35.0",
"@modelcontextprotocol/sdk": "1.20.1",
Expand All @@ -57,6 +52,8 @@
"@typescript-eslint/eslint-plugin": "^8.43.0",
"@typescript-eslint/parser": "^8.43.0",
"chrome-devtools-frontend": "1.0.1524741",
"core-js": "3.46.0",
"debug": "4.4.3",
"eslint": "^9.35.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",
Expand All @@ -68,7 +65,8 @@
"rollup-plugin-license": "^3.6.0",
"sinon": "^21.0.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.43.0"
"typescript-eslint": "^8.43.0",
"yargs": "18.0.0"
},
"engines": {
"node": "^20.19.0 || ^22.12.0 || >=23"
Expand Down
22 changes: 18 additions & 4 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const allowedLicenses = [
/**
* @param {string} wrapperIndexPath
* @param {import('rollup').OutputOptions} [extraOutputOptions={}]
* @param {string[]} [external=[]]
* @param {import('rollup').ExternalOption} [external=[]]
* @returns {import('rollup').RollupOptions}
*/
const bundleDependency = (
Expand Down Expand Up @@ -110,12 +110,26 @@ const bundleDependency = (
});

export default [
bundleDependency('./build/src/third_party/modelcontextprotocol-sdk/index.js'),
bundleDependency(
'./build/src/third_party/puppeteer-core/index.js',
'./build/src/third_party/index.js',
{
inlineDynamicImports: true,
},
['./bidi.js', '../bidi/bidi.js'],
(source, importer, _isResolved) => {
if (
source === 'yargs' &&
importer &&
importer.includes('puppeteer-core')
) {
return true;
}

const existingExternals = ['./bidi.js', '../bidi/bidi.js'];
if (existingExternals.includes(source)) {
return true;
}

return false;
},
),
];
2 changes: 1 addition & 1 deletion src/DevToolsConnectionAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import {Connection} from '../node_modules/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js';

import {type ConnectionTransport} from './third_party/puppeteer-core/index.js';
import {type ConnectionTransport} from './third_party/index.js';

/**
* Allows a puppeteer {@link ConnectionTransport} to act like a DevTools {@link Connection}.
Expand Down
7 changes: 3 additions & 4 deletions src/McpContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,20 @@ import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';

import type {Debugger} from 'debug';

import type {ListenerMap} from './PageCollector.js';
import {NetworkCollector, PageCollector} from './PageCollector.js';
import {Locator} from './third_party/puppeteer-core/index.js';
import {Locator} from './third_party/index.js';
import type {
Browser,
ConsoleMessage,
Debugger,
Dialog,
ElementHandle,
HTTPRequest,
Page,
SerializedAXNode,
PredefinedNetworkConditions,
} from './third_party/puppeteer-core/index.js';
} from './third_party/index.js';
import {listPages} from './tools/pages.js';
import {takeSnapshot} from './tools/snapshot.js';
import {CLOSE_PAGE_ERROR} from './tools/ToolDefinition.js';
Expand Down
8 changes: 3 additions & 5 deletions src/McpResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ import {
} from './formatters/networkFormatter.js';
import {formatA11ySnapshot} from './formatters/snapshotFormatter.js';
import type {McpContext} from './McpContext.js';
import type {
ImageContent,
TextContent,
} from './third_party/modelcontextprotocol-sdk/index.js';
import type {
ConsoleMessage,
ImageContent,
ResourceType,
} from './third_party/puppeteer-core/index.js';
TextContent,
} from './third_party/index.js';
import {handleDialog} from './tools/pages.js';
import type {ImageContentData, Response} from './tools/ToolDefinition.js';
import {paginate} from './utils/pagination.js';
Expand Down
2 changes: 1 addition & 1 deletion src/PageCollector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
type HTTPRequest,
type Page,
type PageEvents,
} from './third_party/puppeteer-core/index.js';
} from './third_party/index.js';

export type ListenerMap<EventMap extends PageEvents = PageEvents> = {
[K in keyof EventMap]?: (event: EventMap[K]) => void;
Expand Down
4 changes: 1 addition & 3 deletions src/WaitForHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {CdpPage} from 'puppeteer-core/internal/cdp/Page.js';

import {logger} from './logger.js';
import type {Page, Protocol} from './third_party/puppeteer-core/index.js';
import type {Page, Protocol, CdpPage} from './third_party/index.js';

export class WaitForHelper {
#abortController = new AbortController();
Expand Down
4 changes: 2 additions & 2 deletions src/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import type {
ChromeReleaseChannel,
LaunchOptions,
Target,
} from './third_party/puppeteer-core/index.js';
import {puppeteer} from './third_party/puppeteer-core/index.js';
} from './third_party/index.js';
import {puppeteer} from './third_party/index.js';

let browser: Browser | undefined;

Expand Down
5 changes: 2 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/

import type {Options as YargsOptions} from 'yargs';
import yargs from 'yargs';
import {hideBin} from 'yargs/helpers';
import type {YargsOptions} from './third_party/index.js';
import {yargs, hideBin} from './third_party/index.js';

export const cliOptions = {
browserUrl: {
Expand Down
5 changes: 1 addition & 4 deletions src/formatters/networkFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

import {isUtf8} from 'node:buffer';

import type {
HTTPRequest,
HTTPResponse,
} from '../third_party/puppeteer-core/index.js';
import type {HTTPRequest, HTTPResponse} from '../third_party/index.js';

const BODY_CONTEXT_SIZE_LIMIT = 10000;

Expand Down
2 changes: 1 addition & 1 deletion src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
import fs from 'node:fs';

import debug from 'debug';
import {debug} from './third_party/index.js';

const mcpDebugNamespace = 'mcp:log';

Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
StdioServerTransport,
type CallToolResult,
SetLevelRequestSchema,
} from './third_party/modelcontextprotocol-sdk/index.js';
} from './third_party/index.js';
import * as consoleTools from './tools/console.js';
import * as emulationTools from './tools/emulation.js';
import * as inputTools from './tools/input.js';
Expand Down
4 changes: 2 additions & 2 deletions src/polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* SPDX-License-Identifier: Apache-2.0
*/

import 'core-js/modules/es.promise.with-resolvers.js';
import 'core-js/proposals/iterator-helpers.js';
// polyfills are now bundled with all other dependencies
import './third_party/index.js';
26 changes: 26 additions & 0 deletions src/third_party/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import 'core-js/modules/es.promise.with-resolvers.js';
import 'core-js/proposals/iterator-helpers.js';

export type {Options as YargsOptions} from 'yargs';
export {default as yargs} from 'yargs';
export {hideBin} from 'yargs/helpers';
export {debug} from 'debug';
export type {Debugger} from 'debug';
export {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js';
export {StdioServerTransport} from '@modelcontextprotocol/sdk/server/stdio.js';
export {
type CallToolResult,
SetLevelRequestSchema,
type ImageContent,
type TextContent,
} from '@modelcontextprotocol/sdk/types.js';
export {z as zod} from 'zod';
export {Locator, PredefinedNetworkConditions} from 'puppeteer-core';
export {default as puppeteer} from 'puppeteer-core';
export type * from 'puppeteer-core';
export type {CdpPage} from 'puppeteer-core/internal/cdp/Page.js';
Loading