lighthouse-mcp

by priyankark
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Integrates with Google's Lighthouse tool to provide web performance analysis and auditing capabilities.

  • Wraps around Google's Lighthouse tool to run comprehensive performance audits on web pages, providing performance scores, metrics, device emulation, network throttling control, and specific audit categories (performance, accessibility, best-practices, seo, pwa).

  • Enables auditing of Progressive Web App (PWA) metrics as one of the available audit categories when running Lighthouse tests.

Lighthouse MCP 服务器

MCP 服务器围绕 Google 的 Lighthouse 工具,帮助测量网页的各种性能指标。

特征

  • 对任何 URL 运行全面的 Lighthouse 审核
  • 获取绩效分数和指标
  • 配置设备模拟(移动/桌面)
  • 控制网络限制
  • 选择特定的审计类别

安装

选项 1:使用 npx(推荐)

您可以直接使用 npx 运行该工具,无需安装:

npx lighthouse-mcp

选项 2:全局安装

全局安装包:

npm install -g lighthouse-mcp

然后运行它:

lighthouse-mcp

选项 3:本地开发

  1. 克隆此存储库
  2. 安装依赖项:
    npm install
  3. 构建项目:
    npm run build
  4. 运行服务器:
    npm start

MCP 配置

通过 npm(全局或 npx)安装时

将以下内容添加到您的 MCP 设置配置文件中:

{ "mcpServers": { "lighthouse": { "command": "npx", "args": ["lighthouse-mcp"], "disabled": false, "autoApprove": [] } } }

使用本地开发版本时

将以下内容添加到您的 MCP 设置配置文件中:

{ "mcpServers": { "lighthouse": { "command": "node", "args": ["/absolute/path/to/lighthouse-mcp/build/index.js"], "disabled": false, "autoApprove": [] } } }

/absolute/path/to/lighthouse-mcp替换为此项目的实际路径。

可用工具

运行审计

对 URL 运行全面的 Lighthouse 审核。

参数:

  • url (必填):需要审核的 URL
  • categories (可选):要审核的类别数组(默认为全部)
    • 选项:“性能”、“可访问性”、“最佳实践”、“SEO”、“PWA”
  • device (可选):要模拟的设备(默认为“移动设备”)
    • 选项:“移动”、“桌面”
  • throttling (可选):是否应用网络节流(默认为 true)

例子:

{ "url": "https://example.com", "categories": ["performance", "accessibility"], "device": "desktop", "throttling": false }

获取绩效分数

仅获取 URL 的性能分数。

参数:

  • url (必填):需要审核的 URL
  • device (可选):要模拟的设备(默认为“移动设备”)
    • 选项:“移动”、“桌面”

例子:

{ "url": "https://example.com", "device": "mobile" }

示例用法

一旦 MCP 服务器配置完毕,您就可以将其与 Claude 一起使用:

What's the performance score for example.com?

Claude 将使用get_performance_score工具来分析网站并返回结果。

要求

  • Node.js 16+
  • Chrome/Chromium 浏览器(适用于 Lighthouse)

代言

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

允许 Cursor/Cline/GitHub Copilot 等 AI 助手使用 Google 的 Lighthouse 工具来测量您网页的性能指标。然后,您可以运行代理循环,让助手优化这些指标!

  1. Features
    1. Installation
      1. Option 1: Using npx (Recommended)
      2. Option 2: Global Installation
      3. Option 3: Local Development
    2. MCP Configuration
      1. When installed via npm (global or npx)
      2. When using local development version
    3. Available Tools
      1. run_audit
      2. get_performance_score
    4. Example Usage
      1. Requirements
        1. Endorsements
          ID: xip1afyf7n