Viewport-iq is a production-grade browser inspection and responsive layout testing MCP server that provides web page inspection capabilities to AI assistants through Playwright Chromium. It targets MCP clients such as Claude Desktop, Cursor, and Cline, helping developers complete page structure analysis, responsive verification, and layout issue localization within conversations.
Purpose
- Provide browser automation and page inspection tools for AI assistants, for use in frontend development, responsive testing, and layout auditing.
- Expose Playwright's page operations, DOM inspection, screenshot, and diagnostic capabilities to AI clients through the MCP protocol.
Key capabilities
- Browser navigation: Open a URL or local file path, support forward, back, and refresh, and return the final URL, title, HTTP status, load time, and current viewport.
- Page and DOM inspection: Provide a page structure overview (viewport and document dimensions, total DOM element count, landmarks, heading hierarchy and hierarchy error detection, image dimensions and missing alt, links, buttons, form inputs); inspect element attributes, bounding boxes, visibility, and child elements by CSS selector; inspect computed styles and box model; generate a semantic DOM tree.
- Responsive testing: Automatically test at 7 standard viewport presets (from 320px small-screen phones to 1920px ultra-wide desktops) or custom dimensions, checking for horizontal overflow, content clipping, unconstrained elements, navigation behavior changes, and interactive element collisions, and save screenshots.
- Overflow detection: Locate horizontal page overflow, element overflow, fixed-width risks, media overflow, and text clipping, with precise pixel measurements and CSS fix suggestions.
- Layout adaptation probing: Probe layout changes between 320px and 1920px widths, optionally reading @media rules from stylesheets; also track the behavior of a single component at different widths.
- Visual comparison and screenshots: Capture multi-device screenshots (mobile 375px, tablet 768px, desktop 1440px), perform layout difference and pixel difference analysis (pixelmatch), and output diff images, mismatched pixel counts, and percentages; support viewport, full-page, or element screenshots.
- Layout health audit: Score page layout defects (0–100), classify issues as Critical, High, Medium, Low, and Informational, and provide evidence-based fix suggestions.
- Console and network diagnostics: Intercept uncaught JavaScript exceptions, console warnings, and failed HTTP requests (4xx/5xx), and be careful to protect sensitive credentials.
- Session management: use a single persistent Playwright Chromium instance with lifecycle handling and graceful recovery.
- Protocol compliance: diagnostic logs are output only to stderr, while stdout is reserved for JSON-RPC MCP communication.
Usage
- Environment requirements: Node.js v18.0.0 or higher (tested on v20, v22, v24), npm v9 or higher, with support for macOS, Linux, and Windows.
- Installation steps: after entering the repository directory, run npm install; run npx playwright install chromium to install Chromium; run npm run build to build the TypeScript project; run npm run test to run tests.
- Client configuration: add viewport-iq under mcpServers in the Claude Desktop configuration file; or configure it in the MCP settings of Cursor/Windsurf/Cline (such as .cursor/mcp.json). Windows paths must use forward slashes or escaped backslashes.
- Output structure: all generated files are organized under the output/ directory, and paths returned to the MCP client are verified to exist on disk.
Use cases
- Front-end developers use an AI assistant to check a page's responsive behavior on mobile and locate horizontal overflow and fixed-width issues.
- Inspect the dimensions, computed styles, and overflow causes of specific elements (such as the hero section, navigation bar, cards).
- Compare layout differences and pixel changes of a website across viewports such as 375px, 768px, and 1440px.
- View browser console JavaScript errors and failed network requests.
- Perform a layout health audit on a page and obtain fix suggestions.
Limitations and notes
- The project materials do not provide information on fees, pricing, or commercial licensing.
- Node.js, npm, and Playwright Chromium must be installed locally, and the build must be completed before use.
- In custom tool implementations, console.log is prohibited; use logger to output to stderr instead, to avoid breaking STDIJSON-RPC communication in O mode.
- In Windows enterprise network or proxy environments, Node may need to be started with --use-system-ca.
- In Linux or container environments, Chromium starts by default with --no-sandbox and --disable-dev-shm-usage.
- The materials mention that SSE and Stream transport, Web Vitals checks, and dark/light mode contrast comparison are future directions; whether they are currently implemented is not explicitly stated.