Playwright Smart MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Playwright Smart MCP Go to news.ycombinator.com and list the top 5 story titles"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Playwright Smart MCP
A token-efficient Playwright MCP server that exposes 4 smart tools instead of 22, reducing context window usage by ~85%.
β¨ New in v2.1
π§ Code Execution: New
browser_execute_codetool for complex UI interactionsπ₯οΈ Headed Mode: See the browser window, watch automation happen
πΎ Session Persistence: Log in once, stay logged in across sessions
π Auto-Save: Cookies & login state saved automatically after every action
β‘ Interactive Workflows: You log in, AI takes over
See FEATURES.md for full documentation on headed mode and session persistence.
Related MCP server: Cloudflare Playwright MCP
The Problem
The standard Playwright MCP server exposes 22 tools, each with full JSON schemas. This consumes ~5,000 tokens of your context window before you even do anything.
The Solution
This server consolidates all functionality into 4 high-level tools:
Tool | What It Does | Replaces |
| Navigate + capture screenshot | navigate, wait, screenshot |
| Navigate + get page content | navigate, snapshot, evaluate |
| Click, type, fill, scroll, etc. | 15+ interaction tools |
| Execute JavaScript in browser | evaluate, complex DOM manipulation |
Result: ~900 tokens instead of ~5,000 (82% reduction)
Installation
Option 1: Clone and Use Locally
git clone https://github.com/jaystarz1/playwright-smart-mcp.git
cd playwright-smart-mcp
npm installOption 2: npx (coming soon)
npx playwright-smart-mcpConfiguration
Claude Code (Global - All Projects)
Add to ~/.claude/settings.json:
{
"mcpServers": {
"playwright-smart": {
"type": "stdio",
"command": "node",
"args": ["/path/to/playwright-smart-mcp/server.js"]
}
}
}Claude Code (Project-Specific)
Add to your project's .claude.json or via CLI:
claude mcp add playwright-smart node /path/to/playwright-smart-mcp/server.jsClaude Desktop
Add to your Claude Desktop config:
{
"mcpServers": {
"playwright-smart": {
"command": "node",
"args": ["/path/to/playwright-smart-mcp/server.js"]
}
}
}Usage
browser_screenshot
Take a screenshot of any URL:
{
"url": "https://example.com",
"fullPage": true,
"waitFor": ".main-content"
}browser_extract
Get page content and links:
{
"url": "https://example.com",
"selector": ".article-body",
"includeLinks": true
}browser_interact
Execute a sequence of actions:
{
"url": "https://example.com/login",
"actions": [
{"type": "fill", "selector": "#email", "value": "user@example.com"},
{"type": "fill", "selector": "#password", "value": "secret"},
{"type": "click", "selector": "button[type=submit]"},
{"type": "wait", "selector": ".dashboard"}
],
"returnScreenshot": true
}Available action types:
click- Click an elementtype- Type text (keystroke by keystroke)fill- Fill a form field (faster than type)select- Select dropdown optionwait- Wait for element or timeoutscroll- Scroll the pagepress- Press a keyboard key (Enter, Tab, etc.)
browser_execute_code
Execute JavaScript in the browser context when standard interactions fail:
{
"code": "document.querySelector('[placeholder*=\"Add people\"]').value = 'user@example.com'; return 'Email entered';"
}Use cases:
Complex React/Vue components that don't respond to standard selectors
Dynamic UI elements that require custom event dispatching
DOM manipulation that's simpler with JavaScript than chained interactions
Extracting data in custom formats
Example: Sharing Google Drive folder
{
"code": "const input = document.querySelector('[placeholder*=\"Add people\"]'); if (input) { input.value = 'user@example.com'; input.dispatchEvent(new Event('input', { bubbles: true })); return 'Email added'; } return 'Input not found';"
}Example: Form Submission
Instead of 6+ tool calls with standard Playwright MCP:
browser_navigate β form page
browser_type β email field
browser_type β password field
browser_click β submit button
browser_wait_for β success message
browser_screenshot β capture resultDo it in one call:
{
"tool": "browser_interact",
"arguments": {
"url": "https://example.com/signup",
"actions": [
{"type": "fill", "selector": "#email", "value": "user@example.com"},
{"type": "fill", "selector": "#password", "value": "secret123"},
{"type": "click", "selector": "button[type=submit]"},
{"type": "wait", "selector": ".welcome-message"}
],
"returnScreenshot": true
}
}Why This Approach?
Based on Anthropic's engineering blog post on code execution with MCP, which advocates for progressive disclosure of tool capabilities and code execution as an escape hatch.
"Models are great at navigating filesystems. Presenting tools as code on a filesystem allows models to read tool definitions on-demand, rather than reading them all up-front."
This server takes that principle and applies it to browser automation:
High-level tools (
browser_interact) handle 95% of use casesCode execution (
browser_execute_code) handles the edge cases when selectors failResult: Scalpel approach vs sledgehammer - fewer tools, smarter usage
Token Comparison
Server | Tools | Est. Tokens | Use Case |
Playwright MCP | 22 | ~5,000 | Full control needed |
Playwright Smart | 4 | ~900 | Most automation tasks + edge cases |
License
MIT
Contributing
PRs welcome! Ideas for improvement:
Add
browser_pdftool for PDF generationAdd
browser_recordfor session recordingSupport for multiple tabs/contexts
Pre-defined workflows (login, form submit, scrape)
Credits
Built on Playwright
Inspired by Anthropic's MCP documentation
Created by Jay Tarzwell / The Chatbot Genius
Available Tools
4 toolsbrowser_execute_codeB
Execute JavaScript code in the current browser page context. Use this when standard interactions fail due to complex UI components.
Inputs: code (required).
browser_extractB
Navigate to a URL and extract page content. Returns text content and page structure.
Inputs: url (required), selector, includeLinks.
browser_interactC
Interact with a web page - navigate, click, type, fill forms, select options. Executes a sequence of actions.
Inputs: actions (required), url, returnContent, returnScreenshot.
browser_screenshotB
Navigate to a URL and take a screenshot. Returns the screenshot as base64.
Inputs: url (required), waitFor, fullPage.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 4 tools
Each tool targets a distinct function: capture (screenshot), read (extract), act (interact), and fall back to raw code (execute_code). The overlap between browser_interact and browser_execute_code is deliberate but could cause misselection since both can perform clicks/typing, with the latter described as a fallback. All tools start with navigation, so an agent must infer whether state persists across calls.
All names use a consistent browser_ prefix and mostly verb or verb_noun forms (extract, interact, execute_code). browser_screenshot is a noun where the others are verbs, which is a minor deviation but still readable and predictable.
Four tools is well-scoped for a browser automation server; each covers a distinct capability layer (visual, textual, interactive, programmatic) and none feels redundant or missing a sibling.
The surface lacks explicit tools for waiting/asserting, reading console or network logs, and inspecting the current page without re-navigating, which are common browser automation needs. browser_execute_code can work around some of these, but the lifecycle is somewhat thin.
Maintenance
Related MCP Connectors
Playwright browser automation β navigate, click, fill forms, extract, screenshot β 17 agent tools.
Hosted browser for agents: open pages, search the web, extract data, read PDFs and take screenshots.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Cloud browser, web extraction, screenshots, and remote CDP tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0