Skip to main content
Glama
ui-optimizer-mcp

ui-optimizer-mcp

by polatbakir

ui-optimizer-mcp

Production-focused, repository-first MCP server for AI-driven UI inspection and optimization reports.

What it does

  • Accepts a website URL and optional viewport presets

  • Launches Chromium with Playwright

  • Captures screenshots for each viewport

  • Collects visible DOM/layout metadata

  • Runs deterministic checks:

    • overflow indicators

    • missing image alt text

    • duplicate visible button labels

    • unlabeled inputs and unnamed buttons

    • browser console errors

  • Produces a structured, prioritized report

  • Produces a concise follow-up prompt for Claude Code

Related MCP server: UI Analyzer MCP Server

MCP tools

scan_website_ui

Scans one URL and returns report JSON.

Input:

{
  "url": "https://example.com",
  "viewportPresets": [
    { "name": "desktop", "width": 1440, "height": 900 },
    { "name": "mobile", "width": 390, "height": 844 }
  ]
}

Output shape:

{
  "url": "https://example.com",
  "generatedAt": "2026-01-01T00:00:00.000Z",
  "metadata": {
    "toolVersion": "0.1.0",
    "artifactDirectory": "/absolute/path/to/artifacts/2026-01-01T00-00-00.000Z",
    "viewportsScanned": ["desktop", "mobile"]
  },
  "summary": { "totalIssues": 3, "high": 1, "medium": 1, "low": 1 },
  "screenshots": [
    {
      "viewport": "desktop",
      "path": "/absolute/path/to/artifacts/2026-01-01T00-00-00.000Z/desktop.png"
    }
  ],
  "issues": [
    {
      "id": "desktop-1-unlabeled-input-1",
      "title": "Input without accessible label",
      "severity": "high",
      "affectedArea": "input.search",
      "recommendation": "Add a visible <label> and/or aria-label/aria-labelledby for form controls."
    }
  ],
  "nextPrompt": "Analyze and fix UI issues for https://example.com..."
}

generate_ui_fix_prompt

Builds a concise fix prompt from a report object.

Input:

{
  "report": {
    "url": "https://example.com",
    "summary": { "totalIssues": 3, "high": 1, "medium": 1, "low": 1 },
    "issues": []
  }
}

Output: multiline prompt string.

Quick start (local)

  1. Install dependencies:

npm install
  1. Install browser runtime:

npx playwright install chromium
  1. Build:

npm run build
  1. Start MCP server (stdio transport):

npm start

Runtime configuration

Optional environment variables:

  • UI_OPTIMIZER_OUTPUT_DIR (default: artifacts)

  • UI_OPTIMIZER_TIMEOUT_MS (default: 30000)

  • UI_OPTIMIZER_MAX_VISIBLE_ELEMENTS (default: 300)

  • UI_OPTIMIZER_MAX_SIGNAL_ITEMS (default: 40)

Example:

UI_OPTIMIZER_OUTPUT_DIR=artifacts-prod UI_OPTIMIZER_TIMEOUT_MS=45000 npm start

MCP client integration

Point your MCP client to the built server command:

{
  "mcpServers": {
    "ui-optimizer": {
      "command": "node",
      "args": ["/absolute/path/to/ui-optimizer-mcp/dist/index.js"]
    }
  }
}

Validation commands

npm run lint
npm run build
npm run test

Available Tools

2 tools
generate_ui_fix_promptB

Generate a concise Claude Code prompt summary from an existing optimization report.

Inputs: report (required).

scan_website_uiA

Open a URL with Playwright, capture screenshots and DOM metadata, run deterministic UI checks, and return a structured optimization report and follow-up prompt.

Inputs: url (required), viewportPresets.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools have clearly distinct inputs and purposes: one scans a live URL and produces a report, the other consumes an existing report to produce a prompt. There is no realistic overlap or ambiguity between them.

    Naming Consistency5/5

    Both tool names follow the same verb_noun pattern with snake_case convention: scan_website_ui and generate_ui_fix_prompt. Naming is perfectly consistent.

    Tool Count3/5

    With only two tools, the server feels quite thin for a 'ui-optimizer' domain. The tools support a narrow scan-and-prompt workflow, but the count is on the low end and could warrant a few more related operations.

    Completeness4/5

    The workflow of scanning a website and generating a fix prompt is functionally complete for the server's stated purpose. Minor gaps exist such as lacking a way to import external reports or apply fixes directly, but the core flow is not broken.

    Related MCP Connectors

    Related MCP Servers