Web Inspector MCP ๐
Give LLMs visual superpowers to see, debug, and test any web page.
A Model Context Protocol (MCP) server that provides comprehensive web inspection and debugging capabilities. Built on Playwright, it enables AI assistants to deeply understand web page structure, debug element visibility issues, validate layouts, and inspect DOM in real browser environments.
Why Web Inspector MCP?
Modern web applications are complex. Elements are hidden, layouts break, selectors fail, and debugging feels like detective work. Web Inspector MCP gives your AI assistant the tools to:
๐ Understand any page structure - Progressive DOM inspection that drills through wrapper divs to find semantic elements
๐ฏ Debug visibility issues - Detailed diagnostics showing exactly why clicks fail (clipped, covered, scrolled out of view)
๐ Validate layouts - Compare element positions to ensure consistent alignment and spacing
๐งช Test selector reliability - See all matching elements with their visibility status before writing tests
๐จ Inspect styles - Get computed CSS to understand why elements behave unexpectedly
๐ Find elements without IDs - Locate elements by text content when test IDs aren't available
Perfect For
QA Engineers - Debug failing automated tests and understand why selectors break
Frontend Developers - Investigate layout issues and CSS problems across browsers
Test Automation - Build robust selectors and validate page structure before writing tests
Accessibility Audits - Inspect ARIA roles, semantic HTML, and element visibility
Web Scraping - Understand page structure and find the right selectors for data extraction
Installation
No manual installation required! Your AI coding assistant will automatically install the server via npx
when configured.
If you prefer global installation for faster startup:
AI Tool Setup
All configurations below use npx
which automatically downloads and runs the latest version. Click to expand installation instructions for your AI tool:
Installation via CLI
Manual Configuration
Edit ~/.config/claude/mcp.json
(Linux/macOS) or %APPDATA%\Claude\mcp.json
(Windows):
After installation, restart Claude Code to load the server.
Configuration File Location
MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
Add to Configuration
Restart Claude Desktop after saving the configuration.
Prerequisites
VS Code version 1.101 or later
GitHub Copilot extension installed
Installation via CLI
Manual Configuration
Open VS Code Settings (JSON)
Add MCP server configuration to
mcp.json
:
Enable MCP in VS Code
Open VS Code Settings (UI)
Search for "MCP"
Enable Chat > MCP option
MCP only works in Agent mode - switch to agent mode in the chat interface
Open the
mcp.json
file and click the "Start" button next to the server
Note about Embedded Browser
GitHub Copilot and VS Code may have an embedded browser feature. If you experience conflicts or prefer using Web Inspector MCP for all web inspection tasks, you may want to disable the built-in browser:
Open VS Code Settings
Search for "browser preview" or "simple browser"
Disable relevant browser-related extensions if needed
Web Inspector MCP provides more powerful inspection capabilities than the embedded browser.
Configuration File Location
MacOS/Linux:
~/.cursor/mcp.json
or check Cursor's settings directoryWindows:
%APPDATA%\Cursor\mcp.json
Add to Configuration
Steps
Open Cursor Settings (Cmd/Ctrl + ,)
Search for "MCP" settings
Edit the MCP configuration file
Add the web-inspector server configuration
Restart Cursor
Verify the server is available in the MCP panel
Configuration
Windsurf uses the same configuration format as Claude Desktop. You can literally copy your Claude Desktop config!
Configuration File: Check Windsurf's settings for the exact path (typically in app data directory)
Steps
Open Windsurf settings
Navigate to MCP configuration
Add the web-inspector server
Restart Windsurf
Verify server availability in the tools panel
Windsurf handles MCP tools very well - configuration is straightforward!
Prerequisites
VS Code with Cline extension installed
Node.js installed on your system
Configuration
Open Cline's settings in VS Code
Locate the MCP configuration section
Add the server configuration:
Restart VS Code or reload the Cline extension
The Web Inspector MCP tools will be available in Cline's tool panel
Most MCP-compatible tools use a similar configuration format. Look for:
MCP settings or configuration file
Server/Tools configuration section
Add the standard configuration:
If your tool supports MCP but isn't listed here, consult its documentation for the exact configuration file location.
Core Tools
๐ DOM Inspection & Discovery
inspect_dom
โญ PRIMARY TOOL
Progressive DOM inspection with semantic filtering and automatic wrapper drilling. Returns only meaningful elements (semantic HTML, test IDs, ARIA roles, interactive elements) while automatically skipping non-semantic wrapper divs.
Key Features:
Drills through nested wrapper elements (up to 5 levels deep by default)
Shows spatial layout information (position, size, visibility)
Detects layout patterns automatically
Supports progressive exploration (inspect โ drill down โ inspect children)
Use Cases:
Understanding page structure at a glance
Finding semantic landmarks (header, main, nav, footer)
Discovering interactive elements in complex UIs
Navigating deeply nested component libraries (Material-UI, Ant Design)
Example Workflow:
get_test_ids
Discover all test identifiers on the page (data-testid, data-test, data-cy, etc.). Returns a compact list grouped by attribute type.
Use Cases:
Finding elements with test IDs for reliable selectors
Auditing test coverage
Understanding naming conventions used in the codebase
query_selector
Test a selector and get detailed information about all matched elements. Shows tag, position, text content, visibility status, and why elements are hidden (display:none, opacity:0, zero size).
Use Cases:
Debugging why selectors match unexpected elements
Validating selector specificity before writing tests
Finding the right element among multiple matches
Understanding element state (visible, hidden, interactive)
Parameters:
limit
- Control how many matches to show (default: 10)onlyVisible
- Filter by visibility (true/false/undefined)showAttributes
- Display specific HTML attributes
๐๏ธ Visibility & Position Debugging
check_visibility
Detailed visibility diagnostics showing exactly why elements are or aren't visible. Checks viewport intersection, clipping by overflow:hidden, coverage by other elements, and scroll requirements.
Use Cases:
Debugging why clicks fail ("element not visible")
Understanding if scrolling is needed
Detecting elements covered by modals or overlays
Checking if elements are clipped by parent containers
get_position
Get precise element coordinates and dimensions (x, y, width, height). Shows position relative to viewport.
Use Cases:
Finding exact click coordinates
Checking element layout
Calculating distances between elements
Debugging overlapping elements
compare_positions
Compare positions and alignment of two elements. Validates if elements are aligned (top, left, right, bottom) or have matching dimensions (width, height).
Use Cases:
Visual regression testing
Ensuring consistent spacing across components
Validating grid layouts
Checking responsive design consistency
๐จ Style & Content Inspection
get_styles
Get computed CSS styles for an element, grouped by category (Layout, Visibility, Spacing, Typography). Request specific properties or get common layout properties.
Use Cases:
Understanding why elements behave unexpectedly
Debugging layout issues (flexbox, grid, positioning)
Investigating rendering differences across browsers
Finding actual rendered values (not CSS source)
get_text
Extract visible text content from the current page or specific element.
Use Cases:
Content validation
Scraping visible text
Verifying page loaded correctly
get_html
Get HTML content with options to remove scripts, comments, styles, and meta tags. Supports minification and max length limits.
Use Cases:
Analyzing page structure
Extracting clean HTML for processing
Debugging server-rendered content
get_console_logs
Retrieve browser console logs with filtering by type (error, warning, log, info, debug) and text search.
Use Cases:
Debugging JavaScript errors
Monitoring network issues
Finding specific log messages
Tracking console warnings
๐ Element Finding & Validation
find_by_text
Find elements by text content with exact/partial matching, case sensitivity options, and regex support.
Use Cases:
Finding buttons without test IDs ("Click here", "Submit")
Locating elements in pages with poor markup
Searching for dynamic content
Testing internationalized content
Regex Examples:
/sign.*in/i
- Case-insensitive "sign in" variations/\d+ items?/
- Numbers followed by "item" or "items"
element_exists
Ultra-lightweight existence check. Returns simple โ exists or โ not found status.
Use Cases:
Quick pre-interaction validation
Polling for element appearance
Conditional logic based on element presence
๐ Navigation & Control
navigate
Navigate to a URL with full browser configuration options.
Parameters:
browserType
- chromium, firefox, or webkitwidth
,height
- Viewport dimensionsheadless
- Run in headless modetimeout
- Navigation timeoutwaitUntil
- Navigation wait condition
go_back
Navigate back in browser history. Essential for testing navigation flows and multi-step forms.
Use Cases:
Testing back button behavior
Debugging navigation state
Verifying history management
Testing multi-page workflows
go_forward
Navigate forward in browser history.
Use Cases:
Testing forward navigation
Verifying browser history state
Debugging navigation flows
screenshot
Capture screenshots of the entire page or specific elements. Save as PNG file or return as base64.
Options:
Full page screenshots
Element-specific screenshots
Custom viewport sizes
Save to custom directory
close
Close the browser and release all resources.
๐ฏ Essential Interactions (for Debugging Workflows)
click
Click an element on the page. Essential for debugging user workflows and testing interactive elements.
Use Cases:
Testing button functionality
Triggering dropdown menus
Debugging click event handlers
Simulating user interactions during inspection
fill
Fill out an input field with text. Critical for debugging form interactions.
Use Cases:
Testing form validation
Debugging input field behavior
Simulating user data entry
Testing autocomplete and search features
hover
Hover over an element to trigger hover states and tooltips.
Use Cases:
Debugging CSS :hover states
Triggering tooltip displays
Testing dropdown menu visibility
Inspecting hover-dependent UI elements
select
Select an option from a <select>
dropdown element.
Use Cases:
Testing dropdown functionality
Debugging option selection
Simulating user form completion
Testing dependent field updates
upload_file
Upload a file to an input[type='file']
element.
Use Cases:
Testing file upload functionality
Debugging file input behavior
Simulating document/image uploads
Testing upload validation
drag
Drag an element from source to target location.
Use Cases:
Testing drag-and-drop interfaces
Debugging sortable lists
Testing reorderable components
Validating drag interactions
press_key
Press a keyboard key, optionally focusing on a specific element first.
Use Cases:
Testing keyboard shortcuts
Debugging keyboard navigation
Testing Enter/Escape key handlers
Simulating Tab key navigation
โ๏ธ Advanced Tools
evaluate
Execute JavaScript code in the browser console and return the result.
Use Cases:
Running custom JavaScript for debugging
Extracting complex data not available via other tools
Testing JavaScript functions on the page
Manipulating page state for testing
Example:
Selector Shortcuts
All tools support test ID shortcuts for cleaner syntax:
testid:submit-button
โ[data-testid="submit-button"]
data-test:login-form
โ[data-test="login-form"]
data-cy:username
โ[data-cy="username"]
Regular CSS selectors work unchanged.
Example Use Cases
Debugging a Failing Test
Understanding Page Structure
Validating Layout Consistency
Finding Elements Without Test IDs
Development
Testing
Building
Technical Details
Protocol: Model Context Protocol (MCP)
Browser Engine: Playwright (Chromium, Firefox, WebKit)
Language: TypeScript
Node Version: 20+
Contributing
Contributions welcome! When adding new tools:
Keep tool names short (some clients limit
server_name:tool_name
to 60 chars)Follow the atomic operation principle (one tool, one purpose)
Use flat parameter structures with primitive types
Add tests in
src/__tests__/
License
MIT
Links
Credits
This project is a focused fork of executeautomation/mcp-playwright, specializing in web inspection and debugging capabilities. We're grateful to the ExecuteAutomation team for creating the excellent foundation that made this project possible.
Key Differences:
Web Inspector MCP: Focused on inspection, debugging, and layout validation with clean tool names
Original mcp-playwright: Full-featured browser automation including code generation, API testing, and comprehensive interaction tools
If you need full Playwright automation capabilities (code generation, advanced interactions, API testing), check out the original mcp-playwright server.
Made for AI-assisted web development and testing ๐ค
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables AI assistants to inspect, debug, and test web pages using Playwright. Provides comprehensive DOM inspection, visibility debugging, layout validation, and element finding capabilities in real browser environments.