Playwright MCP Server for browser automation
This project implements a Model Context Protocol (MCP) server using Playwright for browser automation. It provides an example MCP server and client integration, supporting prompt templates, resource listing, and tool calls.
- MCP server implementation using
@modelcontextprotocol/sdk
- Playwright-based browser automation
- Example prompt and resource handlers
- Automated tests with Playwright and Jest
- TypeScript support
- Node.js (v18+ recommended)
- npm
npm install
npm run install-browsers
npm start
npm test
Or to run Playwright UI tests:
npm run test:ui
src/index.ts
: MCP server implementationtests/automation.test.ts
: Playwright and MCP client integration testspackage.json
: Project metadata and scriptstsconfig.json
: TypeScript configurationtest.config.js
: Jest configuration
The server exposes prompt templates and resources via MCP. The client can connect and interact with the server, as shown in the integration tests.