BrowserLoop MCP Server: Playwright Full-Page Element Screenshots
Capture high-quality full-page and element screenshots with the BrowserLoop MCP server using Playwright, configurable formats, viewports, and cookie-based auth.
Overview
BrowserLoop MCP Server is a lightweight, Playwright-backed microservice that captures high-quality screenshots and PDFs of web pages and specific DOM elements. It implements a Model Context Protocol (MCP) compatible HTTP endpoint so language models and other automation tooling can request rendered snapshots with a single JSON call — without having to manage headless browser lifecycles or Playwright configuration directly.
This server is useful for developers building web scrapers, visual regression pipelines, monitoring tools, or AI agents that need precise visual context. It supports full-page captures, element clipping by selector, configurable viewports and device pixel ratios, cookie-based authentication, and output formats suitable for automation (PNG, JPEG, WebP, PDF).
Features
- Playwright-based rendering for Chromium/Firefox/WebKit
- Full-page and element-specific screenshots
- PDF export (print-style) in addition to bitmap formats
- Format options: PNG, JPEG, WebP, PDF
- Configurable viewport size, deviceScaleFactor and quality
- Cookie-based authentication for logged-in pages
- Optional transparent background (omitBackground)
- Waiting strategies: fixed delay or wait-for-selector
- MCP-compatible HTTP API designed for model/tool integrations
- Runs locally or in containers; suitable for CI, servers, and agents
Installation / Configuration
Clone the repository and run the server locally, or use the provided Docker image.
Install and run locally (Node.js):
# clone
# install & build (if using Node)
Run with environment variables (examples):
# start on port 8080 with headless mode and limited concurrency
PORT=8080 HEADLESS=true MAX_CONCURRENCY=4
Docker example:
# Pull and run (image name may vary by project release)
Common environment variables
| Variable | Description | Default |
|---|---|---|
| PORT | HTTP port to listen on | 8080 |
| HEADLESS | Run browsers in headless mode (true/false) | true |
| MAX_CONCURRENCY | Max simultaneous Playwright contexts | 4 |
| LOG_LEVEL | Logging verbosity (debug/info/warn/error) | info |
Note: If you want to use a custom Playwright browser binary, provide the appropriate Playwright environment variables or mount browser artifacts into the container.
Available Resources
- GitHub repository: https://github.com/mattiasw/browserloop
- Playwright docs: https://playwright.dev
- MCP (Model Context Protocol): general MCP tooling and client libraries (useful when integrating with LLM agents)
API (MCP) — Screenshot Tool
The server exposes an MCP-compatible JSON HTTP endpoint. The request contains the tool name and an arguments object describing the capture. The following example demonstrates the most common fields.
Example request (curl):
A typical response returns a base64-encoded payload with content-type metadata:
Parameters reference
| Field | Type | Description |
|---|---|---|
| url | string | Target page URL (required) |
| selector | string | CSS selector to capture a specific element |
| fullPage | boolean | Capture entire page vertically (true/false) |
| format | string | png |
| quality | integer | 0–100 (for lossy formats) |
| viewport | object | { width, height } in pixels |
| deviceScaleFactor | number | DPR (e.g., 2 for Retina) |
| cookies | array | Array of browser cookie objects for auth |
| waitFor | number | string |
| timeout | number | Max time for navigation/operations (ms) |
| omitBackground | boolean | Make background transparent (PNG/WebP) |
| clip | object | { x, y, width, height } to capture absolute region |
| selectorPosition | string | top |
Use Cases
- Scheduled visual monitoring