Skip to content

Chrome DevTools for coding agents

refactor: move main files (#1120)

Alex Rudenkoc2d8009ff75f
diff --git a/package.json b/package.json
index b8feb89f..10b7bbc7 100644
--- a/package.json
+++ b/package.json
@@ -3,8 +3,8 @@
"version": "0.19.0",
"description": "MCP server for Chrome DevTools",
"type": "module",
- "bin": "./build/src/index.js",
- "main": "./build/src/server.js",
+ "bin": "./build/src/bin/chrome-devtools-mcp.js",
+ "main": "./build/src/index.js",
"scripts": {
"cli:generate": "node --experimental-strip-types scripts/generate-cli.ts",
"clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
diff --git a/scripts/generate-cli.ts b/scripts/generate-cli.ts
index 297a473e..c8c0dc52 100644
--- a/scripts/generate-cli.ts
+++ b/scripts/generate-cli.ts
@@ -10,7 +10,7 @@ import path from 'node:path';
import {Client} from '@modelcontextprotocol/sdk/client/index.js';
import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js';
-import {parseArguments} from '../build/src/cli.js';
+import {parseArguments} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
import {labels} from '../build/src/tools/categories.js';
import {createTools} from '../build/src/tools/tools.js';
@@ -22,7 +22,10 @@ const OUTPUT_PATH = path.join(
async function fetchTools() {
console.log('Connecting to chrome-devtools-mcp to fetch tools...');
// Use the local build of the server
- const serverPath = path.join(import.meta.dirname, '../build/src/index.js');
+ const serverPath = path.join(
+ import.meta.dirname,
+ '../build/src/bin/chrome-devtools-mcp.js',
+ );
const transport = new StdioClientTransport({
command: 'node',
diff --git a/scripts/generate-docs.ts b/scripts/generate-docs.ts
index c2e5da7c..280c0e33 100644
--- a/scripts/generate-docs.ts
+++ b/scripts/generate-docs.ts
@@ -11,8 +11,8 @@ import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js';
import type {Tool} from '@modelcontextprotocol/sdk/types.js';
import {get_encoding} from 'tiktoken';
-import {cliOptions} from '../build/src/cli.js';
-import type {ParsedArguments} from '../build/src/cli.js';
+import {cliOptions} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
+import type {ParsedArguments} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
import {ToolCategory, labels} from '../build/src/tools/categories.js';
import {createTools} from '../build/src/tools/tools.js';
@@ -24,7 +24,7 @@ async function measureServer(args: string[]) {
// 1. Connect to your actual MCP server
const transport = new StdioClientTransport({
command: 'node',
- args: ['./build/src/index.js', ...args], // Point to your built MCP server
+ args: ['./build/src/bin/chrome-devtools-mcp.js', ...args], // Point to your built MCP server
});
const client = new Client(
diff --git a/src/McpResponse.ts b/src/McpResponse.ts
index b1b2cef3..b6162c27 100644
--- a/src/McpResponse.ts
+++ b/src/McpResponse.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import type {ParsedArguments} from './cli.js';
+import type {ParsedArguments} from './bin/chrome-devtools-mcp-cli-options.js';
import {ConsoleFormatter} from './formatters/ConsoleFormatter.js';
import {IssueFormatter} from './formatters/IssueFormatter.js';
import {NetworkFormatter} from './formatters/NetworkFormatter.js';
diff --git a/src/bin/chrome-devtools-cli-options.ts b/src/bin/chrome-devtools-cli-options.ts
new file mode 100644
index 00000000..6e317a33
--- /dev/null
+++ b/src/bin/chrome-devtools-cli-options.ts
@@ -0,0 +1,745 @@
+/**
+ * @license
+ * Copyright 2026 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+// NOTE: do not edit manually. Auto-generated by 'npm run cli:generate'.
+
+export interface ArgDef {
+ name: string;
+ type: string;
+ description: string;
+ required: boolean;
+ default?: string | number | boolean;
+ enum?: ReadonlyArray<string | number>;
+}
+export type Commands = Record<
+ string,
+ {
+ description: string;
+ category: string;
+ args: Record<string, ArgDef>;
+ }
+>;
+export const commands: Commands = {
+ click: {
+ description: 'Clicks on the provided element',
+ category: 'Input automation',
+ args: {
+ uid: {
+ name: 'uid',
+ type: 'string',
+ description:
+ 'The uid of an element on the page from the page content snapshot',
+ required: true,
+ },
+ dblClick: {
+ name: 'dblClick',
+ type: 'boolean',
+ description: 'Set to true for double clicks. Default is false.',
+ required: false,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ close_page: {
+ description:
+ 'Closes the page by its index. The last open page cannot be closed.',
+ category: 'Navigation automation',
+ args: {
+ pageId: {
+ name: 'pageId',
+ type: 'number',
+ description:
+ 'The ID of the page to close. Call list_pages to list pages.',
+ required: true,
+ },
+ },
+ },
+ drag: {
+ description: 'Drag an element onto another element',
+ category: 'Input automation',
+ args: {
+ from_uid: {
+ name: 'from_uid',
+ type: 'string',
+ description: 'The uid of the element to drag',
+ required: true,
+ },
+ to_uid: {
+ name: 'to_uid',
+ type: 'string',
+ description: 'The uid of the element to drop into',
+ required: true,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ emulate: {
+ description: 'Emulates various features on the selected page.',
+ category: 'Emulation',
+ args: {
+ networkConditions: {
+ name: 'networkConditions',
+ type: 'string',
+ description: 'Throttle network. Omit to disable throttling.',
+ required: false,
+ enum: ['Offline', 'Slow 3G', 'Fast 3G', 'Slow 4G', 'Fast 4G'],
+ },
+ cpuThrottlingRate: {
+ name: 'cpuThrottlingRate',
+ type: 'number',
+ description:
+ 'Represents the CPU slowdown factor. Omit or set the rate to 1 to disable throttling',
+ required: false,
+ },
+ geolocation: {
+ name: 'geolocation',
+ type: 'string',
+ description:
+ 'Geolocation (`<latitude>x<longitude>`) to emulate. Latitude between -90 and 90. Longitude between -180 and 180. Omit clear the geolocation override.',
+ required: false,
+ },
+ userAgent: {
+ name: 'userAgent',
+ type: 'string',
+ description:
+ 'User agent to emulate. Set to empty string to clear the user agent override.',
+ required: false,
+ },
+ colorScheme: {
+ name: 'colorScheme',
+ type: 'string',
+ description:
+ 'Emulate the dark or the light mode. Set to "auto" to reset to the default.',
+ required: false,
+ enum: ['dark', 'light', 'auto'],
+ },
+ viewport: {
+ name: 'viewport',
+ type: 'string',
+ description:
+ "Emulate device viewports '<width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.",
+ required: false,
+ },
+ },
+ },
+ evaluate_script: {
+ description:
+ 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,\nso returned values have to be JSON-serializable.',
+ category: 'Debugging',
+ args: {
+ function: {
+ name: 'function',
+ type: 'string',
+ description:
+ 'A JavaScript function declaration to be executed by the tool in the currently selected page.\nExample without arguments: `() => {\n return document.title\n}` or `async () => {\n return await fetch("example.com")\n}`.\nExample with arguments: `(el) => {\n return el.innerText;\n}`\n',
+ required: true,
+ },
+ args: {
+ name: 'args',
+ type: 'array',
+ description: 'An optional list of arguments to pass to the function.',
+ required: false,
+ },
+ },
+ },
+ fill: {
+ description:
+ 'Type text into a input, text area or select an option from a <select> element.',
+ category: 'Input automation',
+ args: {
+ uid: {
+ name: 'uid',
+ type: 'string',
+ description:
+ 'The uid of an element on the page from the page content snapshot',
+ required: true,
+ },
+ value: {
+ name: 'value',
+ type: 'string',
+ description: 'The value to fill in',
+ required: true,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ fill_form: {
+ description: 'Fill out multiple form elements at once',
+ category: 'Input automation',
+ args: {
+ elements: {
+ name: 'elements',
+ type: 'array',
+ description: 'Elements from snapshot to fill out.',
+ required: true,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ get_console_message: {
+ description:
+ 'Gets a console message by its ID. You can get all messages by calling list_console_messages.',
+ category: 'Debugging',
+ args: {
+ msgid: {
+ name: 'msgid',
+ type: 'number',
+ description:
+ 'The msgid of a console message on the page from the listed console messages',
+ required: true,
+ },
+ },
+ },
+ get_network_request: {
+ description:
+ 'Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.',
+ category: 'Network',
+ args: {
+ reqid: {
+ name: 'reqid',
+ type: 'number',
+ description:
+ 'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.',
+ required: false,
+ },
+ requestFilePath: {
+ name: 'requestFilePath',
+ type: 'string',
+ description:
+ 'The absolute or relative path to save the request body to. If omitted, the body is returned inline.',
+ required: false,
+ },
+ responseFilePath: {
+ name: 'responseFilePath',
+ type: 'string',
+ description:
+ 'The absolute or relative path to save the response body to. If omitted, the body is returned inline.',
+ required: false,
+ },
+ },
+ },
+ handle_dialog: {
+ description:
+ 'If a browser dialog was opened, use this command to handle it',
+ category: 'Input automation',
+ args: {
+ action: {
+ name: 'action',
+ type: 'string',
+ description: 'Whether to dismiss or accept the dialog',
+ required: true,
+ enum: ['accept', 'dismiss'],
+ },
+ promptText: {
+ name: 'promptText',
+ type: 'string',
+ description: 'Optional prompt text to enter into the dialog.',
+ required: false,
+ },
+ },
+ },
+ hover: {
+ description: 'Hover over the provided element',
+ category: 'Input automation',
+ args: {
+ uid: {
+ name: 'uid',
+ type: 'string',
+ description:
+ 'The uid of an element on the page from the page content snapshot',
+ required: true,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ lighthouse_audit: {
+ description:
+ 'Get Lighthouse score and reports for accessibility, SEO and best practices. This excludes performance. For performance audits, run performance_start_trace',
+ category: 'Debugging',
+ args: {
+ mode: {
+ name: 'mode',
+ type: 'string',
+ description:
+ '"navigation" reloads & audits. "snapshot" analyzes current state.',
+ required: false,
+ default: 'navigation',
+ enum: ['navigation', 'snapshot'],
+ },
+ device: {
+ name: 'device',
+ type: 'string',
+ description: 'Device to emulate.',
+ required: false,
+ default: 'desktop',
+ enum: ['desktop', 'mobile'],
+ },
+ outputDirPath: {
+ name: 'outputDirPath',
+ type: 'string',
+ description: 'Directory for reports. If omitted, uses temporary files.',
+ required: false,
+ },
+ },
+ },
+ list_console_messages: {
+ description:
+ 'List all console messages for the currently selected page since the last navigation.',
+ category: 'Debugging',
+ args: {
+ pageSize: {
+ name: 'pageSize',
+ type: 'integer',
+ description:
+ 'Maximum number of messages to return. When omitted, returns all requests.',
+ required: false,
+ },
+ pageIdx: {
+ name: 'pageIdx',
+ type: 'integer',
+ description:
+ 'Page number to return (0-based). When omitted, returns the first page.',
+ required: false,
+ },
+ types: {
+ name: 'types',
+ type: 'array',
+ description:
+ 'Filter messages to only return messages of the specified resource types. When omitted or empty, returns all messages.',
+ required: false,
+ },
+ includePreservedMessages: {
+ name: 'includePreservedMessages',
+ type: 'boolean',
+ description:
+ 'Set to true to return the preserved messages over the last 3 navigations.',
+ required: false,
+ default: false,
+ },
+ },
+ },
+ list_network_requests: {
+ description:
+ 'List all requests for the currently selected page since the last navigation.',
+ category: 'Network',
+ args: {
+ pageSize: {
+ name: 'pageSize',
+ type: 'integer',
+ description:
+ 'Maximum number of requests to return. When omitted, returns all requests.',
+ required: false,
+ },
+ pageIdx: {
+ name: 'pageIdx',
+ type: 'integer',
+ description:
+ 'Page number to return (0-based). When omitted, returns the first page.',
+ required: false,
+ },
+ resourceTypes: {
+ name: 'resourceTypes',
+ type: 'array',
+ description:
+ 'Filter requests to only return requests of the specified resource types. When omitted or empty, returns all requests.',
+ required: false,
+ },
+ includePreservedRequests: {
+ name: 'includePreservedRequests',
+ type: 'boolean',
+ description:
+ 'Set to true to return the preserved requests over the last 3 navigations.',
+ required: false,
+ default: false,
+ },
+ },
+ },
+ list_pages: {
+ description: 'Get a list of pages open in the browser.',
+ category: 'Navigation automation',
+ args: {},
+ },
+ navigate_page: {
+ description:
+ 'Go to a URL, or back, forward, or reload. Use project URL if not specified otherwise.',
+ category: 'Navigation automation',
+ args: {
+ type: {
+ name: 'type',
+ type: 'string',
+ description:
+ 'Navigate the page by URL, back or forward in history, or reload.',
+ required: false,
+ enum: ['url', 'back', 'forward', 'reload'],
+ },
+ url: {
+ name: 'url',
+ type: 'string',
+ description: 'Target URL (only type=url)',
+ required: false,
+ },
+ ignoreCache: {
+ name: 'ignoreCache',
+ type: 'boolean',
+ description: 'Whether to ignore cache on reload.',
+ required: false,
+ },
+ handleBeforeUnload: {
+ name: 'handleBeforeUnload',
+ type: 'string',
+ description:
+ 'Whether to auto accept or beforeunload dialogs triggered by this navigation. Default is accept.',
+ required: false,
+ enum: ['accept', 'decline'],
+ },
+ initScript: {
+ name: 'initScript',
+ type: 'string',
+ description:
+ 'A JavaScript script to be executed on each new document before any other scripts for the next navigation.',
+ required: false,
+ },
+ timeout: {
+ name: 'timeout',
+ type: 'integer',
+ description:
+ 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
+ required: false,
+ },
+ },
+ },
+ new_page: {
+ description:
+ 'Open a new tab and load a URL. Use project URL if not specified otherwise.',
+ category: 'Navigation automation',
+ args: {
+ url: {
+ name: 'url',
+ type: 'string',
+ description: 'URL to load in a new page.',
+ required: true,
+ },
+ background: {
+ name: 'background',
+ type: 'boolean',
+ description:
+ 'Whether to open the page in the background without bringing it to the front. Default is false (foreground).',
+ required: false,
+ },
+ isolatedContext: {
+ name: 'isolatedContext',
+ type: 'string',
+ description:
+ '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.',
+ required: false,
+ },
+ timeout: {
+ name: 'timeout',
+ type: 'integer',
+ description:
+ 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
+ required: false,
+ },
+ },
+ },
+ performance_analyze_insight: {
+ description:
+ 'Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.',
+ category: 'Performance',
+ args: {
+ insightSetId: {
+ name: 'insightSetId',
+ type: 'string',
+ description:
+ 'The id for the specific insight set. Only use the ids given in the "Available insight sets" list.',
+ required: true,
+ },
+ insightName: {
+ name: 'insightName',
+ type: 'string',
+ description:
+ 'The name of the Insight you want more information on. For example: "DocumentLatency" or "LCPBreakdown"',
+ required: true,
+ },
+ },
+ },
+ performance_start_trace: {
+ description:
+ 'Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.',
+ category: 'Performance',
+ args: {
+ reload: {
+ name: 'reload',
+ type: 'boolean',
+ description:
+ 'Determines if, once tracing has started, the current selected page should be automatically reloaded. Navigate the page to the right URL using the navigate_page tool BEFORE starting the trace if reload or autoStop is set to true.',
+ required: false,
+ default: true,
+ },
+ autoStop: {
+ name: 'autoStop',
+ type: 'boolean',
+ description:
+ 'Determines if the trace recording should be automatically stopped.',
+ required: false,
+ default: true,
+ },
+ filePath: {
+ name: 'filePath',
+ type: 'string',
+ description:
+ 'The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).',
+ required: false,
+ },
+ },
+ },
+ performance_stop_trace: {
+ description:
+ 'Stop the active performance trace recording on the selected webpage.',
+ category: 'Performance',
+ args: {
+ filePath: {
+ name: 'filePath',
+ type: 'string',
+ description:
+ 'The absolute file path, or a file path relative to the current working directory, to save the raw trace data. For example, trace.json.gz (compressed) or trace.json (uncompressed).',
+ required: false,
+ },
+ },
+ },
+ press_key: {
+ description:
+ 'Press a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations).',
+ category: 'Input automation',
+ args: {
+ key: {
+ name: 'key',
+ type: 'string',
+ description:
+ 'A key or a combination (e.g., "Enter", "Control+A", "Control++", "Control+Shift+R"). Modifiers: Control, Shift, Alt, Meta',
+ required: true,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ resize_page: {
+ description:
+ "Resizes the selected page's window so that the page has specified dimension",
+ category: 'Emulation',
+ args: {
+ width: {
+ name: 'width',
+ type: 'number',
+ description: 'Page width',
+ required: true,
+ },
+ height: {
+ name: 'height',
+ type: 'number',
+ description: 'Page height',
+ required: true,
+ },
+ },
+ },
+ select_page: {
+ description: 'Select a page as a context for future tool calls.',
+ category: 'Navigation automation',
+ args: {
+ pageId: {
+ name: 'pageId',
+ type: 'number',
+ description:
+ 'The ID of the page to select. Call list_pages to get available pages.',
+ required: true,
+ },
+ bringToFront: {
+ name: 'bringToFront',
+ type: 'boolean',
+ description: 'Whether to focus the page and bring it to the top.',
+ required: false,
+ },
+ },
+ },
+ take_memory_snapshot: {
+ description:
+ 'Capture a memory heapsnapshot of the currently selected page to memory leak debugging',
+ category: 'Performance',
+ args: {
+ filePath: {
+ name: 'filePath',
+ type: 'string',
+ description:
+ 'A path to a .heapsnapshot file to save the heapsnapshot to.',
+ required: true,
+ },
+ },
+ },
+ take_screenshot: {
+ description: 'Take a screenshot of the page or element.',
+ category: 'Debugging',
+ args: {
+ format: {
+ name: 'format',
+ type: 'string',
+ description:
+ 'Type of format to save the screenshot as. Default is "png"',
+ required: false,
+ default: 'png',
+ enum: ['png', 'jpeg', 'webp'],
+ },
+ quality: {
+ name: 'quality',
+ type: 'number',
+ description:
+ 'Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.',
+ required: false,
+ },
+ uid: {
+ name: 'uid',
+ type: 'string',
+ description:
+ 'The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.',
+ required: false,
+ },
+ fullPage: {
+ name: 'fullPage',
+ type: 'boolean',
+ description:
+ 'If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.',
+ required: false,
+ },
+ filePath: {
+ name: 'filePath',
+ type: 'string',
+ description:
+ 'The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.',
+ required: false,
+ },
+ },
+ },
+ take_snapshot: {
+ description:
+ 'Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique\nidentifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected\nin the DevTools Elements panel (if any).',
+ category: 'Debugging',
+ args: {
+ verbose: {
+ name: 'verbose',
+ type: 'boolean',
+ description:
+ 'Whether to include all possible information available in the full a11y tree. Default is false.',
+ required: false,
+ },
+ filePath: {
+ name: 'filePath',
+ type: 'string',
+ description:
+ 'The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.',
+ required: false,
+ },
+ },
+ },
+ type_text: {
+ description: 'Type text using keyboard into a previously focused input',
+ category: 'Input automation',
+ args: {
+ text: {
+ name: 'text',
+ type: 'string',
+ description: 'The text to type',
+ required: true,
+ },
+ submitKey: {
+ name: 'submitKey',
+ type: 'string',
+ description:
+ 'Optional key to press after typing. E.g., "Enter", "Tab", "Escape"',
+ required: false,
+ },
+ },
+ },
+ upload_file: {
+ description: 'Upload a file through a provided element.',
+ category: 'Input automation',
+ args: {
+ uid: {
+ name: 'uid',
+ type: 'string',
+ description:
+ 'The uid of the file input element or an element that will open file chooser on the page from the page content snapshot',
+ required: true,
+ },
+ filePath: {
+ name: 'filePath',
+ type: 'string',
+ description: 'The local path of the file to upload',
+ required: true,
+ },
+ includeSnapshot: {
+ name: 'includeSnapshot',
+ type: 'boolean',
+ description:
+ 'Whether to include a snapshot in the response. Default is false.',
+ required: false,
+ },
+ },
+ },
+ wait_for: {
+ description: 'Wait for the specified text to appear on the selected page.',
+ category: 'Navigation automation',
+ args: {
+ text: {
+ name: 'text',
+ type: 'array',
+ description:
+ 'Non-empty list of texts. Resolves when any value appears on the page.',
+ required: true,
+ },
+ timeout: {
+ name: 'timeout',
+ type: 'integer',
+ description:
+ 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.',
+ required: false,
+ },
+ },
+ },
+} as const;
diff --git a/src/cli.ts b/src/bin/chrome-devtools-mcp-cli-options.ts
similarity index 99%
rename from src/cli.ts
rename to src/bin/chrome-devtools-mcp-cli-options.ts
index 1e163a38..f81c9e20 100644
--- a/src/cli.ts
+++ b/src/bin/chrome-devtools-mcp-cli-options.ts
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import type {YargsOptions} from './third_party/index.js';
-import {yargs, hideBin} from './third_party/index.js';
+import type {YargsOptions} from '../third_party/index.js';
+import {yargs, hideBin} from '../third_party/index.js';
export const cliOptions = {
autoConnect: {
diff --git a/src/main.ts b/src/bin/chrome-devtools-mcp-main.ts
similarity index 74%
rename from src/main.ts
rename to src/bin/chrome-devtools-mcp-main.ts
index 4f97418d..bfb6bb38 100644
--- a/src/main.ts
+++ b/src/bin/chrome-devtools-mcp-main.ts
@@ -4,16 +4,17 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import './polyfill.js';
+import '../polyfill.js';
import process from 'node:process';
-import {cliOptions, parseArguments} from './cli.js';
-import {logger, saveLogsToFile} from './logger.js';
-import {createMcpServer, logDisclaimers} from './server.js';
-import {computeFlagUsage} from './telemetry/flagUtils.js';
-import {StdioServerTransport} from './third_party/index.js';
-import {VERSION} from './version.js';
+import {createMcpServer, logDisclaimers} from '../index.js';
+import {logger, saveLogsToFile} from '../logger.js';
+import {computeFlagUsage} from '../telemetry/flagUtils.js';
+import {StdioServerTransport} from '../third_party/index.js';
+import {VERSION} from '../version.js';
+
+import {cliOptions, parseArguments} from './chrome-devtools-mcp-cli-options.js';
export const args = parseArguments(VERSION);
diff --git a/src/bin/chrome-devtools-mcp.ts b/src/bin/chrome-devtools-mcp.ts
new file mode 100644
index 00000000..77007010
--- /dev/null
+++ b/src/bin/chrome-devtools-mcp.ts
@@ -0,0 +1,34 @@
+#!/usr/bin/env node
+
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import {version} from 'node:process';
+
+const [major, minor] = version.substring(1).split('.').map(Number);
+
+if (major === 20 && minor < 19) {
+ console.error(
+ `ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20.19.0 LTS or a newer LTS.`,
+ );
+ process.exit(1);
+}
+
+if (major === 22 && minor < 12) {
+ console.error(
+ `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.19.0 LTS or a newer LTS.`,
+ );
+ process.exit(1);
+}
+
+await import('./chrome-devtools-mcp-main.js');
diff --git a/src/bin/chrome-devtools.ts b/src/bin/chrome-devtools.ts
index 17e9c99a..ceb0496a 100644
--- a/src/bin/chrome-devtools.ts
+++ b/src/bin/chrome-devtools.ts
@@ -10,7 +10,6 @@ import process from 'node:process';
import type {Options, PositionalOptions} from 'yargs';
-import {cliOptions, parseArguments} from '../cli.js';
import {
startDaemon,
stopDaemon,
@@ -18,11 +17,12 @@ import {
handleResponse,
} from '../daemon/client.js';
import {isDaemonRunning, serializeArgs} from '../daemon/utils.js';
-import {logDisclaimers} from '../server.js';
+import {logDisclaimers} from '../index.js';
import {hideBin, yargs, type CallToolResult} from '../third_party/index.js';
import {VERSION} from '../version.js';
-import {commands} from './cliDefinitions.js';
+import {commands} from './chrome-devtools-cli-options.js';
+import {cliOptions, parseArguments} from './chrome-devtools-mcp-cli-options.js';
async function start(args: string[]) {
const combinedArgs = [...args, ...defaultArgs];
diff --git a/src/daemon/utils.ts b/src/daemon/utils.ts
index 1b73a154..fbfe8c49 100644
--- a/src/daemon/utils.ts
+++ b/src/daemon/utils.ts
@@ -16,7 +16,8 @@ export const DAEMON_SCRIPT_PATH = path.join(import.meta.dirname, 'daemon.js');
export const INDEX_SCRIPT_PATH = path.join(
import.meta.dirname,
'..',
- 'index.js',
+ 'bin',
+ 'chrome-devtools-mcp.js',
);
const APP_NAME = 'chrome-devtools-mcp';
diff --git a/src/index.ts b/src/index.ts
index f20c4659..1e731521 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,34 +1,281 @@
-#!/usr/bin/env node
-
/**
* @license
- * Copyright 2025 Google LLC
+ * Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
-import {version} from 'node:process';
+import type fs from 'node:fs';
-const [major, minor] = version.substring(1).split('.').map(Number);
+import type {parseArguments} from './bin/chrome-devtools-mcp-cli-options.js';
+import type {Channel} from './browser.js';
+import {ensureBrowserConnected, ensureBrowserLaunched} from './browser.js';
+import {loadIssueDescriptions} from './issue-descriptions.js';
+import {logger} from './logger.js';
+import {McpContext} from './McpContext.js';
+import {McpResponse} from './McpResponse.js';
+import {Mutex} from './Mutex.js';
+import {SlimMcpResponse} from './SlimMcpResponse.js';
+import {ClearcutLogger} from './telemetry/ClearcutLogger.js';
+import {bucketizeLatency} from './telemetry/metricUtils.js';
+import {
+ McpServer,
+ type CallToolResult,
+ SetLevelRequestSchema,
+} from './third_party/index.js';
+import {ToolCategory} from './tools/categories.js';
+import type {DefinedPageTool, ToolDefinition} from './tools/ToolDefinition.js';
+import {pageIdSchema} from './tools/ToolDefinition.js';
+import {createTools} from './tools/tools.js';
+import {VERSION} from './version.js';
-if (major === 20 && minor < 19) {
- console.error(
- `ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20.19.0 LTS or a newer LTS.`,
- );
- process.exit(1);
-}
+export async function createMcpServer(
+ serverArgs: ReturnType<typeof parseArguments>,
+ options: {
+ logFile?: fs.WriteStream;
+ },
+) {
+ let clearcutLogger: ClearcutLogger | undefined;
+ if (serverArgs.usageStatistics) {
+ clearcutLogger = new ClearcutLogger({
+ logFile: serverArgs.logFile,
+ appVersion: VERSION,
+ clearcutEndpoint: serverArgs.clearcutEndpoint,
+ clearcutForceFlushIntervalMs: serverArgs.clearcutForceFlushIntervalMs,
+ clearcutIncludePidHeader: serverArgs.clearcutIncludePidHeader,
+ });
+ }
-if (major === 22 && minor < 12) {
- console.error(
- `ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 22.12.0 LTS or a newer LTS.`,
+ const server = new McpServer(
+ {
+ name: 'chrome_devtools',
+ title: 'Chrome DevTools MCP server',
+ version: VERSION,
+ },
+ {capabilities: {logging: {}}},
);
- process.exit(1);
+ server.server.setRequestHandler(SetLevelRequestSchema, () => {
+ return {};
+ });
+
+ let context: McpContext;
+ async function getContext(): Promise<McpContext> {
+ const chromeArgs: string[] = (serverArgs.chromeArg ?? []).map(String);
+ const ignoreDefaultChromeArgs: string[] = (
+ serverArgs.ignoreDefaultChromeArg ?? []
+ ).map(String);
+ if (serverArgs.proxyServer) {
+ chromeArgs.push(`--proxy-server=${serverArgs.proxyServer}`);
+ }
+ const devtools = serverArgs.experimentalDevtools ?? false;
+ const browser =
+ serverArgs.browserUrl || serverArgs.wsEndpoint || serverArgs.autoConnect
+ ? await ensureBrowserConnected({
+ browserURL: serverArgs.browserUrl,
+ wsEndpoint: serverArgs.wsEndpoint,
+ wsHeaders: serverArgs.wsHeaders,
+ // Important: only pass channel, if autoConnect is true.
+ channel: serverArgs.autoConnect
+ ? (serverArgs.channel as Channel)
+ : undefined,
+ userDataDir: serverArgs.userDataDir,
+ devtools,
+ })
+ : await ensureBrowserLaunched({
+ headless: serverArgs.headless,
+ executablePath: serverArgs.executablePath,
+ channel: serverArgs.channel as Channel,
+ isolated: serverArgs.isolated ?? false,
+ userDataDir: serverArgs.userDataDir,
+ logFile: options.logFile,
+ viewport: serverArgs.viewport,
+ chromeArgs,
+ ignoreDefaultChromeArgs,
+ acceptInsecureCerts: serverArgs.acceptInsecureCerts,
+ devtools,
+ enableExtensions: serverArgs.categoryExtensions,
+ viaCli: serverArgs.viaCli,
+ });
+
+ if (context?.browser !== browser) {
+ context = await McpContext.from(browser, logger, {
+ experimentalDevToolsDebugging: devtools,
+ experimentalIncludeAllPages: serverArgs.experimentalIncludeAllPages,
+ performanceCrux: serverArgs.performanceCrux,
+ });
+ }
+ return context;
+ }
+
+ const toolMutex = new Mutex();
+
+ function registerTool(tool: ToolDefinition | DefinedPageTool): void {
+ if (
+ tool.annotations.category === ToolCategory.EMULATION &&
+ serverArgs.categoryEmulation === false
+ ) {
+ return;
+ }
+ if (
+ tool.annotations.category === ToolCategory.PERFORMANCE &&
+ serverArgs.categoryPerformance === false
+ ) {
+ return;
+ }
+ if (
+ tool.annotations.category === ToolCategory.NETWORK &&
+ serverArgs.categoryNetwork === false
+ ) {
+ return;
+ }
+ if (
+ tool.annotations.category === ToolCategory.EXTENSIONS &&
+ serverArgs.categoryExtensions === false
+ ) {
+ return;
+ }
+ if (
+ tool.annotations.conditions?.includes('computerVision') &&
+ !serverArgs.experimentalVision
+ ) {
+ return;
+ }
+ if (
+ tool.annotations.conditions?.includes('experimentalInteropTools') &&
+ !serverArgs.experimentalInteropTools
+ ) {
+ return;
+ }
+ if (
+ tool.annotations.conditions?.includes('screencast') &&
+ !serverArgs.experimentalScreencast
+ ) {
+ return;
+ }
+ const schema =
+ 'pageScoped' in tool &&
+ tool.pageScoped &&
+ serverArgs.experimentalPageIdRouting &&
+ !serverArgs.slim
+ ? {...tool.schema, ...pageIdSchema}
+ : tool.schema;
+
+ server.registerTool(
+ tool.name,
+ {
+ description: tool.description,
+ inputSchema: schema,
+ annotations: tool.annotations,
+ },
+ async (params): Promise<CallToolResult> => {
+ const guard = await toolMutex.acquire();
+ const startTime = Date.now();
+ let success = false;
+ try {
+ logger(`${tool.name} request: ${JSON.stringify(params, null, ' ')}`);
+ const context = await getContext();
+ logger(`${tool.name} context: resolved`);
+ await context.detectOpenDevToolsWindows();
+ const response = serverArgs.slim
+ ? new SlimMcpResponse(serverArgs)
+ : new McpResponse(serverArgs);
+ if ('pageScoped' in tool && tool.pageScoped) {
+ const page =
+ serverArgs.experimentalPageIdRouting &&
+ params.pageId &&
+ !serverArgs.slim
+ ? context.getPageById(params.pageId)
+ : context.getSelectedMcpPage();
+ response.setPage(page);
+ await tool.handler(
+ {
+ params,
+ page,
+ },
+ response,
+ context,
+ );
+ } else {
+ await tool.handler(
+ // @ts-expect-error types do not match.
+ {
+ params,
+ },
+ response,
+ context,
+ );
+ }
+ const {content, structuredContent} = await response.handle(
+ tool.name,
+ context,
+ );
+ const result: CallToolResult & {
+ structuredContent?: Record<string, unknown>;
+ } = {
+ content,
+ };
+ success = true;
+ if (serverArgs.experimentalStructuredContent) {
+ result.structuredContent = structuredContent as Record<
+ string,
+ unknown
+ >;
+ }
+ return result;
+ } catch (err) {
+ logger(`${tool.name} error:`, err, err?.stack);
+ let errorText = err && 'message' in err ? err.message : String(err);
+ if ('cause' in err && err.cause) {
+ errorText += `\nCause: ${err.cause.message}`;
+ }
+ return {
+ content: [
+ {
+ type: 'text',
+ text: errorText,
+ },
+ ],
+ isError: true,
+ };
+ } finally {
+ void clearcutLogger?.logToolInvocation({
+ toolName: tool.name,
+ success,
+ latencyMs: bucketizeLatency(Date.now() - startTime),
+ });
+ guard.dispose();
+ }
+ },
+ );
+ }
+
+ const tools = createTools(serverArgs);
+ for (const tool of tools) {
+ registerTool(tool);
+ }
+
+ await loadIssueDescriptions();
+
+ return {server, clearcutLogger};
}
-if (major < 20) {
+export const logDisclaimers = (args: ReturnType<typeof parseArguments>) => {
console.error(
- `ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20.19.0 LTS or a newer LTS.`,
+ `chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect,
+debug, and modify any data in the browser or DevTools.
+Avoid sharing sensitive or personal information that you do not want to share with MCP clients.`,
);
- process.exit(1);
-}
-await import('./main.js');
+ if (!args.slim && args.performanceCrux) {
+ console.error(
+ `Performance tools may send trace URLs to the Google CrUX API to fetch real-user experience data. To disable, run with --no-performance-crux.`,
+ );
+ }
+
+ if (!args.slim && args.usageStatistics) {
+ console.error(
+ `
+Google collects usage statistics to improve Chrome DevTools MCP. To opt-out, run with --no-usage-statistics.
+For more details, visit: https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics`,
+ );
+ }
+};
diff --git a/src/server.ts b/src/server.ts
deleted file mode 100644
index 45658a9c..00000000
--- a/src/server.ts
+++ /dev/null
@@ -1,282 +0,0 @@
-/**
- * @license
- * Copyright 2026 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */
-
-import type fs from 'node:fs';
-
-import type {Channel} from './browser.js';
-import {ensureBrowserConnected, ensureBrowserLaunched} from './browser.js';
-import type {parseArguments} from './cli.js';
-import {loadIssueDescriptions} from './issue-descriptions.js';
-import {logger} from './logger.js';
-import {McpContext} from './McpContext.js';
-import {McpResponse} from './McpResponse.js';
-import {Mutex} from './Mutex.js';
-import {SlimMcpResponse} from './SlimMcpResponse.js';
-import {ClearcutLogger} from './telemetry/ClearcutLogger.js';
-import {bucketizeLatency} from './telemetry/metricUtils.js';
-import {
- McpServer,
- type CallToolResult,
- SetLevelRequestSchema,
-} from './third_party/index.js';
-import {ToolCategory} from './tools/categories.js';
-import type {DefinedPageTool, ToolDefinition} from './tools/ToolDefinition.js';
-import {pageIdSchema} from './tools/ToolDefinition.js';
-import {createTools} from './tools/tools.js';
-import {VERSION} from './version.js';
-
-export async function createMcpServer(
- serverArgs: ReturnType<typeof parseArguments>,
- options: {
- logFile?: fs.WriteStream;
- },
-) {
- let clearcutLogger: ClearcutLogger | undefined;
- if (serverArgs.usageStatistics) {
- clearcutLogger = new ClearcutLogger({
- logFile: serverArgs.logFile,
- appVersion: VERSION,
- clearcutEndpoint: serverArgs.clearcutEndpoint,
- clearcutForceFlushIntervalMs: serverArgs.clearcutForceFlushIntervalMs,
- clearcutIncludePidHeader: serverArgs.clearcutIncludePidHeader,
- });
- }
-
- const server = new McpServer(
- {
- name: 'chrome_devtools',
- title: 'Chrome DevTools MCP server',
- version: VERSION,
- },
- {capabilities: {logging: {}}},
- );
- server.server.setRequestHandler(SetLevelRequestSchema, () => {
- return {};
- });
-
- let context: McpContext;
- async function getContext(): Promise<McpContext> {
- const chromeArgs: string[] = (serverArgs.chromeArg ?? []).map(String);
- const ignoreDefaultChromeArgs: string[] = (
- serverArgs.ignoreDefaultChromeArg ?? []
- ).map(String);
- if (serverArgs.proxyServer) {
- chromeArgs.push(`--proxy-server=${serverArgs.proxyServer}`);
- }
- const devtools = serverArgs.experimentalDevtools ?? false;
- const browser =
- serverArgs.browserUrl || serverArgs.wsEndpoint || serverArgs.autoConnect
- ? await ensureBrowserConnected({
- browserURL: serverArgs.browserUrl,
- wsEndpoint: serverArgs.wsEndpoint,
- wsHeaders: serverArgs.wsHeaders,
- // Important: only pass channel, if autoConnect is true.
- channel: serverArgs.autoConnect
- ? (serverArgs.channel as Channel)
- : undefined,
- userDataDir: serverArgs.userDataDir,
- devtools,
- enableExtensions: serverArgs.categoryExtensions,
- })
- : await ensureBrowserLaunched({
- headless: serverArgs.headless,
- executablePath: serverArgs.executablePath,
- channel: serverArgs.channel as Channel,
- isolated: serverArgs.isolated ?? false,
- userDataDir: serverArgs.userDataDir,
- logFile: options.logFile,
- viewport: serverArgs.viewport,
- chromeArgs,
- ignoreDefaultChromeArgs,
- acceptInsecureCerts: serverArgs.acceptInsecureCerts,
- devtools,
- enableExtensions: serverArgs.categoryExtensions,
- viaCli: serverArgs.viaCli,
- });
-
- if (context?.browser !== browser) {
- context = await McpContext.from(browser, logger, {
- experimentalDevToolsDebugging: devtools,
- experimentalIncludeAllPages: serverArgs.experimentalIncludeAllPages,
- performanceCrux: serverArgs.performanceCrux,
- });
- }
- return context;
- }
-
- const toolMutex = new Mutex();
-
- function registerTool(tool: ToolDefinition | DefinedPageTool): void {
- if (
- tool.annotations.category === ToolCategory.EMULATION &&
- serverArgs.categoryEmulation === false
- ) {
- return;
- }
- if (
- tool.annotations.category === ToolCategory.PERFORMANCE &&
- serverArgs.categoryPerformance === false
- ) {
- return;
- }
- if (
- tool.annotations.category === ToolCategory.NETWORK &&
- serverArgs.categoryNetwork === false
- ) {
- return;
- }
- if (
- tool.annotations.category === ToolCategory.EXTENSIONS &&
- serverArgs.categoryExtensions === false
- ) {
- return;
- }
- if (
- tool.annotations.conditions?.includes('computerVision') &&
- !serverArgs.experimentalVision
- ) {
- return;
- }
- if (
- tool.annotations.conditions?.includes('experimentalInteropTools') &&
- !serverArgs.experimentalInteropTools
- ) {
- return;
- }
- if (
- tool.annotations.conditions?.includes('screencast') &&
- !serverArgs.experimentalScreencast
- ) {
- return;
- }
- const schema =
- 'pageScoped' in tool &&
- tool.pageScoped &&
- serverArgs.experimentalPageIdRouting &&
- !serverArgs.slim
- ? {...tool.schema, ...pageIdSchema}
- : tool.schema;
-
- server.registerTool(
- tool.name,
- {
- description: tool.description,
- inputSchema: schema,
- annotations: tool.annotations,
- },
- async (params): Promise<CallToolResult> => {
- const guard = await toolMutex.acquire();
- const startTime = Date.now();
- let success = false;
- try {
- logger(`${tool.name} request: ${JSON.stringify(params, null, ' ')}`);
- const context = await getContext();
- logger(`${tool.name} context: resolved`);
- await context.detectOpenDevToolsWindows();
- const response = serverArgs.slim
- ? new SlimMcpResponse(serverArgs)
- : new McpResponse(serverArgs);
- if ('pageScoped' in tool && tool.pageScoped) {
- const page =
- serverArgs.experimentalPageIdRouting &&
- params.pageId &&
- !serverArgs.slim
- ? context.getPageById(params.pageId)
- : context.getSelectedMcpPage();
- response.setPage(page);
- await tool.handler(
- {
- params,
- page,
- },
- response,
- context,
- );
- } else {
- await tool.handler(
- // @ts-expect-error types do not match.
- {
- params,
- },
- response,
- context,
- );
- }
- const {content, structuredContent} = await response.handle(
- tool.name,
- context,
- );
- const result: CallToolResult & {
- structuredContent?: Record<string, unknown>;
- } = {
- content,
- };
- success = true;
- if (serverArgs.experimentalStructuredContent) {
- result.structuredContent = structuredContent as Record<
- string,
- unknown
- >;
- }
- return result;
- } catch (err) {
- logger(`${tool.name} error:`, err, err?.stack);
- let errorText = err && 'message' in err ? err.message : String(err);
- if ('cause' in err && err.cause) {
- errorText += `\nCause: ${err.cause.message}`;
- }
- return {
- content: [
- {
- type: 'text',
- text: errorText,
- },
- ],
- isError: true,
- };
- } finally {
- void clearcutLogger?.logToolInvocation({
- toolName: tool.name,
- success,
- latencyMs: bucketizeLatency(Date.now() - startTime),
- });
- guard.dispose();
- }
- },
- );
- }
-
- const tools = createTools(serverArgs);
- for (const tool of tools) {
- registerTool(tool);
- }
-
- await loadIssueDescriptions();
-
- return {server, clearcutLogger};
-}
-
-export const logDisclaimers = (args: ReturnType<typeof parseArguments>) => {
- console.error(
- `chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect,
-debug, and modify any data in the browser or DevTools.
-Avoid sharing sensitive or personal information that you do not want to share with MCP clients.`,
- );
-
- if (!args.slim && args.performanceCrux) {
- console.error(
- `Performance tools may send trace URLs to the Google CrUX API to fetch real-user experience data. To disable, run with --no-performance-crux.`,
- );
- }
-
- if (!args.slim && args.usageStatistics) {
- console.error(
- `
-Google collects usage statistics to improve Chrome DevTools MCP. To opt-out, run with --no-usage-statistics.
-For more details, visit: https://github.com/ChromeDevTools/chrome-devtools-mcp#usage-statistics`,
- );
- }
-};
diff --git a/src/telemetry/flagUtils.ts b/src/telemetry/flagUtils.ts
index 525ac481..a64f26a3 100644
--- a/src/telemetry/flagUtils.ts
+++ b/src/telemetry/flagUtils.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import type {cliOptions} from '../cli.js';
+import type {cliOptions} from '../bin/chrome-devtools-mcp-cli-options.js';
import {toSnakeCase} from '../utils/string.js';
import type {FlagUsage} from './types.js';
diff --git a/src/tools/ToolDefinition.ts b/src/tools/ToolDefinition.ts
index 345aa763..17019880 100644
--- a/src/tools/ToolDefinition.ts
+++ b/src/tools/ToolDefinition.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import type {ParsedArguments} from '../cli.js';
+import type {ParsedArguments} from '../bin/chrome-devtools-mcp-cli-options.js';
import type {McpPage} from '../McpPage.js';
import {zod} from '../third_party/index.js';
import type {
diff --git a/src/tools/tools.ts b/src/tools/tools.ts
index 4672516b..d448552b 100644
--- a/src/tools/tools.ts
+++ b/src/tools/tools.ts
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import type {ParsedArguments} from '../cli.js';
+import type {ParsedArguments} from '../bin/chrome-devtools-mcp-cli-options.js';
import * as consoleTools from './console.js';
import * as emulationTools from './emulation.js';
diff --git a/tests/cli.test.ts b/tests/cli.test.ts
index 4ae96058..4bea6b95 100644
--- a/tests/cli.test.ts
+++ b/tests/cli.test.ts
@@ -7,7 +7,7 @@
import assert from 'node:assert';
import {describe, it} from 'node:test';
-import {parseArguments} from '../src/cli.js';
+import {parseArguments} from '../src/bin/chrome-devtools-mcp-cli-options.js';
describe('cli args parsing', () => {
const defaultArgs = {
diff --git a/tests/daemon/utils.test.ts b/tests/daemon/utils.test.ts
index 8bf0f719..4be3baa2 100644
--- a/tests/daemon/utils.test.ts
+++ b/tests/daemon/utils.test.ts
@@ -7,7 +7,7 @@
import assert from 'node:assert';
import {describe, it} from 'node:test';
-import type {ParsedArguments} from '../../src/cli.js';
+import type {ParsedArguments} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {serializeArgs} from '../../src/daemon/utils.js';
import type {YargsOptions} from '../../src/third_party/index.js';
diff --git a/tests/e2e/telemetry.test.ts b/tests/e2e/telemetry.test.ts
index 10051a67..dc02a4a2 100644
--- a/tests/e2e/telemetry.test.ts
+++ b/tests/e2e/telemetry.test.ts
@@ -13,7 +13,7 @@ import {describe, it} from 'node:test';
import type {ChromeDevToolsMcpExtension} from '../../src/telemetry/types';
-const SERVER_PATH = path.resolve('build/src/main.js');
+const SERVER_PATH = path.resolve('build/src/bin/chrome-devtools-mcp.js');
interface MockServerContext {
server: http.Server;
diff --git a/tests/index.test.ts b/tests/index.test.ts
index 8bf8528d..4df17bb6 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -22,7 +22,7 @@ describe('e2e', () => {
const transport = new StdioClientTransport({
command: 'node',
args: [
- 'build/src/index.js',
+ 'build/src/bin/chrome-devtools-mcp.js',
'--headless',
'--isolated',
'--executable-path',
diff --git a/tests/telemetry/flagUtils.test.ts b/tests/telemetry/flagUtils.test.ts
index 76fa396c..f98ab317 100644
--- a/tests/telemetry/flagUtils.test.ts
+++ b/tests/telemetry/flagUtils.test.ts
@@ -7,7 +7,7 @@
import assert from 'node:assert/strict';
import {describe, it} from 'node:test';
-import type {cliOptions} from '../../src/cli.js';
+import type {cliOptions} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {computeFlagUsage} from '../../src/telemetry/flagUtils.js';
describe('computeFlagUsage', () => {
diff --git a/tests/tools/console.test.ts b/tests/tools/console.test.ts
index 4014764c..26b760db 100644
--- a/tests/tools/console.test.ts
+++ b/tests/tools/console.test.ts
@@ -7,7 +7,7 @@
import assert from 'node:assert';
import {before, describe, it} from 'node:test';
-import type {ParsedArguments} from '../../src/cli.js';
+import type {ParsedArguments} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {loadIssueDescriptions} from '../../src/issue-descriptions.js';
import {McpResponse} from '../../src/McpResponse.js';
import {DevTools} from '../../src/third_party/index.js';
diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts
index dbea68e3..8f8b5a87 100644
--- a/tests/tools/extensions.test.ts
+++ b/tests/tools/extensions.test.ts
@@ -10,7 +10,7 @@ import {afterEach, describe, it} from 'node:test';
import sinon from 'sinon';
-import type {ParsedArguments} from '../../src/cli.js';
+import type {ParsedArguments} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {
installExtension,
uninstallExtension,
diff --git a/tests/tools/input.test.ts b/tests/tools/input.test.ts
index 8182a441..5590e88c 100644
--- a/tests/tools/input.test.ts
+++ b/tests/tools/input.test.ts
@@ -9,7 +9,7 @@ import fs from 'node:fs/promises';
import path from 'node:path';
import {describe, it} from 'node:test';
-import type {ParsedArguments} from '../../src/cli.js';
+import type {ParsedArguments} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {McpResponse} from '../../src/McpResponse.js';
import {
click,
diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts
index 61bd8ee5..f0dd4095 100644
--- a/tests/tools/pages.test.ts
+++ b/tests/tools/pages.test.ts
@@ -11,7 +11,7 @@ import {afterEach, describe, it} from 'node:test';
import type {Dialog} from 'puppeteer-core';
import sinon from 'sinon';
-import type {ParsedArguments} from '../../src/cli.js';
+import type {ParsedArguments} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {
listPages,
newPage,
diff --git a/tests/tools/script.test.ts b/tests/tools/script.test.ts
index fa7977e4..772ebc07 100644
--- a/tests/tools/script.test.ts
+++ b/tests/tools/script.test.ts
@@ -8,7 +8,7 @@ import assert from 'node:assert';
import path from 'node:path';
import {describe, it} from 'node:test';
-import type {ParsedArguments} from '../../src/cli.js';
+import type {ParsedArguments} from '../../src/bin/chrome-devtools-mcp-cli-options.js';
import {installExtension} from '../../src/tools/extensions.js';
import {evaluateScript} from '../../src/tools/script.js';
import {serverHooks} from '../server.js';
diff --git a/tests/utils.ts b/tests/utils.ts
index ac88f939..4d48d970 100644
--- a/tests/utils.ts
+++ b/tests/utils.ts
@@ -19,7 +19,7 @@ import type {
} from 'puppeteer-core';
import sinon from 'sinon';
-import type {ParsedArguments} from '../src/cli.js';
+import type {ParsedArguments} from '../src/bin/chrome-devtools-mcp-cli-options.js';
import {McpContext} from '../src/McpContext.js';
import {McpResponse} from '../src/McpResponse.js';
import {stableIdSymbol} from '../src/PageCollector.js';