trackmcp
Back to directory
danielsogl

lighthouse-mcp-server

View on GitHub

MCP server that enables AI agents to perform comprehensive web audits using Google Lighthouse with 13+ tools for performance, accessibility, SEO, and security analysis.

68 stars TypeScriptOthers Updated Sep 4, 2026
lighthouselighthouse-auditslighthouse-scoremcpmcp-server

Documentation

Lighthouse MCP Server

NPM Version
License: MIT
Node Version
CI
Coverage
Sponsor

A Model Context Protocol (MCP) server that provides comprehensive web performance auditing and analysis capabilities using Google Lighthouse. This server enables LLMs and AI agents to perform detailed website performance assessments, accessibility audits, SEO analysis, security checks, and Core Web Vitals monitoring.

๐ŸŒŸ Key Features

  • ๐Ÿš€ Performance Analysis: Complete Lighthouse audits with Core Web Vitals, performance scores, and optimization recommendations
  • โ™ฟ Accessibility Audits: WCAG compliance checking and accessibility score analysis
  • ๐Ÿ” SEO Analysis: Search engine optimization audits and best practice recommendations
  • ๐Ÿ”’ Security Assessment: HTTPS, CSP, and security vulnerability scanning
  • ๐Ÿ“Š Resource Analysis: JavaScript, CSS, image, and font optimization opportunities
  • ๐Ÿ“ฑ Mobile vs Desktop: Comparative analysis across devices with throttling options
  • โšก Core Web Vitals: LCP, INP, CLS monitoring with threshold checking
  • ๐ŸŽฏ Performance Budgets: Custom performance thresholds and budget monitoring
  • ๐Ÿค– Agentic Browsing: Lighthouse 13 audits for how well a page serves AI agents (WebMCP tools, agent accessibility tree, llms.txt)
  • ๐Ÿงฉ Structured Output: Every tool declares an `outputSchema` and returns validated `structuredContent`, so clients get typed data instead of a JSON string to parse
  • ๐Ÿ“š Reference Resources: Built-in guidelines and best practices for web performance, accessibility, SEO, and security

๐Ÿ› ๏ธ Requirements

  • Node.js 22.0.0 or newer
  • Chrome/Chromium browser (automatically managed by Lighthouse)
  • VS Code, Cursor, Windsurf, Claude Desktop, or any other MCP client

๐Ÿš€ Getting Started

Install the Lighthouse MCP server with your preferred client using one of the configurations below:

json
{
  "mcpServers": {
    "lighthouse": {
      "command": "npx",
      "args": ["@danielsogl/lighthouse-mcp@latest"]
    }
  }
}

Persistent Chrome Profiles (Login Sessions)

If you need authenticated sessions, launch with a persistent Chrome profile and run headed:

json
{
  "mcpServers": {
    "lighthouse": {
      "command": "npx",
      "args": [
        "@danielsogl/lighthouse-mcp@latest",
        "--profile-path",
        "",
        "--no-headless"
      ]
    }
  }
}

You can pass extra Chrome flags with `--chrome-flag`, for example `--chrome-flag=--disable-gpu`.

If the flag value starts with `--` and matches a known option name, prefer `--chrome-flag=...` to avoid parsing it as a top-level option.

Profile mode disables Lighthouse's storage reset so cookies and local storage persist between runs.

If `--user-data-dir` points to a missing directory, it will be created and treated as a fresh profile.

Set `--profile-path` to the Profile Path shown in `chrome://version` (e.g. `.../Default`).

Note: Chrome's remote debugging requires a non-default user data directory, so reuse a dedicated profile directory instead of the system default.

You can also pass `--user-data-dir` + `--profile-directory` separately if you prefer.

Attaching with `--chrome-port` alone does not preserve storage; include a profile flag to keep sessions.

CLI Options

Supported runtime flags for the MCP server:

  • `--profile-path `: use the Profile Path from `chrome://version` (auto-derives user data dir + profile name)
  • `--user-data-dir `: reuse a Chrome profile directory for persistent sessions
  • `--profile-directory `: select a profile within the user data dir
  • `--chrome-path `: explicit path to the Chrome/Chromium executable (overrides auto-detection; also respects the `CHROME_PATH` environment variable)
  • `--chrome-flag ` or `--chrome-flag=`: pass through extra Chrome flags (repeatable)
  • `--chrome-port ` or `--remote-debugging-port `: attach to an existing Chrome instance launched with remote debugging enabled
  • `--headless`: force headless mode
  • `--no-headless`: force headed mode

Logging

Lighthouse logs to stderr. The server keeps this at `error` so it does not flood your MCP

