A Model Context Protocol (MCP) server that brings Playwright browser automation to LLMs, agents, and automation frameworks.
Interact with real browsers, inject cookies/localStorage, take screenshots, generate code, scrape web pages, and more—all via a unified tool interface.
- Full Playwright Automation: Chromium, Firefox, and WebKit support.
- Session Injection: Set cookies and localStorage before navigation (simulate logged-in or pre-configured sessions).
- Web Interaction: Click, fill, select, hover, upload files, drag, and more.
- Navigation & Tabs: Open URLs, switch tabs, go back/forward, set user agent, headless mode, etc.
- Screenshots & Output: Capture screenshots, save as PDF, extract visible text/HTML.
- API Testing: Perform HTTP GET/POST/PUT/PATCH/DELETE requests.
- Console & JS: Retrieve browser console logs, execute JavaScript.
- Code Generation: Record and generate Playwright test scripts.
- Resource Access: Download screenshots, logs, and more.
npm install -g playwright-mcp-server-customOr use with npx:
npx playwright-mcp-server-customStart the MCP server:
playwright-mcp-serveror
npx playwright-mcp-server-customThe server will listen for MCP tool requests via stdio (for integration with LLM agents, automation clients, or your own scripts).
{
"cookies": [
{
"domain": ".example.com",
"name": "sessionid",
"value": "abc123",
"path": "/",
"expirationDate": 9999999999,
"httpOnly": true,
"secure": true,
"sameSite": "Lax"
}
],
"origins": [
{
"origin": "https://example.com",
"localStorage": [
{ "name": "user", "value": "{\"id\":1,\"name\":\"Alice\"}" }
]
}
]
}Tool name: playwright_set_session_data
{
"url": "https://www.hubtel.com"
}Tool name: playwright_navigate
{
"name": "homepage",
"fullPage": true
}Tool name: playwright_screenshot
playwright_set_session_data— Set cookies and localStorage before navigationplaywright_navigate— Open a URLplaywright_click,playwright_fill,playwright_select,playwright_hover,playwright_upload_file,playwright_drag,playwright_press_keyplaywright_screenshot,playwright_save_as_pdfplaywright_get,playwright_post,playwright_put,playwright_patch,playwright_deleteplaywright_console_logs,playwright_evaluateplaywright_start_codegen_session,playwright_end_codegen_session, etc.- ...and more!
See the Supported Tools documentation for full details.
This project uses Jest for testing.
Run all tests:
npm testWith coverage:
npm run test:coverage- Fork the repo and create a feature branch.
- Add new tools by implementing the
ToolHandlerinterface and registering your tool insrc/tools.tsandsrc/toolHandler.ts. - Keep tool names short (for compatibility with LLM clients).
- Submit a pull request!
MIT License
Copyright (c) 2025 DevMorph
Originally inspired by ExecuteAutomation's Playwright MCP Server.
Maintained by DevMorph.
Happy automating!