mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-09-28 11:22:57 +08:00
docs: fix defaults for non-boolean values (#2744)
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/2722
This commit is contained in:
@@ -42,17 +42,14 @@ The Chrome DevTools MCP server supports the following configuration option:
|
||||
- **`--browserUrl`/ `--browser-url`, `-u`**
|
||||
Connect to a running, debuggable Chrome instance (e.g. `http://127.0.0.1:9222`). For more details see: https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/advanced-usage.md#connecting-to-a-running-chrome-instance.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--wsEndpoint`/ `--ws-endpoint`, `-w`**
|
||||
WebSocket endpoint to connect to a running Chrome instance (e.g., ws://127.0.0.1:9222/devtools/browser/<id>). Alternative to --browserUrl.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--wsHeaders`/ `--ws-headers`**
|
||||
Custom headers for WebSocket connection in JSON format (e.g., '{"Authorization":"Bearer token"}'). Only works with --wsEndpoint.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--headless`**
|
||||
Whether to run in headless (no UI) mode.
|
||||
@@ -62,7 +59,6 @@ The Chrome DevTools MCP server supports the following configuration option:
|
||||
- **`--executablePath`/ `--executable-path`, `-e`**
|
||||
Path to custom Chrome executable.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--isolated`**
|
||||
If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed. Defaults to false.
|
||||
@@ -72,38 +68,31 @@ The Chrome DevTools MCP server supports the following configuration option:
|
||||
- **`--userDataDir`/ `--user-data-dir`**
|
||||
Path to the user data directory for Chrome. Default is $HOME/.cache/chrome-devtools-mcp/chrome-profile$CHANNEL_SUFFIX_IF_NON_STABLE
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--channel`**
|
||||
Specify a different Chrome channel that should be used. The default is the stable channel version.
|
||||
- **Type:** string
|
||||
- **Choices:** `canary`, `dev`, `beta`, `stable`
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--proxyServer`/ `--proxy-server`**
|
||||
Proxy server configuration for Chrome passed as --proxy-server when launching the browser. See https://www.chromium.org/developers/design-documents/network-settings/ for details.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--chromeArg`/ `--chrome-arg`**
|
||||
Additional arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.
|
||||
- **Type:** array
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--ignoreDefaultChromeArg`/ `--ignore-default-chrome-arg`**
|
||||
Explicitly disable default arguments for Chrome. Only applies when Chrome is launched by chrome-devtools-mcp.
|
||||
- **Type:** array
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--logFile`/ `--log-file`**
|
||||
Path to a file to write debug logs to. Set the env variable `NODE_DEBUG` to `*` to enable verbose logs. Useful for submitting bug reports.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--viewport`**
|
||||
Initial viewport size for the Chrome instances started by the server. For example, `1280x720`. In headless mode, max size is 3840x2160px.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--acceptInsecureCerts`/ `--accept-insecure-certs`**
|
||||
If enabled, ignores errors relative to self-signed and expired certificates. Use with caution.
|
||||
@@ -148,22 +137,18 @@ The Chrome DevTools MCP server supports the following configuration option:
|
||||
- **`--experimentalFfmpegPath`/ `--experimental-ffmpeg-path`**
|
||||
Path to ffmpeg executable for screencast recording.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--experimentalScreencastFps`/ `--experimental-screencast-fps`**
|
||||
Frames per second to use for screencast recording. Lower values can reduce memory pressure on pages that produce frames faster than ffmpeg can encode them.
|
||||
- **Type:** number
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--blockedUrlPattern`/ `--blocked-url-pattern`**
|
||||
Restricts browser's network access by blocking specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Silently detaches from targets with blocked URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns.
|
||||
- **Type:** array
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--allowedUrlPattern`/ `--allowed-url-pattern`**
|
||||
Restricts browser's network access by allowing only specified URL patterns (uses https://urlpattern.spec.whatwg.org/). Requires Chrome 149+. Silently detaches from targets with unallowed URLs upon connection, and blocks runtime requests (including navigations and subresources). Accepts an array of patterns.
|
||||
- **Type:** array
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--performanceCrux`/ `--performance-crux`**
|
||||
Set to false to disable sending URLs from performance traces to CrUX API to get field performance data.
|
||||
@@ -189,22 +174,18 @@ The Chrome DevTools MCP server supports the following configuration option:
|
||||
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 reduces transfer and storage size. To reduce context size use --screenshotMaxWidth / --screenshotMaxHeight, since image tokens scale with dimensions rather than encoded bytes. Unset preserves the existing default ("png").
|
||||
- **Type:** string
|
||||
- **Choices:** `jpeg`, `png`, `webp`
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--screenshotQuality`/ `--screenshot-quality`**
|
||||
Override the default compression quality (0-100) used by take_screenshot for JPEG and WebP when the caller does not specify one. Lower values mean smaller files. Ignored for PNG. Unset preserves the Puppeteer default.
|
||||
- **Type:** number
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--screenshotMaxWidth`/ `--screenshot-max-width`**
|
||||
Maximum width in pixels for screenshots. If the captured image is wider, it is downscaled (preserving aspect ratio) before being returned. Reduces context size in AI conversations. Unset means no resize.
|
||||
- **Type:** number
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--screenshotMaxHeight`/ `--screenshot-max-height`**
|
||||
Maximum height in pixels for screenshots. If the captured image is taller, it is downscaled (preserving aspect ratio) before being returned. Can be combined with --screenshot-max-width; the smaller scale factor wins. Unset means no resize.
|
||||
- **Type:** number
|
||||
- **Default:** `false`
|
||||
|
||||
- **`--slim`**
|
||||
Exposes a "slim" set of 3 tools covering navigation, script execution and screenshots only. Useful for basic browser tasks.
|
||||
@@ -229,7 +210,6 @@ The Chrome DevTools MCP server supports the following configuration option:
|
||||
- **`--config`**
|
||||
Path to JSON configuration file.
|
||||
- **Type:** string
|
||||
- **Default:** `false`
|
||||
|
||||
<!-- END AUTO GENERATED OPTIONS -->
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import fs from 'node:fs';
|
||||
|
||||
import type {Tool} from '@modelcontextprotocol/sdk/types.js';
|
||||
import type {Options as YargsOptions} from 'yargs';
|
||||
|
||||
import {
|
||||
mcpOptions,
|
||||
@@ -117,21 +118,11 @@ function sortTools(a: ToolWithAnnotations, b: ToolWithAnnotations): number {
|
||||
return a.name.localeCompare(b.name);
|
||||
}
|
||||
|
||||
interface OptionConfig {
|
||||
hidden?: boolean;
|
||||
alias?: string;
|
||||
description?: string;
|
||||
describe?: string;
|
||||
type?: string;
|
||||
choices?: string[];
|
||||
default?: unknown;
|
||||
}
|
||||
|
||||
function generateConfigOptionsMarkdown(): string {
|
||||
let markdown = '';
|
||||
|
||||
for (const [optionName, optionConfig] of Object.entries(
|
||||
mcpOptions as Record<string, OptionConfig>,
|
||||
mcpOptions as Record<string, Partial<YargsOptions>>,
|
||||
)) {
|
||||
// Skip hidden options
|
||||
if (optionConfig.hidden) {
|
||||
@@ -164,8 +155,13 @@ function generateConfigOptionsMarkdown(): string {
|
||||
markdown += ` - **Choices:** ${optionConfig.choices.map(c => `\`${c}\``).join(', ')}\n`;
|
||||
}
|
||||
|
||||
// Add default if available
|
||||
markdown += ` - **Default:** \`${optionConfig.defaultDescription ?? optionConfig.default ?? 'false'}\`\n`;
|
||||
const defaultValue =
|
||||
optionConfig.defaultDescription ?? optionConfig.default;
|
||||
if (defaultValue !== undefined) {
|
||||
markdown += ` - **Default:** \`${defaultValue}\`\n`;
|
||||
} else if (optionConfig.type === 'boolean') {
|
||||
markdown += ` - **Default:** \`false\`\n`;
|
||||
}
|
||||
|
||||
markdown += '\n';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user