MCP server
by livoras
Better Playwright is a powerful web scraper with stealth mode and advanced web scraping tools for reliable data extracti
Enhanced Playwright server that automates browser tasks with stealth mode, persistent profiles, and compressed HTML snapshots. Uses a ref-based element system and regex search for reliable web scraping and form automation.
Better Playwright is a community-built MCP server published by livoras that provides AI assistants with tools and capabilities via the Model Context Protocol. Better Playwright is a powerful web scraper with stealth mode and advanced web scraping tools for reliable data extracti It is categorized under browser automation.
You can install Better Playwright in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
MIT
Better Playwright is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
Fetch and extract information from websites automatically
Example
Research competitor pricing, scrape product reviews, monitor news mentions
Automate 5-10 hours/week of manual web research
Track website changes, new content, price updates
Example
Monitor competitor blog for new posts, track stock availability, watch for pricing changes
Stay informed without manual checking, never miss important updates
Extract structured data from multiple websites
Example
Compile product listings from 10 e-commerce sites, aggregate job postings, collect real estate data
Build datasets 100x faster than manual copying
Share your MCP server with the developer community
Better Playwright reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
Better Playwright is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
Useful MCP listing: Better Playwright is the kind of server we cite when onboarding engineers to host + tool permissions.
We wired Better Playwright into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
Strong directory entry: Better Playwright surfaces stars and publisher context so we could sanity-check maintenance before adopting.
Better Playwright has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
We evaluated Better Playwright against two servers with overlapping tools; this profile had the clearer scope statement.
Better Playwright is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.
I recommend Better Playwright for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
I recommend Better Playwright for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
showing 1-10 of 49
A high-performance Playwright MCP (Model Context Protocol) server with intelligent DOM compression and content search capabilities for browser automation.
[ref=e1], [ref=e2], etc.)npm install -g better-playwright-mcp3
npm install better-playwright-mcp3
Prerequisites:
First, start the HTTP server:
npx better-playwright-mcp3@latest server
Then use the SDK in your code:
import { PlaywrightClient } from 'better-playwright-mcp3';
async function automateWebPage() {
// Connect to the HTTP server (must be running)
const client = new PlaywrightClient('http://localhost:3102');
// Create a page
const { pageId, success } = await client.createPage(
'my-page', // page name
'Test page', // description
'https://example.com' // URL
);
// Get page structure with intelligent folding
const outline = await client.getOutline(pageId);
console.log(outline);
// Returns compressed outline (~90% reduction) with list folding
// Search for specific content (regex by default)
const searchResult = await client.searchSnapshot(pageId, 'Example', { ignoreCase: true });
console.log(searchResult);
// Search with regular expressions (default behavior)
const prices = await client.searchSnapshot(pageId, '\$[0-9]+\.\d{2}', { lineLimit: 10 });
// Search multiple patterns (OR)
const links = await client.searchSnapshot(pageId, 'link|button|input', { ignoreCase: true });
// Interact with the page using ref identifiers
await client.browserClick(pageId, 'e3'); // Click element
await client.browserType(pageId, 'e4', 'Hello World'); // Type text
await client.browserHover(pageId, 'e2'); // Hover over element
// Navigation
await client.browserNavigate(pageId, 'https://google.com');
await client.browserNavigateBack(pageId);
await client.browserNavigateForward(pageId);
// Scrolling
await client.scrollToBottom(pageId);
await client.scrollToTop(pageId);
// Waiting
await client.waitForTimeout(pageId, 2000); // Wait 2 seconds
await client.waitForSelector(pageId, 'body');
// Take screenshots
const screenshot = await client.screenshot(pageId, true); // Full page
// Clean up
await client.closePage(pageId);
}
Available Methods:
createPage, closePage, listPagesbrowserNavigate, browserNavigateBack, browserNavigateForwardbrowserClick, browserType, browserHover, browserSelectOption, fillbrowserPressKey, browserFileUpload, browserHandleDialoggetOutline - Get intelligently compressed page structure with list folding (NEW in v3.2.0)searchSnapshot - Search page content with regex patterns (powered by ripgrep)screenshot - Capture page as imagescrollToBottom, scrollToTopwaitForTimeout, waitForSelectorThe MCP server requires an HTTP server to be running. You need to start both:
Step 1: Start the HTTP server
npx better-playwright-mcp3@latest server
Step 2: In another terminal, start the MCP server
npx better-playwright-mcp3@latest
The MCP server will:
You can run the HTTP server independently:
npx better-playwright-mcp3@latest server
Options:
-p, --port <number> - Server port (default: 3102)--host <string> - Server host (default: localhost)--headless - Run browser in headless mode--chromium - Use Chromium instead of Chrome--no-user-profile - Do not use persistent user profile--user-data-dir <path> - User data directoryWhen used with AI assistants, the following tools are available:
createPage - Create a new browser page with name and descriptionclosePage - Close a specific pagelistPages - List all managed pages with titles and URLsbrowserClick - Click an element using its ref identifierbrowserType - Type text into an elementbrowserHover - Hover over an elementbrowserSelectOption - Select options in a dropdownbrowserPressKey - Press keyboard keysbrowserFileUpload - Upload files to file inputbrowserHandleDialog - Handle browser dialogs (alert, confirm, prompt)browserNavigate - Navigate to a URLbrowserNavigateBack - Go back to previous pagebrowserNavigateForward - Go forward to next pagescrollToBottom - Scroll to bottom of page/elementscrollToTop - Scroll to top of page/elementwaitForTimeout - Wait for specified millisecondswaitForSelector - Wait for element to appearsearchSnapshot - Search page content using regex patterns (powered by ripgrep)screenshot - Take a screenshot (PNG/JPEG)The outline generation uses a three-step compression algorithm:
Original DOM (5000+ lines)
↓
[Remove empty wrappers]
↓
[Detect similar patterns]
↓
Compressed Outline (<500 lines, ~91% reduction)
Example compression:
// Before: 48 similar product cards
- listitem [ref=e234]: Product 1 details...
- listitem [ref=e235]: Product 2 details...
- listitem [ref=e236]: Product 3 details...
... (45 more items)
// After: Folded representation
- listitem [ref=e234]: Product 1 details...
- listitem (... and 47 more similar) [refs: e235, e236, ...]
This project implements a two-tier architecture optimized for minimal token usage:
AI Assistant <--[MCP Protocol]--> MCP Server <--[HTTP]--> HTTP Server <---> Browser
|
v
ripgrep engine
Elements in snapshots are identified using ref attributes (e.g., [ref=e1], [ref=e2]). This system:
aria-ref selectorsExample snapshot:
- generic [ref=e2]:
- heading "Example Domain" [level=1] [ref=e3]
- paragraph [ref=e4]: This domain is for use in illustrative examples
- link "More information..." [ref=e5] [cursor=pointer]
// Create a page
const { pageId, success } = await client.createPage(
'shopping',
'Amazon shopping page',
'https://amazon.com'
);
// Navigate to another URL
await client.browserNavigate(pageId, 'https://google.com');
// Go back/forward
await client.browserNavigateBack(pageId);
await client.browserNavigateForward(pageId);
// Get intelligently compressed page outline
const outline = await client.getOutline(pageId);
console.log(outline);
// Example output showing list folding:
// Page Outline (473/5257 lines):
// - banner [ref=e1]
// - navigation [ref=e2]
// - list "Products" [ref=e3]
// - listitem "Product 1" [ref=e4]
// - listitem (... and 47 more similar) [refs: e5, e6, ...]
//
// Compression: 91% reduction while preserving all refs
// Search for text (case insensitive)
const results = await client.searchSnapshot(pageId, 'product', { ignoreCase: true });
// Search with regular expression (default behavior)
const emails = await client.searchSnapshot(pageId, '[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-z]+');
// Search multiple patterns (OR)
const buttons = await client.searchSnapshot(pageId, 'button|submit|click', { ignoreCase: true });
// Search for prices with dollar sign
const prices = await client.searchSnapshot(pageId, '\$\d+\.\d{2}');
// Limit number of result lines
const firstTen = await client.searchSnapshot(pageId, 'item', { lineLimit: 10 });
Search Options:
pattern (required) - Regex pattern to search forignoreCase (optional) - Case insensitive search (default: false)lineLimit (optional) - Maximum lines to return (default: 100, max: 100)Response Format:
result - Matched text contentmatchCount - Total number of matches foundtruncated - Whether results were truncated due to line limit// Click on element using its ref identifier
await client.browserClick(pageId, 'e3');
// Type text
---
Interact with services that don't offer APIs
Example
Check form submissions, validate website functionality, test user flows
Automate interactions with any website, even without API
Prerequisites
Time Estimate
20-40 minutes including configuration and testing
Steps
Troubleshooting
✓ Do
✗ Don't
💡 Pro Tips
Architecture
MCP server handles HTTP requests, HTML parsing, JavaScript rendering (if headless browser), and returns structured data to Claude.
Protocols
Compatibility
✓ Use when
Use for research automation, content monitoring, data aggregation from multiple sources, and when official APIs don't exist. Best for read-only information gathering.
✗ Avoid when
Avoid for sites with APIs (use API instead), sites that explicitly forbid scraping, when data is copyrighted, or for login-required content without proper authorization.