A Model Context Protocol (MCP) server that exposes Playwright browser automation capabilities as tools for AI agents.
playwrightMCP/
├── src/ # Source code
│ ├── core/ # Core server functionality
│ │ ├── index.ts # Main server entry point
│ │ ├── server.ts # PlaywrightMCPServer class
│ │ └── mcp-http-server.ts # HTTP MCP server
│ ├── adapters/ # Server adapters
│ │ ├── http-mcp-adapter.ts # HTTP MCP adapter
│ │ ├── http-server.ts # HTTP server
│ │ ├── minimal-server.ts # Minimal server
│ │ └── railway-mcp-adapter.ts # Railway adapter
│ ├── clients/ # Client implementations
│ │ └── mcp-client.ts # MCP client
│ ├── monitoring/ # Monitoring and health checks
│ │ ├── monitor.ts # Server monitor
│ │ └── keepalive.js # Keep-alive script
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Utility functions
├── config/ # Configuration files
│ ├── environments/ # Environment-specific configs
│ │ ├── claude-desktop-*.json
│ │ └── railway-mcp-adapter-config.json
│ └── deployments/ # Deployment configurations
│ ├── Dockerfile*
│ ├── railway*.toml
│ └── nixpacks.toml
├── scripts/ # Scripts and automation
│ ├── setup/ # Setup scripts
│ │ ├── setup-claude-desktop.sh
│ │ └── start.sh
│ ├── testing/ # Test scripts
│ │ ├── test-*.js
│ │ └── test-*.sh
│ └── deployment/ # Deployment scripts
│ └── deploy-to-railway.sh
├── docs/ # Documentation
│ ├── setup/ # Setup guides
│ ├── deployment/ # Deployment guides
│ └── api/ # API documentation
├── examples/ # Example configurations
│ └── n8n-workflow-example.json
├── tests/ # Test suites
│ ├── helpers/
│ └── *.spec.ts
├── index.ts # Main entry point
├── package.json
├── tsconfig.json
└── playwright.config.ts
- Node.js 18+
- npm or yarn
- Playwright browsers installed
npm install
npx playwright installnpm run dev
# or
MODE=stdio npx tsx index.tsMODE=http npx tsx index.ts
# or
PORT=3000 npx tsx index.tsnpm run dev- Start in development mode (stdio)npm run build- Build TypeScript to JavaScriptnpm start- Start production servernpm test- Run Playwright testsnpm run migrate- Run database migrationsnpm run migrate:status- Check migration status
MODE- Server mode:stdioorhttp(default:stdio)PORT- HTTP server port (default:3000)PLAYWRIGHT_MCP_AUTH_TOKEN- Authentication token for HTTP mode
Add to your MCP client configuration:
{
"playwright-mcp": {
"command": "node",
"args": ["/path/to/playwrightMCP/dist/index.js"],
"cwd": "/path/to/playwrightMCP",
"env": {
"MODE": "stdio"
}
}
}- Core: Essential server functionality and MCP protocol implementation
- Adapters: Different ways to expose the server (HTTP, Railway, etc.)
- Clients: MCP client implementations for testing
- Monitoring: Health checks, keep-alive, and monitoring tools
- Config: Environment-specific and deployment configurations
- Scripts: Automation and utility scripts organized by purpose
- Docs: Comprehensive documentation organized by topic
- Core functionality: Add to
src/core/ - New adapters: Add to
src/adapters/ - Client tools: Add to
src/clients/ - Monitoring: Add to
src/monitoring/ - Types: Add to
src/types/ - Utilities: Add to
src/utils/
- Setup Guide - Detailed setup instructions
- Deployment Guide - Deployment to various platforms
- API Documentation - API reference and examples
- Follow the established folder structure
- Add appropriate documentation
- Include tests for new features
- Update this README if adding new top-level directories
MIT