Click on "Install 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 MCP HTTP Servertake a screenshot of the homepage for example.com"
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 MCP HTTP Server
A standalone HTTP service that wraps the official @playwright/mcp package to provide browser automation capabilities via HTTP endpoints. This service enables the use of Playwright MCP in serverless environments where STDIO-based communication is not possible.
π― Now Enhanced as a Visual Sensor Skill - Beyond browser automation, this server provides intelligent, privacy-aware, and user-friendly web interaction capabilities.
Features
π Streamable-HTTP Transport - Implements the 2025 MCP standard for remote connections
π Bearer Token Authentication - Secure authentication required for production use
π Serverless Compatible - Works in serverless/cloud environments (Railway, Render, Fly.io, GCP Cloud Run, etc.)
π MCP v0.1 Compatible - Fully implements the Model Context Protocol specification
π‘ Server-Sent Events (SSE) - Bidirectional streaming support for real-time notifications
π Full Playwright Support - All Playwright browser automation tools available
π³ Docker Ready - Includes Dockerfile for easy containerization
β‘ Production Ready - Health checks, graceful shutdown, error handling
βοΈ Live Deployment - Pre-deployed to Google Cloud Run with HTTPS (see below)
π Visual Sensor Skill Features
π Snapshot-First Logic - Token-efficient accessibility tree snapshots (no full DOM needed)
π‘οΈ PII Blurring (Agentic Security) - Automatic redaction of emails, credit cards, phone numbers, and other PII from screenshots
π€ Human-in-the-Loop (Elicitation) - Detects MFA/login walls and requests user input instead of failing
π― High-Level Skills - Skill-based tools (e.g.,
perform_checkout) that handle complex workflows internally
See VISUAL_SENSOR_SKILL_IMPLEMENTATION.md for detailed documentation.
Quick Start
Prerequisites
Node.js 18+ (LTS recommended)
npm or yarn
Installation
The server will start on port 8931 by default. You can access:
Service Info: http://localhost:8931/
Health Check: http://localhost:8931/health
MCP Endpoint: http://localhost:8931/mcp
POST - Send JSON-RPC messages (client-to-server)
GET - Open SSE connection (server-to-client) with
Accept: text/event-stream
π Live Production Instance
The service is deployed to Google Cloud Run and ready to use:
Service URL: https://playwright-mcp-http-server-554655392699.us-central1.run.app
Health Check: https://playwright-mcp-http-server-554655392699.us-central1.run.app/health
MCP Endpoint: https://playwright-mcp-http-server-554655392699.us-central1.run.app/mcp (POST only)
You can use the live instance immediately without deploying your own. See Usage Examples below.
Development
Configuration
Configuration is done via environment variables. Create a .env file or set environment variables:
Variable | Default | Description |
|
| HTTP server port |
|
| Browser type (chromium, firefox, webkit) |
|
| Run browser in headless mode |
|
| Logging level (error, warn, info, debug) |
| (unlimited) | Maximum concurrent browser sessions |
| (none) | Session timeout in seconds |
|
| CORS allowed origins |
| (none) | Bearer token for authentication (required for production) |
| (none) | GCP Secret Manager secret name (alternative to AUTH_TOKEN) |
| (auto) | GCP project ID (required if using AUTH_SECRET_NAME) |
See .env.example for a template.
Authentication
β οΈ Important: For production deployments, authentication is required to comply with the 2025 MCP Streamable-HTTP standard.
Setting Up Authentication
Direct Token (Development/Testing):
export AUTH_TOKEN="your-secure-token-here"GCP Secret Manager (Production - Recommended):
export AUTH_SECRET_NAME="playwright-mcp-auth-token" export GCP_PROJECT_ID="your-project-id"
See REGISTRY_CONFIG.md for detailed authentication setup instructions.
Using Authentication
All requests to /mcp require a bearer token:
API Documentation
POST /mcp
Main MCP protocol endpoint for client-to-server messages. Accepts JSON-RPC 2.0 messages.
Authentication: Required (Bearer token)
Request:
Response:
GET /health
Health check endpoint. Returns service status.
Response:
GET /
Service information endpoint.
Response:
Supported MCP Methods
The server supports all standard MCP methods:
initialize- Initialize MCP connectioninitialized- Confirm initializationtools/list- List available Playwright toolstools/call- Invoke a Playwright tool
Available Tools
Standard Playwright Tools
All tools from @playwright/mcp are supported:
browser_navigate- Navigate to a URLbrowser_snapshot- Get accessibility snapshot (uses accessibility tree for token efficiency)browser_take_screenshot- Capture screenshot (automatically redacts PII)browser_click- Click an elementbrowser_type- Type textbrowser_fill_form- Fill form fieldsbrowser_evaluate- Execute JavaScriptbrowser_wait_for- Wait for conditionsbrowser_close- Close browser/page
Custom Visual Sensor Skill Tools
get_accessibility_snapshot- Token-efficient accessibility tree snapshot (snapshot-first approach)Returns only interactive elements
Reduces token usage vs full DOM
Optimized for LLM consumption
perform_checkout- High-level checkout skillOrchestrates complete checkout process
Handles navigation, form filling, error handling, and retries internally
Returns only final confirmation
fill_form_skill- Intelligent form fillingAutomatically detects and fills form fields
Uses browser_fill_form internally with smart field detection
Note: Screenshots from browser_take_screenshot automatically have PII redacted before being returned. Login walls and MFA requirements automatically trigger elicitation requests via notifications.
For detailed tool parameters, see the Playwright MCP documentation and VISUAL_SENSOR_SKILL_IMPLEMENTATION.md.
Using the Server
Start locally with
npm install, build (npm run build), then runnpm start(or usenpm run devfor auto-reload during development).Call
/,/health, or/mcpvia curl/Postman/Playwright MCP clients; the/mcpendpoint accepts JSON-RPC POST requests (see the example below).Adjust behavior by editing
.envor setting env vars such asPORT,PLAYWRIGHT_BROWSER, andPLAYWRIGHT_HEADLESS.Alternatively, containerize the service with
docker build -t playwright-mcp-http-server .anddocker run -p 8931:8931 ...for consistent deployments.
Visual Sensor Skill Capabilities
The server automatically:
β Redacts PII from screenshots (emails, credit cards, phone numbers, SSNs)
β Detects login walls and sends elicitation requests via notifications
β Provides token-efficient snapshots via accessibility tree
β Offers high-level skills for complex workflows
See VISUAL_SENSOR_SKILL_IMPLEMENTATION.md for detailed documentation on these features.
Updating the GitHub Repository
Pull the latest changes before making edits:
git pull --rebase origin main.Use
git statusto see touched files, then stage withgit add <files>and commit with a descriptive message.Push your branch with
git push origin HEADand open a pull request if the change needs review.
Example Usage
Using curl
Using JavaScript/TypeScript
Note: For production, always use HTTPS and include the bearer token in the Authorization header.
GET /mcp (Streamable-HTTP)
Opens a Server-Sent Events (SSE) connection for server-to-client messages. This implements the Streamable-HTTP transport protocol.
Authentication: Required (Bearer token)
Headers: Accept: text/event-stream
Example:
The connection will:
Send connection confirmation
Forward MCP notifications from the Playwright process
Send periodic ping messages to keep the connection alive
Close gracefully when the client disconnects
Note:
POST
/mcpis for sending JSON-RPC requests (client-to-server)GET
/mcpis for receiving notifications via SSE (server-to-client)Both endpoints require authentication when
AUTH_TOKENorAUTH_SECRET_NAMEis set
Deployment
Railway
Create a new Railway project
Connect your Git repository
Railway will auto-detect Node.js and use
npm startSet environment variables if needed
Deploy!
The service will use Railway's $PORT environment variable automatically.
Render
Create a new Web Service on Render
Connect your Git repository
Build command:
npm install && npm run buildStart command:
npm startSet environment variables if needed
Deploy!
Google Cloud Platform (Cloud Run)
See DEPLOY_GCP.md for detailed instructions.
Quick deploy with authentication:
Windows PowerShell:
β οΈ Security Note: Always use authentication (AUTH_MODE=token or AUTH_MODE=secret) for production deployments. Public access (AUTH_MODE=public) should only be used for local development.
Or manually:
Fly.io
Install Fly CLI:
curl -L https://fly.io/install.sh | shLogin:
fly auth loginLaunch app:
fly launchDeploy:
fly deploy
Docker
Docker Compose
Streamable-HTTP (2025 MCP Standard)
This service implements the Streamable-HTTP transport protocol, which is the 2025 MCP standard for remote connections. Streamable-HTTP requires:
β HTTPS - Automatically provided by Cloud Run
β Bearer Token Authentication - Required for production use
β Server-Sent Events (SSE) - For server-to-client streaming
β POST Endpoint - For client-to-server JSON-RPC messages
Registry Configuration
To register this service with an MCP registry, use this configuration:
See REGISTRY_CONFIG.md for complete registry setup instructions.
Architecture
The service works by:
HTTP Server (Express) receives JSON-RPC requests and SSE connections
Authentication Middleware validates bearer tokens
MCP Handler processes the requests and routes them to Playwright
Playwright Process Manager spawns
@playwright/mcpas a child processSTDIO Communication handles JSON-RPC messages via stdin/stdout
SSE Streaming forwards server notifications to connected clients
Response is formatted and returned via HTTP
This architecture allows the Playwright process to run independently while being accessible via HTTP/HTTPS with full Streamable-HTTP support.
Troubleshooting
Service won't start
Check that Node.js 18+ is installed:
node --versionVerify dependencies are installed:
npm installCheck logs for error messages
Playwright browser not found
The browser will be downloaded automatically on first run
For Docker, ensure system dependencies are installed (included in Dockerfile)
Check network connectivity for browser downloads
High memory usage
Consider setting
MAX_SESSIONSto limit concurrent sessionsEnsure
browser_closeis called when done with a sessionMonitor for memory leaks in long-running processes
Timeout errors
Increase request timeout if operations take longer than 30 seconds
Check network connectivity to target URLs
Verify Playwright process is not crashed
Development
Project Structure
Building
Running Tests
Note: Tests are not yet implemented but planned for future releases
License
MIT
References
Support
For issues and questions, please open an issue on the repository.