infy-mcp-playwright
v1.1.18
Published
MCP Playwright server for web app testing automation via HTTP API
Maintainers
Readme
infy-mcp-playwright
MCP Playwright server for web app testing automation. Exposes an HTTP API to run Playwright tests (navigation, clicks, link checks, screenshots).
Install
npm install infy-mcp-playwrightOr install globally:
npm install -g infy-mcp-playwrightStart the server
Local project:
npm startGlobal CLI:
infy-mcp-playwrightThe server prints:
MCP Server Running on Port 3000Set PORT to change the listen port (default: 3000). Set HEADLESS=false to open a visible browser window.
Health check
Verify the server is running without starting a browser test:
curl http://localhost:3000/healthExpected response:
{
"status": "ok",
"service": "infy-mcp-playwright"
}Run a test request
curl -X POST http://localhost:3000/run-test \
-H "Content-Type: application/json" \
-d '{
"url": "https://perfectqaservices.com",
"checkLinks": {
"selector": "a"
}
}'Request body options
| Field | Description |
|-------|-------------|
| url | Page URL to open (required) |
| type | { selector, value } — fill an input |
| press | Keyboard key (e.g. "Enter") |
| click | { selector } — click an element |
| checkLinks | { selector } — visit each matching link and report status |
Programmatic API
const { runTest } = require('infy-mcp-playwright');
const result = await runTest({
url: 'https://example.com',
checkLinks: { selector: 'a' }
});Enhanced checks and outputs
worker.js performs additional runtime checks and produces reports and artifacts automatically. Notable request options and outputs:
Request body options:
browser:chromium|firefox|webkit— choose the engine (default:chromium).headless:boolean— run with a visible browser whenfalse(default:true).mobile:boolean— emulateiPhone 13whentrue.darkMode:boolean— set page color scheme to dark whentrue.slowMo:number— slow motion in ms for Playwright (default:200).
Runtime checks performed: performance metrics (dns, tcp, ttfb, dom/load times), memory usage, empty-page detection, infinite-loader detection (common loader selectors), basic SEO extraction (title, meta description, h1, canonical), broken images, console errors, page JS errors, failed requests and network failures (status >= 400), slow API detection (>5s), and accessibility scans via
axe-core.Link checking: visits links matched by
checkLinks.selector(defaulta) with up to 3 retries, captures a screenshot per visited page, and marks each asPASSEDorFAILED.Artifacts & reports: saved under
artifacts/,videos/,json-reports/andreports/. The worker writes a JSON report (json-reports/report-<ts>.json) and an HTML report (reports/report-<ts>.html) and stores screenshots inartifacts/.Response object: the API returns a structured object containing
status,browser,loadTime,performanceMetrics,memoryUsage,seo,totalPages,passed,failed,brokenImages,consoleErrors,jsErrors,failedRequests,networkFailures,slowApis,accessibilityIssues,checkedPages,aiSummary,htmlReport,jsonReport, andscreenshot(final screenshot path).
Example curl request using the new options:
curl -X POST http://localhost:3000/run-test \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"browser": "firefox",
"headless": false,
"mobile": false,
"darkMode": true,
"slowMo": 100,
"checkLinks": { "selector": "a" }
}'Publish to npm
- Log in:
npm login - Dry-run:
npm pack --dry-run - Publish:
npm publish
License
ISC
