visual-inspector-mcp
An MCP server that enables AI assistants to visually inspect and interact with rendered web pages via a persistent headless Chromium browser, supporting navigation, screenshots, clicks, viewport resizing, and console log retrieval.
README
English | فارسی
visual-inspector-mcp
An MCP (Model Context Protocol) server that lets Claude Code — or any MCP-compatible client — visually inspect rendered web pages through a persistent headless Chromium browser powered by Playwright.
Instead of guessing UI state from source code alone, your AI assistant can navigate to a URL, take a screenshot, click elements, resize the viewport, and read browser console logs — all over a single persistent page session.
Table of Contents
Why this exists
Most AI coding assistants only read your source files. visual-inspector-mcp gives your assistant a real browser window so it can:
- See what the page actually looks like (not just what the HTML says)
- Interact with the UI — open menus, navigate tabs, trigger modals — before screenshotting
- Debug visually by correlating a broken layout with console errors in the same session
- Check responsive breakpoints by resizing the viewport on the fly
All through a single, lightweight MCP server — no Docker, no additional services.
Tools
| Tool | Description | Side-effects? |
|---|---|---|
navigate |
Load a URL in the persistent headless page | Opens network connections |
screenshot |
Capture the viewport, full page, or a CSS selector | Read-only |
click |
Click an element by CSS selector or Playwright locator | Modifies page state |
resize |
Resize the browser viewport | Modifies page state |
console_logs |
Return recent browser console messages and page errors | Read-only |
Each tool is annotated with readOnlyHint, destructiveHint, and openWorldHint metadata so MCP clients can surface appropriate confirmation prompts.
navigate
Load a URL in the persistent browser page. The page stays open for later click, screenshot, or console_logs calls.
| Param | Type | Required | Notes |
|---|---|---|---|
url |
string | yes | URL to load (supports http://, https://, file://, and data: URIs) |
waitForSelector |
string | no | Wait for this CSS/Playwright selector before returning — useful for SPAs |
Returns the resolved URL and page title on one line: https://example.com — "Example Domain".
screenshot
Screenshot the current page and return it as a base64-encoded image block.
| Param | Type | Required | Notes |
|---|---|---|---|
selector |
string | no | Capture only this element (cheapest); CSS selector or Playwright locator |
fullPage |
boolean | no | Capture the full scrollable page (most expensive); defaults to viewport |
format |
"png" | "jpeg" |
no | png (default, lossless) or jpeg (smaller; fine for layout checks) |
quality |
number 1–100 | no | JPEG quality (default 80); ignored for PNG |
Requires navigate to have been called first.
click
Click an element to reach a UI state (open a menu, modal, or tab) before screenshotting it.
| Param | Type | Required | Notes |
|---|---|---|---|
selector |
string | yes | CSS selector or Playwright locator of the element to click |
resize
Resize the browser viewport to check a responsive breakpoint.
| Param | Type | Required | Notes |
|---|---|---|---|
width |
number | yes | Viewport width in pixels |
height |
number | yes | Viewport height in pixels |
console_logs
Return recent browser console messages and page errors — useful for correlating a visual glitch with a JavaScript error.
| Param | Type | Required | Notes |
|---|---|---|---|
limit |
number | no | Max entries to return, most recent first (default 30) |
level |
"all" | "error" |
no | "all" (default) or errors/warnings only |
clear |
boolean | no | Clear the log buffer after reading |
withTimestamps |
boolean | no | Prepend ISO timestamps to each entry (default false) |
Installation
Prerequisites
- Node.js 18+ (for native
fetchand ESM support) - A terminal / shell
Clone and install dependencies
git clone https://github.com/MatinMHF/visual-inspector-mcp.git
cd visual-inspector-mcp
npm install # also runs `playwright install chromium` via postinstall
If Chromium is not installed automatically, run:
npx playwright install chromium
Usage
Run directly
node index.js
The server communicates over stdio, so it is meant to be launched by an MCP client, not run interactively on its own.
Register with Claude Code
claude mcp add visual-inspector -s user -- node /path/to/visual-inspector-mcp/index.js
On Windows PowerShell, quote the -- separator to prevent PowerShell from silently stripping it:
claude mcp add visual-inspector -s user "--" node "C:/path/to/visual-inspector-mcp/index.js"
Register with Claude Desktop (or any MCP-compatible client)
Add an entry to your client's MCP server config (e.g. claude_desktop_config.json):
{
"mcpServers": {
"visual-inspector": {
"command": "node",
"args": ["C:/path/to/visual-inspector-mcp/index.js"]
}
}
}
Example workflow
A typical session once the server is registered with your MCP client:
- "Navigate to my dev server" → calls
navigatewithhttp://localhost:3000 - "Take a screenshot" → calls
screenshotto see the current rendered UI - "Click the hamburger menu" → calls
clickwith the selector, thenscreenshotagain - "Check it at mobile width" → calls
resizewith{ width: 375, height: 667 }, thenscreenshot - "Any JS errors?" → calls
console_logswith{ level: "error" }
Running the smoke test
A self-contained end-to-end smoke test spins up the server as a subprocess, speaks MCP over stdio, and exercises all five tools:
npm test
The test writes test-full.png and test-element.png to the working directory as proof that screenshots are working. Both files can be deleted afterwards.
Security notes
- The server launches a headless Chromium instance; it has access to your local network and filesystem via
file://URLs. - Only register it with MCP clients and sessions you trust.
clickis markeddestructiveHint: true— well-behaved clients should confirm before invoking it on production pages.- Because every tool has
openWorldHint: true(real network calls), avoid pointing it at sensitive internal services without understanding the risk.
License
MIT — see LICENSE for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.