home / mcp / playwright mcp server
Provides browser automation via MCP by managing sessions, pages, and network requests across Chromium, Firefox, and WebKit.
Configuration
View docs{
"mcpServers": {
"leviathangk-playwrightmcpforcrawler": {
"command": "node",
"args": [
"@leviathangk/playwright-mcp@latest",
"--browser",
"chromium",
"--headless",
"false",
"--session-timeout",
"300000",
"--max-sessions",
"10"
]
}
}
}The Playwright MCP Server lets you manage multiple browser automation sessions across Chromium, Firefox, and WebKit. It supports concurrent sessions, page/tab management, navigation, user input, and network inspection, all through a structured MCP interface that you can drive from your own client.
You control the server by issuing well-defined tool calls from your MCP client. Each session runs in isolation, so you can create multiple sessions, perform browser actions in each, and gather results without interference.
Key usage patterns include creating a session, navigating pages, interacting with elements, and inspecting network activity. You can manage multiple pages within a session, switch focus between them, and collect structured data from the page. When you are finished, close the session to free resources.
Example usage flow in your client: - Create a new browser session - Navigate to a URL - Perform actions like clicking elements or typing text - Retrieve page data or inspect network requests - Close the session when done
npm i @leviathangk/playwright-mcpNext, configure the MCP Server so your client can load and start the Playwright MCP endpoint.
- The server runs as a local process started through an MCP command with Node. You can customize browser type, headless mode, session timeout, and max concurrent sessions.
- Core options you can set when starting the server include which browser to use, whether to run headless, session timeout in milliseconds, and the maximum number of concurrent sessions.
Configure the MCP to run the Playwright MCP Server with Chromium in non-headless mode and specific session limits as shown in the example below. This config is added to your MCP Server configuration under mcpServers.
{
"mcpServers": {
"playwright": {
"command": "node",
"args": [
"@leviathangk/playwright-mcp@latest",
"--browser", "chromium",
"--headless", "false",
"--session-timeout", "300000",
""--max-sessions"", "10"]
}
}
}- Sessions auto-clean up after timeout to free resources. Make sure your session timeout aligns with your workload.
- Keep the MCP server up to date to benefit from browser driver improvements and any safety updates.
Install Playwright browsers for the server (Chromium, Firefox, WebKit).
Create a new browser automation session to run in parallel with any active sessions.
Terminate a specific session and release associated resources.
Return a list of all open pages (tabs) within a session.
Open a new page (tab) in the specified session.
Switch focus to a specified page in a session.
Close a specific page within a session.
Navigate the active page to a given URL.
Click an element matching a selector on the active page.
Type text into an element on the active page.
Scroll the active page to a specified position.
Wait for a specific element to appear on the page.
Run custom JavaScript in the context of the active page.
Analyze and retrieve the structure of the current page.
Find an element by visible text.
Query elements using CSS selectors.
Fetch the page content in HTML or text formats.
Extract the text content from a specific element.
Capture a screenshot of the page or element.
Search captured network requests with optional regex filters.
Retrieve all captured network requests for the session.
Get detailed information about a request, including curl commands.
Clear the captured network request history.