# node-playwrite **Repository Path**: leemuyang/node-playwrite ## Basic Information - **Project Name**: node-playwrite - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-10-28 - **Last Updated**: 2025-10-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Playwright MCP Service Node-based MCP server exposing a Playwright-powered tool that captures a web page's text, HTML, and screenshot as base64. ## Setup ```bash npm install npx playwright install chromium ``` The explicit browser install command ensures the required Chromium binary is present in environments where Playwright cannot download browsers automatically. ## Run ```bash npm start ``` The server listens on port `3000` by default. Override with the `PORT` environment variable if required. ## MCP Endpoint The server speaks [Model Context Protocol](https://modelcontextprotocol.io) over Streamable HTTP at: ``` http://localhost:3000/mcp ``` It exposes a single tool named `snapshot`: - **Input** – `{ "url": "https://example.com" }` - **Structured output** – `{ url, title, text, html, screenshotBase64, screenshotMimeType }` - **Content** – text chunks with metadata plus the screenshot as an `image/png` ### 工具说明 - `snapshot`:使用 Playwright 打开指定 URL,等待网络稳定后抓取页面标题、正文文本、完整 HTML,并输出全页 PNG 截图(Base64)。适合快速了解页面内容或为后续分析提供原始数据和截图。 ### Quick test with MCP Inspector ```bash npx @modelcontextprotocol/inspector --server http://localhost:3000/mcp ``` Once connected, call the `snapshot` tool and supply a URL; the response will include the captured text, HTML markup, and a base64-encoded PNG screenshot. ## Production Deployment ### Docker ```bash docker build -t playwright-mcp . docker run -p 3000:3000 playwright-mcp ``` ### Docker Compose ```bash docker compose up --build ``` The images are based on the official Playwright runtime and already include the required Chromium browser. The service listens on port 3000 and exposes the MCP endpoint at `/mcp`. Configure your reverse proxy or orchestration stack to forward MCP traffic accordingly.