playwright-slim-mcp

playwright-slim-mcp

A proxy MCP server that summarizes Playwright accessibility snapshots using Claude Haiku, reducing context usage for efficient browser automation.

Category
Visit Server

README

playwright-slim-mcp

A proxy MCP server for Playwright that summarizes accessibility snapshots using Claude Haiku to reduce context usage.

Quickstart

Add to your Claude Code MCP config (~/.claude.json):

{
  "mcpServers": {
    "playwright-slim": {
      "command": "npx",
      "args": ["playwright-slim-mcp"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

That's it! The proxy will automatically download and run.

Problem

The official @playwright/mcp returns full accessibility tree snapshots after every action (click, type, navigate, etc.). These snapshots can be 2-10KB+ each, quickly consuming context window.

Solution

This proxy:

  1. Forwards all requests to the real Playwright MCP
  2. Intercepts responses containing page snapshots
  3. Uses Anthropic API (Claude Haiku) to summarize snapshots to ~10 lines
  4. Preserves [ref=XXX] values for interactive elements so you can still click/type

Installation

Via npx (recommended)

No installation needed - just add to your MCP config as shown in Quickstart.

Global install

npm install -g playwright-slim-mcp

Then use in your MCP config:

{
  "mcpServers": {
    "playwright-slim": {
      "command": "playwright-slim-mcp",
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

From source

git clone https://github.com/jsdf/playwright-slim-mcp.git
cd playwright-slim-mcp
npm install
npm run build

Requirements

  • ANTHROPIC_API_KEY environment variable
  • Node.js 18+

Environment Variables

Variable Required Description
ANTHROPIC_API_KEY Yes Your Anthropic API key
PLAYWRIGHT_SLIM_MODEL No Model for summarization (default: claude-3-5-haiku-latest)
DEBUG or PLAYWRIGHT_SLIM_DEBUG No Set to 1 to enable file logging to logs/

Configuration

The proxy summarizes snapshots for these tools:

  • browser_click
  • browser_type
  • browser_press_key
  • browser_select_option
  • browser_hover
  • browser_drag
  • browser_navigate
  • browser_navigate_back
  • browser_handle_dialog
  • browser_file_upload
  • browser_fill_form
  • browser_snapshot

Small snapshots (<500 chars) are passed through unchanged.

Unsummarized Snapshots

Use browser_snapshot_full to get the raw accessibility tree without summarization. This tool is automatically added as an alias.

Testing

# Create .env file with your API key
echo "ANTHROPIC_API_KEY=sk-ant-..." > .env

# Run tests (includes real API calls and browser tests)
npm test

Example

Before (2KB+):

- generic [ref=e327]:
  - generic [ref=e328]:
    - heading "Go back James's Workspace" [level=4] [ref=e329]:
      - button "Go back" [ref=e330] [cursor=pointer]:
        - img [ref=e331]
      - text: James's Workspace
    # ... 100+ more lines

After (~200 bytes):

Admin settings for "James's Workspace"
Tabs: Overview [e343], Feature flags [e348, selected], Members [e353], Tables [e358]
Actions: Go back [e330], Impersonate [e334]

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured