Skip to main content
Glama

lighthouse_audit

Run comprehensive Lighthouse audits to measure website performance, accessibility, best practices, and SEO scores. Get detailed findings on render-blocking resources, image optimization, and unused code for actionable improvements.

Instructions

Run a full Lighthouse audit against a URL. Returns scores for Performance, Accessibility, Best Practices, and SEO (0-100), plus detailed audit findings for render-blocking resources, image optimization, unused code, and more. Heavier than performance_audit but provides industry-standard Lighthouse scores.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the page to audit (e.g., http://localhost:3000)

Implementation Reference

  • The MCP tool registration and handler for 'lighthouse_audit'.
    server.tool(
      "lighthouse_audit",
      "Run a full Lighthouse audit against a URL. Returns scores for Performance, Accessibility, Best Practices, and SEO (0-100), plus detailed audit findings for render-blocking resources, image optimization, unused code, and more. Heavier than performance_audit but provides industry-standard Lighthouse scores.",
      {
        url: z.string().url().describe("URL of the page to audit (e.g., http://localhost:3000)"),
      },
      async ({ url }) => {
        try {
          const result = await runLighthouse(url);
          const report = formatLighthouseReport(result);
    
          return {
            content: [
              { type: "text" as const, text: report },
              {
                type: "text" as const,
                text: `\n\n<raw_data>\n${JSON.stringify(result, null, 2)}\n</raw_data>`,
              },
            ],
          };
        } catch (error) {
          const message = error instanceof Error ? error.message : String(error);
          return {
            content: [{ type: "text" as const, text: `Lighthouse audit failed: ${message}` }],
            isError: true,
          };
        }
      }
    );
  • The primary logic implementation for running the Lighthouse audit.
    export async function runLighthouse(
      url: string,
      options?: { readonly chromePath?: string }
    ): Promise<LighthouseResult> {
  • Type definition for the Lighthouse audit results.
    export interface LighthouseResult {
      readonly scores: LighthouseScores;
      readonly audits: readonly LighthouseAudit[];
      readonly url: string;
      readonly timestamp: string;
      readonly lighthouseVersion: string;
      readonly runWarnings: readonly string[];
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/prembobby39-gif/uimax-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server