Skip to main content
Glama

Playwright MCP Server

by nolecram
MIT License

Playwright MCP Server

A powerful Model Context Protocol (MCP) server that provides comprehensive browser automation capabilities using Playwright. This server enables AI assistants to interact with web pages, perform automated testing, web scraping, and complex browser-based workflows.

🚀 Quick Install for VSCode

Install this MCP server directly in VSCode with one click:

✨ Features

  • 🌐 Complete Browser Control: Navigate, click, type, and interact with any web element
  • 📸 Screenshot & Visual Testing: Capture full pages or specific elements
  • 🔄 Tab Management: Open, close, and switch between multiple browser tabs
  • 📝 Form Automation: Fill forms, select options, handle checkboxes and radio buttons
  • Smart Waiting: Wait for elements, network requests, or specific page states
  • 🔍 Content Extraction: Get text, attributes, and data from web pages
  • 💻 JavaScript Execution: Run custom JavaScript in the browser context
  • 🛡️ Robust Error Handling: Comprehensive error handling with meaningful messages

📦 Installation

Prerequisites

  • Python 3.8 or higher
  • Node.js (required for Playwright browser installation)

Install from PyPI

pip install playwright-mcp-server playwright install chromium

Install from Source

git clone https://github.com/nolecram/Build_MCP_Server.git cd Build_MCP_Server pip install -e . playwright install chromium

🔧 Configuration

For MCP Clients

Add to your MCP client configuration:

{ "mcpServers": { "playwright": { "command": "playwright-mcp-server", "args": [] } } }

For VSCode MCP Extension

Add to your VSCode settings:

{ "mcp.servers": { "playwright": { "command": "playwright-mcp-server" } } }

🛠️ Available Tools

ToolDescriptionParameters
browser_navigateNavigate to a URLurl
browser_clickClick on an elementselector, timeout?
browser_typeType text into an elementselector, text, timeout?
browser_screenshotTake a screenshotpath?, full_page?
browser_get_textExtract text from an elementselector, timeout?
browser_wait_for_selectorWait for element to appearselector, timeout?, state?
browser_evaluateExecute JavaScriptscript
browser_new_tabOpen a new taburl?
browser_close_tabClose current tab-
browser_get_titleGet page title-
browser_get_urlGet current URL-

💡 Usage Examples

Web Scraping

# Navigate to a website browser_navigate {"url": "https://example.com"} # Wait for content to load browser_wait_for_selector {"selector": ".content"} # Extract information browser_get_text {"selector": ".price"} # Take a screenshot browser_screenshot {"full_page": true}

Form Automation

# Fill out a form browser_type {"selector": "#email", "text": "user@example.com"} browser_type {"selector": "#password", "text": "secretpassword"} browser_click {"selector": "#login-button"}

Testing Workflows

# Multi-step testing browser_navigate {"url": "https://app.example.com"} browser_click {"selector": "#feature-button"} browser_wait_for_selector {"selector": ".success-message"} browser_screenshot {"path": "test-result.png"}

🧪 Testing

Run the test suite:

# Install test dependencies pip install pytest pytest-asyncio # Run tests pytest tests/ # Run with coverage pytest --cov=playwright_mcp_server tests/

📚 Documentation

Comprehensive documentation is available in the docs directory:

🔒 Security

  • Runs in headless mode by default
  • Isolated browser contexts for each session
  • Automatic resource cleanup
  • Configurable timeout limits
  • No sensitive data logging

🤝 Contributing

We welcome contributions! Please see our contributing guidelines:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for your changes
  4. Ensure all tests pass
  5. Submit a pull request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Built with Playwright for reliable browser automation
  • Implements the Model Context Protocol specification
  • Inspired by the need for robust browser automation in AI workflows

📈 Roadmap

  • Support for multiple browser engines (Firefox, Safari)
  • Advanced element selection strategies
  • Built-in visual regression testing
  • Performance monitoring and metrics
  • Browser extension interaction
  • Mobile browser simulation

Star this repository if you find it useful!

-
security - not tested
A
license - permissive license
-
quality - not tested

A Model Context Protocol server that enables AI assistants to interact with web pages through browser automation, supporting web scraping, form filling, navigation, and other browser-based tasks using Playwright.

  1. 🚀 Quick Install for VSCode
    1. ✨ Features
      1. 📦 Installation
        1. Prerequisites
        2. Install from PyPI
        3. Install from Source
      2. 🔧 Configuration
        1. For MCP Clients
        2. For VSCode MCP Extension
      3. 🛠️ Available Tools
        1. 💡 Usage Examples
          1. Web Scraping
          2. Form Automation
          3. Testing Workflows
        2. 🧪 Testing
          1. 📚 Documentation
            1. 🔒 Security
              1. 🤝 Contributing
                1. 📄 License
                  1. 🙏 Acknowledgments
                    1. 📈 Roadmap

                      Related MCP Servers

                      • A
                        security
                        A
                        license
                        A
                        quality
                        A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
                        Last updated -
                        13
                        10,534
                        3,956
                        TypeScript
                        MIT License
                        • Linux
                        • Apple
                      • -
                        security
                        F
                        license
                        -
                        quality
                        Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.
                        Last updated -
                        2
                        TypeScript
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
                        Last updated -
                        3
                        Python
                        Apache 2.0
                      • A
                        security
                        A
                        license
                        A
                        quality
                        A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, generate test code, scrape web content, and execute JavaScript in real browser environments.
                        Last updated -
                        31
                        10,534
                        TypeScript
                        MIT License
                        • Linux
                        • Apple

                      View all related MCP servers

                      MCP directory API

                      We provide all the information about MCP servers via our MCP API.

                      curl -X GET 'https://glama.ai/api/mcp/v1/servers/nolecram/Build_MCP_Server'

                      If you have feedback or need assistance with the MCP directory API, please join our Discord server