Patchright Stealth Browser
STDIOStreamlined MCP server providing stealth browser automation capabilities to AI models.
Streamlined MCP server providing stealth browser automation capabilities to AI models.
A streamlined Model Context Protocol (MCP) server that wraps the Patchright Node.js SDK to provide stealth browser automation capabilities to AI models. This lightweight server focuses on essential functionality to make it easier for simpler AI models to use.
Patchright is an undetected version of the Playwright testing and automation framework. It's designed as a drop-in replacement for Playwright, but with advanced stealth capabilities to avoid detection by anti-bot systems. Patchright patches various detection techniques including:
This MCP server wraps the Node.js version of Patchright to make its capabilities available to AI models through a simple, standardized protocol.
Clone this repository:
git clone https://github.com/yourusername/patchright-lite-mcp-server.git cd patchright-lite-mcp-server
Install dependencies:
npm install
Build the TypeScript code:
npm run build
Install Chromium-Driver for Pathright:
npx patchright install chromium
Run the server with:
npm start
This will start the server with stdio transport, making it ready to integrate with AI tools that support MCP.
Add this to your claude-desktop-config.json
file:
{ "mcpServers": { "patchright": { "command": "node", "args": ["path/to/patchright-lite-mcp-server/dist/index.js"] } } }
Use the VS Code CLI to add the MCP server:
code --add-mcp '{"name":"patchright","command":"node","args":["path/to/patchright-lite-mcp-server/dist/index.js"]}'
The server provides just 4 essential tools:
Launches a browser, navigates to a URL, and extracts content.
Tool: browse
Parameters: {
"url": "https://example.com",
"headless": true,
"waitFor": 1000
}
Returns:
Performs a simple interaction on a page.
Tool: interact
Parameters: {
"browserId": "browser-id-from-browse",
"pageId": "page-id-from-browse",
"action": "click", // can be "click", "fill", or "select"
"selector": "#submit-button",
"value": "Hello World" // only needed for fill and select
}
Returns:
Extracts specific content from the current page.
Tool: extract
Parameters: {
"browserId": "browser-id-from-browse",
"pageId": "page-id-from-browse",
"type": "text" // can be "text", "html", or "screenshot"
}
Returns:
Closes a browser to free resources.
Tool: close
Parameters: {
"browserId": "browser-id-from-browse"
}
Launch a browser and navigate to a site:
Tool: browse
Parameters: {
"url": "https://example.com/login",
"headless": false
}
Fill in a login form:
Tool: interact
Parameters: {
"browserId": "browser-id-from-step-1",
"pageId": "page-id-from-step-1",
"action": "fill",
"selector": "#username",
"value": "[email protected]"
}
Fill in password:
Tool: interact
Parameters: {
"browserId": "browser-id-from-step-1",
"pageId": "page-id-from-step-1",
"action": "fill",
"selector": "#password",
"value": "password123"
}
Click the login button:
Tool: interact
Parameters: {
"browserId": "browser-id-from-step-1",
"pageId": "page-id-from-step-1",
"action": "click",
"selector": "#login-button"
}
Extract text to verify login:
Tool: extract
Parameters: {
"browserId": "browser-id-from-step-1",
"pageId": "page-id-from-step-1",
"type": "text"
}
Close the browser:
Tool: close
Parameters: {
"browserId": "browser-id-from-step-1"
}
This project is licensed under the MIT License - see the LICENSE file for details.
You can run this server using Docker:
docker run -it --rm dylangroos/patchright-mcp
Build the Docker image:
docker build -t patchright-mcp .
Run the container:
docker run -it --rm patchright-mcp
The image is automatically published to Docker Hub when changes are merged to the main branch. You can find the latest image at: dylangroos/patchright-mcp