client's logs; set `LIGHTHOUSE_LOG_LEVEL` to `silent`, `info` or `verbose` when debugging

(for example when Chrome fails to launch).

bash
LIGHTHOUSE_LOG_LEVEL=verbose npx @danielsogl/lighthouse-mcp@latest

WSL2 / Custom Chrome Path

If the wrong Chrome binary is picked up (e.g. Windows Chrome instead of the Linux binary on WSL2), set the path explicitly:

bash
# Via CLI flag
npx @danielsogl/lighthouse-mcp@latest --chrome-path /usr/bin/google-chrome

# Via environment variable
CHROME_PATH=/usr/bin/google-chrome npx @danielsogl/lighthouse-mcp@latest

In your MCP config:

json
{
  "mcpServers": {
    "lighthouse": {
      "command": "npx",
      "args": ["@danielsogl/lighthouse-mcp@latest", "--chrome-path", "/usr/bin/google-chrome"]
    }
  }
}

E2E Smoke Test (Profile)

Run a real audit with a persistent profile (use an existing profile directory and log in once if needed):

bash
npm run smoke:profile -- --url https://example.com \
  --profile-path "" \
  --no-headless

E2E Smoke Test (Attach to Existing Chrome)

Start Chrome with remote debugging enabled:

bash
/path/to/GoogleChromeExecutable \
  --remote-debugging-port=9222 \
  --user-data-dir /path/to/chrome-profile

Replace `/path/to/GoogleChromeExecutable` with your platform's Chrome/Chromium binary path.

Then attach Lighthouse to that instance:

bash
npm run smoke:profile -- --url https://example.com --chrome-port 9222

To preserve storage when attaching, pass the profile path so Lighthouse keeps cookies/local storage:

bash
npm run smoke:profile -- --url https://example.com \
  --chrome-port 9222 \
  --profile-path ""

Install in VS Code

