豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit dfdac26

Browse files
authored
feat: integrate Lighthouse audits (#831)
This PR adds tool to perform navigation and snapshot audits using Lighthouse for Accessibility, SEO and Best practices. For performance audits existing tools can be used. Closes #473
1 parent caf601a commit dfdac26

28 files changed

+59453
-84
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Prettier-only ignores.
22
CHANGELOG.md
3+
src/third_party/lighthouse-devtools-mcp-bundle.js

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,10 @@ If you run into any issues, checkout our [troubleshooting guide](./docs/troubles
442442
- **Network** (2 tools)
443443
- [`get_network_request`](docs/tool-reference.md#get_network_request)
444444
- [`list_network_requests`](docs/tool-reference.md#list_network_requests)
445-
- **Debugging** (5 tools)
445+
- **Debugging** (6 tools)
446446
- [`evaluate_script`](docs/tool-reference.md#evaluate_script)
447447
- [`get_console_message`](docs/tool-reference.md#get_console_message)
448+
- [`lighthouse_audit`](docs/tool-reference.md#lighthouse_audit)
448449
- [`list_console_messages`](docs/tool-reference.md#list_console_messages)
449450
- [`take_screenshot`](docs/tool-reference.md#take_screenshot)
450451
- [`take_snapshot`](docs/tool-reference.md#take_snapshot)

docs/tool-reference.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->
22

3-
# Chrome DevTools MCP Tool Reference (~7084 cl100k_base tokens)
3+
# Chrome DevTools MCP Tool Reference (~7324 cl100k_base tokens)
44

55
- **[Input automation](#input-automation)** (9 tools)
66
- [`click`](#click)
@@ -30,9 +30,10 @@
3030
- **[Network](#network)** (2 tools)
3131
- [`get_network_request`](#get_network_request)
3232
- [`list_network_requests`](#list_network_requests)
33-
- **[Debugging](#debugging)** (5 tools)
33+
- **[Debugging](#debugging)** (6 tools)
3434
- [`evaluate_script`](#evaluate_script)
3535
- [`get_console_message`](#get_console_message)
36+
- [`lighthouse_audit`](#lighthouse_audit)
3637
- [`list_console_messages`](#list_console_messages)
3738
- [`take_screenshot`](#take_screenshot)
3839
- [`take_snapshot`](#take_snapshot)
@@ -345,6 +346,18 @@ so returned values have to be JSON-serializable.
345346

346347
---
347348

349+
### `lighthouse_audit`
350+
351+
**Description:** Get Lighthouse score and reports for accessibility, SEO and best practices.
352+
353+
**Parameters:**
354+
355+
- **device** (enum: "desktop", "mobile") _(optional)_: Device to [`emulate`](#emulate).
356+
- **mode** (enum: "navigation", "snapshot") _(optional)_: "navigation" reloads &amp; audits. "snapshot" analyzes current state.
357+
- **outputDirPath** (string) _(optional)_: Directory for reports. If omitted, uses temporary files.
358+
359+
---
360+
348361
### `list_console_messages`
349362

350363
**Description:** List all console messages for the currently selected page since the last navigation.

eslint.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import tseslint from 'typescript-eslint';
1414
import localPlugin from './scripts/eslint_rules/local-plugin.js';
1515

1616
export default defineConfig([
17-
globalIgnores(['**/node_modules', '**/build/', 'tests/tools/fixtures/']),
17+
globalIgnores([
18+
'**/node_modules',
19+
'**/build/',
20+
'tests/tools/fixtures/',
21+
'src/third_party/lighthouse-devtools-mcp-bundle.js',
22+
]),
1823
importPlugin.flatConfigs.typescript,
1924
{
2025
languageOptions: {

0 commit comments

Comments
 (0)