Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 09:03:44 +08:00
commit 51eac46940
41 changed files with 5371 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: click
*
* Clicks on the provided element
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('click')
.description('Clicks on the provided element')
.option('--uid <value>', 'The uid of an element on the page from the page content snapshot (required)')
.option('--dblClick', 'Set to true for double clicks. Default is false.')
.parse();
const options = program.opts();
// Validate required options
if (!options.uid) {
console.error('Error: --uid is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.uid !== undefined) {
args['uid'] = options.uid;
}
if (options.dblClick) {
args['dblClick'] = true;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'click', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: close_page
*
* Closes the page by its index. The last open page cannot be closed.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('close_page')
.description('Closes the page by its index. The last open page cannot be closed.')
.option('--pageIdx <value>', 'The index of the page to close. Call list_pages to list pages. (required)', parseFloat)
.addHelpText('after', ' Note: --pageIdx is required')
.parse();
const options = program.opts();
// Validate required options
if (!options.pageIdx) {
console.error('Error: --pageIdx is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.pageIdx !== undefined) {
args['pageIdx'] = options.pageIdx;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'close_page', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: drag
*
* Drag an element onto another element
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('drag')
.description('Drag an element onto another element')
.option('--from-uid <value>', 'The uid of the element to drag (required)')
.option('--to-uid <value>', 'The uid of the element to drop into (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.fromUid) {
console.error('Error: --from-uid is required');
process.exit(1);
}
if (!options.toUid) {
console.error('Error: --to-uid is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.fromUid !== undefined) {
args['from_uid'] = options.fromUid;
}
if (options.toUid !== undefined) {
args['to_uid'] = options.toUid;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'drag', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: emulate
*
* Emulates various features on the selected page.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('emulate')
.description('Emulates various features on the selected page.')
.option('--networkConditions <value>', 'Throttle network. Set to \"No emulation\" to disable. If omitted, conditions remain unchanged.. Choices: "No emulation", "Offline", "Slow 3G", "Fast 3G", "Slow 4G", "Fast 4G"')
.option('--cpuThrottlingRate <value>', 'Represents the CPU slowdown factor. Set the rate to 1 to disable throttling. If omitted, throttling remains unchanged.', parseFloat)
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.networkConditions !== undefined) {
args['networkConditions'] = options.networkConditions;
}
if (options.cpuThrottlingRate !== undefined) {
args['cpuThrottlingRate'] = options.cpuThrottlingRate;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'emulate', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,55 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: evaluate_script
*
* Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON
so returned values have to JSON-serializable.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('evaluate_script')
.description('Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON\nso returned values have to JSON-serializable.')
.option('--function <value>', 'A JavaScript function declaration to be executed by the tool in the currently selected page.
Example without arguments: `() => {
return document.title
}` or `async () => {
return await fetch(\"example.com\")
}`.
Example with arguments: `(el) => {
return el.innerText;
}`
(required)')
.option('--args <items...>', 'An optional list of arguments to pass to the function.')
.parse();
const options = program.opts();
// Validate required options
if (!options.function) {
console.error('Error: --function is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.function !== undefined) {
args['function'] = options.function;
}
if (options.args !== undefined) {
args['args'] = options.args;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'evaluate_script', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: fill
*
* Type text into a input, text area or select an option from a <select> element.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('fill')
.description('Type text into a input, text area or select an option from a <select> element.')
.option('--uid <value>', 'The uid of an element on the page from the page content snapshot (required)')
.option('--value <value>', 'The value to fill in (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.uid) {
console.error('Error: --uid is required');
process.exit(1);
}
if (!options.value) {
console.error('Error: --value is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.uid !== undefined) {
args['uid'] = options.uid;
}
if (options.value !== undefined) {
args['value'] = options.value;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'fill', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: fill_form
*
* Fill out multiple form elements at once
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('fill_form')
.description('Fill out multiple form elements at once')
.option('--elements <items...>', 'Elements from snapshot to fill out. (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.elements) {
console.error('Error: --elements is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.elements !== undefined) {
args['elements'] = options.elements;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'fill_form', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: get_console_message
*
* Gets a console message by its ID. You can get all messages by calling list_console_messages.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('get_console_message')
.description('Gets a console message by its ID. You can get all messages by calling list_console_messages.')
.option('--msgid <value>', 'The msgid of a console message on the page from the listed console messages (required)', parseFloat)
.addHelpText('after', ' Note: --msgid is required')
.parse();
const options = program.opts();
// Validate required options
if (!options.msgid) {
console.error('Error: --msgid is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.msgid !== undefined) {
args['msgid'] = options.msgid;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'get_console_message', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,35 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: get_network_request
*
* Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('get_network_request')
.description('Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.')
.option('--reqid <value>', 'The reqid of the network request. If omitted returns the currently selected request in the DevTools Network panel.', parseFloat)
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.reqid !== undefined) {
args['reqid'] = options.reqid;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'get_network_request', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: handle_dialog
*
* If a browser dialog was opened, use this command to handle it
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('handle_dialog')
.description('If a browser dialog was opened, use this command to handle it')
.option('--action <value>', 'Whether to dismiss or accept the dialog (required). Choices: "accept", "dismiss"')
.option('--promptText <value>', 'Optional prompt text to enter into the dialog.')
.parse();
const options = program.opts();
// Validate required options
if (!options.action) {
console.error('Error: --action is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.action !== undefined) {
args['action'] = options.action;
}
if (options.promptText !== undefined) {
args['promptText'] = options.promptText;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'handle_dialog', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: hover
*
* Hover over the provided element
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('hover')
.description('Hover over the provided element')
.option('--uid <value>', 'The uid of an element on the page from the page content snapshot (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.uid) {
console.error('Error: --uid is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.uid !== undefined) {
args['uid'] = options.uid;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'hover', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: list_console_messages
*
* List all console messages for the currently selected page since the last navigation.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('list_console_messages')
.description('List all console messages for the currently selected page since the last navigation.')
.option('--pageSize <value>', 'Maximum number of messages to return. When omitted, returns all requests.', (val) => parseInt(val, 10))
.option('--pageIdx <value>', 'Page number to return (0-based). When omitted, returns the first page.', (val) => parseInt(val, 10))
.option('--types <items...>', 'Filter messages to only return messages of the specified resource types. When omitted or empty, returns all messages.')
.option('--includePreservedMessages', 'Set to true to return the preserved messages over the last 3 navigations.')
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.pageSize !== undefined) {
args['pageSize'] = options.pageSize;
}
if (options.pageIdx !== undefined) {
args['pageIdx'] = options.pageIdx;
}
if (options.types !== undefined) {
args['types'] = options.types;
}
if (options.includePreservedMessages) {
args['includePreservedMessages'] = true;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'list_console_messages', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: list_network_requests
*
* List all requests for the currently selected page since the last navigation.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('list_network_requests')
.description('List all requests for the currently selected page since the last navigation.')
.option('--pageSize <value>', 'Maximum number of requests to return. When omitted, returns all requests.', (val) => parseInt(val, 10))
.option('--pageIdx <value>', 'Page number to return (0-based). When omitted, returns the first page.', (val) => parseInt(val, 10))
.option('--resourceTypes <items...>', 'Filter requests to only return requests of the specified resource types. When omitted or empty, returns all requests.')
.option('--includePreservedRequests', 'Set to true to return the preserved requests over the last 3 navigations.')
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.pageSize !== undefined) {
args['pageSize'] = options.pageSize;
}
if (options.pageIdx !== undefined) {
args['pageIdx'] = options.pageIdx;
}
if (options.resourceTypes !== undefined) {
args['resourceTypes'] = options.resourceTypes;
}
if (options.includePreservedRequests) {
args['includePreservedRequests'] = true;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'list_network_requests', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: list_pages
*
* Get a list of pages open in the browser.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('list_pages')
.description('Get a list of pages open in the browser.')
// No options required
.parse();
const options = program.opts();
const args = {};
// Call the tool
try {
const result = await callTool('chrome-devtools', 'list_pages', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,79 @@
#!/usr/bin/env node
/**
* MCP REST Client for chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
*
* Shared MCP REST client for tool scripts.
*/
import axios from 'axios';
// MCP2REST endpoint (configurable via environment variable)
const MCP_REST_URL = process.env.MCP_REST_URL || 'http://localhost:28888';
/**
* Call an MCP tool via mcp2rest REST API.
*
* @param {string} server - Server name (e.g., "chrome-devtools")
* @param {string} tool - Tool name (e.g., "click")
* @param {object} args - Tool arguments as object
* @returns {Promise<string>} Tool result as formatted string
*/
export async function callTool(server, tool, args) {
const url = `${MCP_REST_URL}/call`;
const payload = {
server,
tool,
arguments: args || {},
};
try {
const response = await axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' },
timeout: 30000,
});
const data = response.data;
if (data.success) {
// Extract and format result
const result = data.result || {};
const content = result.content || [];
// Format output nicely
const outputParts = [];
for (const item of content) {
if (item.type === 'text') {
outputParts.push(item.text || '');
} else if (item.type === 'image') {
// For images, just note their presence
const dataLen = (item.data || '').length;
outputParts.push(`[Image data: ${dataLen} bytes]`);
} else if (item.type === 'resource') {
outputParts.push(JSON.stringify(item.resource || {}, null, 2));
}
}
return outputParts.length > 0 ? outputParts.join('\n') : JSON.stringify(result, null, 2);
} else {
const error = data.error || {};
const errorMsg = error.message || 'Unknown error';
const errorCode = error.code || 'UNKNOWN';
console.error(`Error [${errorCode}]: ${errorMsg}`);
process.exit(1);
}
} catch (error) {
if (error.code === 'ECONNREFUSED' || error.code === 'ENOTFOUND') {
console.error(`Error: Cannot connect to mcp2rest at ${MCP_REST_URL}`);
console.error('Make sure mcp2rest is running.');
} else if (error.code === 'ETIMEDOUT' || error.code === 'ECONNABORTED') {
console.error('Error: Request timed out after 30 seconds');
} else if (error.response) {
console.error(`Error: HTTP ${error.response.status} - ${error.response.data}`);
} else {
console.error(`Error: ${error.message}`);
}
process.exit(1);
}
}

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: navigate_page
*
* Navigates the currently selected page to a URL.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('navigate_page')
.description('Navigates the currently selected page to a URL.')
.option('--type <value>', 'Navigate the page by URL, back or forward in history, or reload.. Choices: "url", "back", "forward", "reload"')
.option('--url <value>', 'Target URL (only type=url)')
.option('--ignoreCache', 'Whether to ignore cache on reload.')
.option('--timeout <value>', 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.', (val) => parseInt(val, 10))
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.type !== undefined) {
args['type'] = options.type;
}
if (options.url !== undefined) {
args['url'] = options.url;
}
if (options.ignoreCache) {
args['ignoreCache'] = true;
}
if (options.timeout !== undefined) {
args['timeout'] = options.timeout;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'navigate_page', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: new_page
*
* Creates a new page
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('new_page')
.description('Creates a new page')
.option('--url <value>', 'URL to load in a new page. (required)')
.option('--timeout <value>', 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.', (val) => parseInt(val, 10))
.parse();
const options = program.opts();
// Validate required options
if (!options.url) {
console.error('Error: --url is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.url !== undefined) {
args['url'] = options.url;
}
if (options.timeout !== undefined) {
args['timeout'] = options.timeout;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'new_page', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,18 @@
{
"name": "mcp-chrome-devtools-skill",
"version": "1.0.0",
"description": "Claude Code skill scripts for chrome-devtools MCP server",
"type": "module",
"dependencies": {
"axios": "^1.6.2",
"commander": "^11.1.0"
},
"keywords": [
"mcp",
"claude-code",
"skill",
"chrome-devtools"
],
"author": "",
"license": "MIT"
}

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: performance_analyze_insight
*
* Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('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.')
.option('--insightSetId <value>', 'The id for the specific insight set. Only use the ids given in the \"Available insight sets\" list. (required)')
.option('--insightName <value>', 'The name of the Insight you want more information on. For example: \"DocumentLatency\" or \"LCPBreakdown\" (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.insightSetId) {
console.error('Error: --insightSetId is required');
process.exit(1);
}
if (!options.insightName) {
console.error('Error: --insightName is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.insightSetId !== undefined) {
args['insightSetId'] = options.insightSetId;
}
if (options.insightName !== undefined) {
args['insightName'] = options.insightName;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'performance_analyze_insight', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: performance_start_trace
*
* Starts a performance trace recording on the selected page. This can be used to look for performance problems and insights to improve the performance of the page. It will also report Core Web Vital (CWV) scores for the page.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('performance_start_trace')
.description('Starts a performance trace recording on the selected page. This can be used to look for performance problems and insights to improve the performance of the page. It will also report Core Web Vital (CWV) scores for the page.')
.option('--reload', 'Determines if, once tracing has started, the page should be automatically reloaded.')
.option('--autoStop', 'Determines if the trace recording should be automatically stopped.')
.parse();
const options = program.opts();
// Validate required options
if (!options.reload) {
console.error('Error: --reload is required');
process.exit(1);
}
if (!options.autoStop) {
console.error('Error: --autoStop is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.reload) {
args['reload'] = true;
}
if (options.autoStop) {
args['autoStop'] = true;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'performance_start_trace', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: performance_stop_trace
*
* Stops the active performance trace recording on the selected page.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('performance_stop_trace')
.description('Stops the active performance trace recording on the selected page.')
// No options required
.parse();
const options = program.opts();
const args = {};
// Call the tool
try {
const result = await callTool('chrome-devtools', 'performance_stop_trace', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: press_key
*
* 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).
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('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).')
.option('--key <value>', 'A key or a combination (e.g., \"Enter\", \"Control+A\", \"Control++\", \"Control+Shift+R\"). Modifiers: Control, Shift, Alt, Meta (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.key) {
console.error('Error: --key is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.key !== undefined) {
args['key'] = options.key;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'press_key', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: resize_page
*
* Resizes the selected page's window so that the page has specified dimension
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('resize_page')
.description('Resizes the selected page\'s window so that the page has specified dimension')
.option('--width <value>', 'Page width (required)', parseFloat)
.addHelpText('after', ' Note: --width is required')
.option('--height <value>', 'Page height (required)', parseFloat)
.addHelpText('after', ' Note: --height is required')
.parse();
const options = program.opts();
// Validate required options
if (!options.width) {
console.error('Error: --width is required');
process.exit(1);
}
if (!options.height) {
console.error('Error: --height is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.width !== undefined) {
args['width'] = options.width;
}
if (options.height !== undefined) {
args['height'] = options.height;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'resize_page', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,42 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: select_page
*
* Select a page as a context for future tool calls.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('select_page')
.description('Select a page as a context for future tool calls.')
.option('--pageIdx <value>', 'The index of the page to select. Call list_pages to list pages. (required)', parseFloat)
.addHelpText('after', ' Note: --pageIdx is required')
.parse();
const options = program.opts();
// Validate required options
if (!options.pageIdx) {
console.error('Error: --pageIdx is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.pageIdx !== undefined) {
args['pageIdx'] = options.pageIdx;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'select_page', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,51 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: take_screenshot
*
* Take a screenshot of the page or element.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('take_screenshot')
.description('Take a screenshot of the page or element.')
.option('--format <value>', 'Type of format to save the screenshot as. Default is \"png\". Choices: "png", "jpeg", "webp"')
.option('--quality <value>', 'Compression quality for JPEG and WebP formats (0-100). Higher values mean better quality but larger file sizes. Ignored for PNG format.', parseFloat)
.option('--uid <value>', 'The uid of an element on the page from the page content snapshot. If omitted takes a pages screenshot.')
.option('--fullPage', 'If set to true takes a screenshot of the full page instead of the currently visible viewport. Incompatible with uid.')
.option('--filePath <value>', 'The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.')
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.format !== undefined) {
args['format'] = options.format;
}
if (options.quality !== undefined) {
args['quality'] = options.quality;
}
if (options.uid !== undefined) {
args['uid'] = options.uid;
}
if (options.fullPage) {
args['fullPage'] = true;
}
if (options.filePath !== undefined) {
args['filePath'] = options.filePath;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'take_screenshot', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,41 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: take_snapshot
*
* Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique
identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected
in the DevTools Elements panel (if any).
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('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).')
.option('--verbose', 'Whether to include all possible information available in the full a11y tree. Default is false.')
.option('--filePath <value>', 'The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.')
.parse();
const options = program.opts();
// Build arguments object
const args = {};
if (options.verbose) {
args['verbose'] = true;
}
if (options.filePath !== undefined) {
args['filePath'] = options.filePath;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'take_snapshot', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,49 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: upload_file
*
* Upload a file through a provided element.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('upload_file')
.description('Upload a file through a provided element.')
.option('--uid <value>', 'The uid of the file input element or an element that will open file chooser on the page from the page content snapshot (required)')
.option('--filePath <value>', 'The local path of the file to upload (required)')
.parse();
const options = program.opts();
// Validate required options
if (!options.uid) {
console.error('Error: --uid is required');
process.exit(1);
}
if (!options.filePath) {
console.error('Error: --filePath is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.uid !== undefined) {
args['uid'] = options.uid;
}
if (options.filePath !== undefined) {
args['filePath'] = options.filePath;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'upload_file', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env node
/**
* MCP Server: chrome-devtools
* Server Version: 0.10.2
* Generated: 2025-11-23
* Tool: wait_for
*
* Wait for the specified text to appear on the selected page.
*/
import { program } from 'commander';
import { callTool } from './mcp_client.js';
program
.name('wait_for')
.description('Wait for the specified text to appear on the selected page.')
.option('--text <value>', 'Text to appear on the page (required)')
.option('--timeout <value>', 'Maximum wait time in milliseconds. If set to 0, the default timeout will be used.', (val) => parseInt(val, 10))
.parse();
const options = program.opts();
// Validate required options
if (!options.text) {
console.error('Error: --text is required');
process.exit(1);
}
// Build arguments object
const args = {};
if (options.text !== undefined) {
args['text'] = options.text;
}
if (options.timeout !== undefined) {
args['timeout'] = options.timeout;
}
// Call the tool
try {
const result = await callTool('chrome-devtools', 'wait_for', args);
console.log(result);
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}