[](https://code.visualstudio.com/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522lighthouse%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540danielsogl%252Flighthouse-mcp%2540latest%2522%255D%257D)

[](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522lighthouse%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540danielsogl%252Flighthouse-mcp%2540latest%2522%255D%257D)

Manual VS Code Installation

You can also install the Lighthouse MCP server using the VS Code CLI:

bash
# For VS Code
code --add-mcp '{"name":"lighthouse","command":"npx","args":["-y","@danielsogl/lighthouse-mcp@latest"]}'

# For VS Code Insiders
code-insiders --add-mcp '{"name":"lighthouse","command":"npx","args":["-y","@danielsogl/lighthouse-mcp@latest"]}'

After installation, the Lighthouse MCP server will be available for use with your GitHub Copilot agent in VS Code.

Install in Cursor

Install MCP Server

Manual Cursor Installation

Go to `Cursor Settings` โ†’ `MCP` โ†’ `Add new MCP Server`. Name it "lighthouse", use `command` type with the command `npx @danielsogl/lighthouse-mcp@latest`:

json
{
  "mcpServers": {
    "lighthouse": {
      "command": "npx",
      "args": ["@danielsogl/lighthouse-mcp@latest"]
    }
  }
}

Install in Windsurf

[](windsurf://mcp/install?name=lighthouse&command=npx&args=@danielsogl/lighthouse-mcp@latest)

Manual Windsurf Installation

Follow the Windsurf MCP documentation. Use the following configuration:

json
{
  "mcpServers": {
    "lighthouse": {
      "command": "npx",
      "args": ["@danielsogl/lighthouse-mcp@latest"]
    }
  }
}

Install in Claude Desktop

Claude Desktop Installation

Follow the MCP install guide, use the following configuration:

json
{
  "mcpServers": {
    "lighthouse": {
      "command": "npx",
      "args": ["@danielsogl/lighthouse-mcp@latest"]
    }
  }
}

๐Ÿ”ง Available Tools

The Lighthouse MCP server provides the following tools for comprehensive web analysis:

๐Ÿ Audit Tools

ToolDescriptionParameters
`run_audit`Run a comprehensive Lighthouse audit`url`, `categories?`, `device?`, `throttling?`
`get_accessibility_score`Get accessibility score and recommendations`url`, `device?`, `includeDetails?`
`get_seo_analysis`Get SEO analysis and recommendations`url`, `device?`, `includeDetails?`

โšก Performance Tools

ToolDescriptionParameters
`get_performance_score`Get overall performance score`url`, `device?`
`get_core_web_vitals`Get Core Web Vitals metrics`url`, `device?`, `includeDetails?`, `threshold?`
`compare_mobile_desktop`Compare performance across devices`url`, `categories?`, `throttling?`, `includeDetails?`
`check_performance_budget`Check against performance budgets`url`, `device?`, `budget`
`get_lcp_opportunities`Find LCP optimization opportunities`url`, `device?`, `includeDetails?`, `threshold?`

๐Ÿ” Analysis Tools

ToolDescriptionParameters
`find_unused_javascript`Find unused JavaScript code`url`, `device?`, `minBytes?`, `includeSourceMaps?`
`analyze_resources`Analyze all website resources`url`, `device?`, `resourceTypes?`, `minSize?`

๐Ÿ”’ Security Tools

ToolDescriptionParameters
`get_security_audit`Perform comprehensive security audit`url`, `device?`, `checks?`

๐Ÿ’ฌ Available Prompts

The Lighthouse MCP server includes reusable prompts that help LLMs provide structured analysis and recommendations:

๐Ÿ“Š Analysis Prompts

PromptDescriptionParameters
`analyze-audit-results`Analyze Lighthouse audit results`auditResults`, `focusArea?`
`compare-audits`Compare before/after audit results`beforeAudit`, `afterAudit`, `changesImplemented?`
`optimize-core-web-vitals`Get Core Web Vitals optimization recommendations`coreWebVitals`, `framework?`, `constraints?`
`optimize-resources`Get resource optimization recommendations`resourceAnalysis`, `loadingStrategy?`, `criticalUserJourneys?`

๐Ÿ“š Available Resources

The Lighthouse MCP server provides built-in reference resources with essential guidelines and best practices:

ResourceDescriptionURI
`core-web-vitals-thresholds`Core Web Vitals performance thresholds`lighthouse://performance/core-web-vitals-thresholds`
`optimization-techniques`Performance optimization techniques and impact`lighthouse://performance/optimization-techniques`
`wcag-guidelines`WCAG 2.1 accessibility guidelines and issues`lighthouse://accessibility/wcag-guidelines`
`seo-best-practices`SEO best practices and optimization opportunities`lighthouse://seo/best-practices`
`security-best-practices`Web security best practices and vulnerabilities`lighthouse://security/best-practices`
`budget-guidelines`Performance budget recommendations by site type`lighthouse://performance/budget-guidelines`
`categories-scoring`Lighthouse audit categories and scoring methods`lighthouse://audits/categories-scoring`
`framework-guides`Framework-specific optimization guides`lighthouse://frameworks/optimization-guides`

๐ŸŽฏ Strategy Prompts

PromptDescriptionParameters
`create-performance-plan`Generate comprehensive performance improvement plan`currentMetrics`, `targetGoals?`, `timeframe?`
`create-performance-budget`Create custom performance budget recommendations`currentMetrics`, `businessGoals?`, `userBase?`
`seo-recommendations`Generate SEO improvement recommendations`seoAudit`, `websiteType?`, `targetAudience?`
`accessibility-guide`Create accessibility improvement guide`accessibilityAudit`, `complianceLevel?`, `userGroups?`

๐Ÿ”ง Prompt Parameter Details

  • `auditResults`: JSON audit results from Lighthouse tools
  • `focusArea`: Specific category to focus on (`"performance"`, `"accessibility"`, `"seo"`, `"best-practices"`, `"agentic-browsing"`)
  • `beforeAudit` / `afterAudit`: Lighthouse audit results before and after changes
  • `changesImplemented`: Description of changes made between audits
  • `currentMetrics`: Current performance metrics from audits
  • `targetGoals`: Specific performance targets or business goals
  • `timeframe`: Timeline for implementing improvements
  • `framework`: Frontend framework or technology stack
  • `constraints`: Technical or business constraints
  • `websiteType`: Type of website (e.g., e-commerce, blog, corporate)
  • `targetAudience`: Target audience or market information
  • `complianceLevel`: WCAG compliance level (`"AA"` or `"AAA"`)
  • `userGroups`: Specific user groups to consider for accessibility

๐Ÿ“‹ Parameter Details

Common Parameters

  • `url` (required): The website URL to analyze
  • `device`: Target device (`"desktop"` or `"mobile"`, default: `"desktop"`)
  • `includeDetails`: Include detailed audit information (default: `false`)
  • `throttling`: Enable network/CPU throttling (default: `false`)

Specific Parameters

  • `categories`: Lighthouse categories to audit (`["performance", "accessibility", "best-practices", "seo", "agentic-browsing"]`)
  • `threshold`: Custom thresholds for metrics (e.g., `{"lcp": 2.5, "inp": 200, "cls": 0.1}`)
  • `budget`: Performance budget limits (e.g., `{"performanceScore": 90, "largestContentfulPaint": 2500}`)
  • `resourceTypes`: Resource types to analyze (`["images", "javascript", "css", "fonts", "other"]`)
  • `minBytes`: Minimum file size threshold for analysis (default: `2048`)
  • `checks`: Security checks to perform (`["https", "csp", "hsts", "origin-isolation", "clickjacking", "trusted-types", "third-party-cookies", "deprecations"]`)

๐Ÿ’ก Usage Examples

Basic Performance Audit

javascript
// Get overall performance score
{
  "tool": "get_performance_score",
  "arguments": {
    "url": "https://example.com",
    "device": "mobile"
  }
}

Core Web Vitals Analysis

javascript
// Check Core Web Vitals with custom thresholds
{
  "tool": "get_core_web_vitals",
  "arguments": {
    "url": "https://example.com",
    "device": "mobile",
    "includeDetails": true,
    "threshold": {
      "lcp": 2.5,
      "inp": 200,
      "cls": 0.1
    }
  }
}

Security Assessment

javascript
// Comprehensive security audit
{
  "tool": "get_security_audit",
  "arguments": {
    "url": "https://example.com",
    "checks": ["https", "csp", "hsts"]
  }
}

Resource Optimization

javascript
// Find optimization opportunities
{
  "tool": "analyze_resources",
  "arguments": {
    "url": "https://example.com",
    "resourceTypes": ["images", "javascript"],
    "minSize": 1024
  }
}

Using Reference Resources

Access built-in guidelines and best practices:

javascript
// Get Core Web Vitals thresholds
{
  "resource": {
    "uri": "lighthouse://performance/core-web-vitals-thresholds"
  }
}

// Access WCAG accessibility guidelines
{
  "resource": {
    "uri": "lighthouse://accessibility/wcag-guidelines"
  }
}

// Get framework-specific optimization guides
{
  "resource": {
    "uri": "lighthouse://frameworks/optimization-guides"
  }
}

Using Prompts for Analysis

javascript
// Analyze audit results with focused recommendations
{
  "prompt": "analyze-audit-results",
  "arguments": {
    "auditResults": "{...lighthouse audit json...}",
    "focusArea": "performance"
  }
}

// Create a performance improvement plan
{
  "prompt": "create-performance-plan",
  "arguments": {
    "currentMetrics": "{...current performance metrics...}",
    "targetGoals": "Achieve 90+ performance score and sub-2s LCP",
    "timeframe": "3 months"
  }
}

// Compare before/after audit results
{
  "prompt": "compare-audits",
  "arguments": {
    "beforeAudit": "{...before audit results...}",
    "afterAudit": "{...after audit results...}",
    "changesImplemented": "Implemented lazy loading and image optimization"
  }
}

๐ŸŽฏ Use Cases

  • Performance Monitoring: Automated performance tracking and Core Web Vitals monitoring
  • Accessibility Compliance: WCAG 2.1 compliance checking and remediation guidance
  • SEO Optimization: Technical SEO audits and search engine optimization recommendations
  • Security Assessment: Vulnerability scanning and security best practice validation
  • Resource Optimization: Bundle analysis and optimization opportunity identification
  • Performance Budgets: Automated performance budget monitoring and alerting
  • CI/CD Integration: Automated quality gates and performance regression detection

๐Ÿ—๏ธ Architecture

The server is built using:

๐Ÿงช Testing

bash
npm run test:run      # unit tests
npm run test:coverage # unit tests with coverage
npm run test:e2e      # end-to-end tests

The end-to-end suite builds the server, launches it over stdio with a real MCP client, and

runs actual Lighthouse audits against a fixture page served on loopback. It requires Chrome

to be installed; set `CHROME_PATH` if it lives somewhere non-standard.

๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guide for details on:

  • Code style and standards
  • Testing requirements
  • Pull request process
  • Development setup

๐Ÿ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ”’ Security

For security issues, please see our Security Policy.

๐Ÿ“ž Support

๐Ÿ™ Acknowledgments

  • Google Lighthouse team for the excellent auditing engine
  • Anthropic for the Model Context Protocol specification
  • The open source community for continuous inspiration and contributions

Built with โค๏ธ by Daniel Sogl

Frequently asked questions

What is lighthouse-mcp-server?

lighthouse-mcp-server is MCP server that enables AI agents to perform comprehensive web audits using Google Lighthouse with 13+ tools for performance, accessibility, SEO, and security analysis.

How do I install lighthouse-mcp-server?

Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

Is lighthouse-mcp-server open source?

Yes โ€” it is hosted on GitHub at https://github.com/danielsogl/lighthouse-mcp-server and has 68 stars.

Related MCP tools

Run your own MCP server? See who uses it and what to fix.

Measure it with TrackMCP