npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

playread

v1.2.8

Published

Web content extraction and automation via Playwright MCP

Downloads

36

Readme

playpen

Google search automation via Playwright MCP. Can be used as a CLI tool or as an MCP server.

Installation

npm install -g playpen

Or use directly with npx:

npx -y playpen@latest google-search

Usage

As an MCP Server (Stdio)

Start playpen as a stdio MCP server to expose all flows as tools:

playpen mcp

Or configure in your MCP client settings (e.g., Claude Desktop):

{
  "mcpServers": {
    "playpen": {
      "command": "npx",
      "args": ["-y", "playpen@latest", "mcp"]
    }
  }
}

Available MCP tools:

  • fetch - Fetch and extract main content from a web page URL
  • google-search - Perform a Google search and extract results

As an HTTP MCP Server (Remote Access)

For remote client access over HTTP, start the HTTP server:

npm run http
# or
node http-server.js

The server listens on http://localhost:3000 (configurable via PORT env var).

Endpoints:

  • POST /mcp - MCP protocol endpoint (Streamable HTTP transport)
  • GET /health - Health check endpoint

Client Configuration:

For an MCP client to connect remotely via HTTP:

{
  "mcpServers": {
    "playread-http": {
      "url": "http://localhost:3000/mcp"
    }
  }
}

Or via environment variable:

PORT=8080 npm run http

Deployment:

Option 1: Docker Compose (Local & Production)

docker-compose up -d
# Visit http://localhost:3000/health to verify

Option 2: Nixpacks (Cloud Deployment)

# Builds with all dependencies including Playwright and Chromium
nixpacks build .

Option 3: Coolify

  • Connect your GitHub repository (AnEntrypoint/playread)
  • Set PORT=3000 in environment variables
  • Coolify will automatically use the Dockerfile for deployment

Option 4: Docker Build Directly

docker build -t playread:latest .
docker run -p 3000:3000 playread:latest

The Dockerfile includes all required system dependencies for Playwright browser automation with Chromium.

See DEPLOYMENT.md for detailed troubleshooting and configuration guides.

As a CLI Tool

Google Search

playpen google-search

Output format:

{
  "query": "Playwright automation testing",
  "totalResults": 18,
  "results": [
    {
      "title": "Playwright: Fast and reliable end-to-end testing for modern ...",
      "url": "https://playwright.dev/",
      "description": "Playwright enables reliable end-to-end testing for modern web apps..."
    }
  ]
}

Fetch URL Content

Extract important text content from any URL:

playpen fetch https://example.com

Output format:

{
  "url": "https://example.com/",
  "title": "Example Domain",
  "contentLength": 129,
  "content": "# Example Domain\nThis domain is for use in documentation examples..."
}

Perfect for:

  • Extracting documentation from websites
  • Fetching article content
  • Parsing blog posts
  • Getting README content from GitHub
  • Any text-heavy webpage

Creating Custom Flows

Flows are JavaScript modules that export a single async function. The function receives a connected PlaywrightMCPClient instance.

Create a new flow in the flows/ directory:

module.exports = async function(client) {
  await client.navigate('https://example.com');

  const snapshot = await client.snapshot();
  console.log('Page loaded');

  await client.close();
};

Available Client Methods

Connection

  • connect() - Connect to Playwright MCP server
  • disconnect() - Disconnect and cleanup

Tools Discovery

  • listTools() - List all available tools
  • callTool(name, args) - Call any tool directly

Browser Control

  • navigate(url) - Navigate to URL
  • navigateBack() - Go back
  • close() - Close browser
  • resize(width, height) - Resize window
  • install() - Install browser

Page Interaction

  • snapshot() - Get accessibility snapshot
  • click(element, ref) - Click element
  • type(element, ref, text, submit, slowly) - Type text
  • pressKey(key) - Press keyboard key
  • hover(element, ref) - Hover over element
  • drag(startElement, startRef, endElement, endRef) - Drag and drop

Forms

  • fillForm(fields) - Fill multiple form fields
  • selectOption(element, ref, values) - Select dropdown option
  • fileUpload(paths) - Upload files

Page State

  • evaluate(func) - Execute JavaScript
  • screenshot(filename, type, fullPage, element, ref) - Take screenshot
  • consoleMessages(onlyErrors) - Get console logs
  • networkRequests() - Get network activity

Dialogs

  • handleDialog(accept, promptText) - Handle alerts/confirms

Tabs

  • tabs(action, index) - Manage browser tabs

Wait

  • waitFor(text, textGone, time) - Wait for conditions

Flow Details

google-search

  • Navigates to Google
  • Searches for "Playwright automation testing"
  • Waits 30 seconds for results to load
  • Extracts all result titles, URLs, and descriptions
  • Returns comprehensive JSON output with full result metadata

fetch

  • Accepts a URL as an argument
  • Navigates to the URL
  • Intelligently extracts main content using heuristics:
    • Prioritizes <main>, <article>, and semantic content areas
    • Extracts structured text including headings, paragraphs, lists, and code blocks
    • Removes duplicate content and navigation elements
    • Formats output as clean markdown
  • Returns JSON with URL, title, content length, and extracted content
  • Limits output to 50,000 characters for conciseness
  • Works universally across documentation sites, blogs, articles, and more

Requirements

  • Node.js 14+
  • Playwright MCP server (installed automatically via npx)

Notes

  • Always close the browser before flows complete
  • Supports file:// URLs for local testing
  • Use browser_evaluate for debugging window globals
  • No hardcoded values - all flows use ground truth from snapshots
  • Screenshots are automatically saved to /tmp/playwright-mcp-output/<timestamp>/