Playwright

microsoft
8849
Microsoft's official Playwright Tool
#mcp #playwright

Overview

What is Playwright

playwright-mcp is a Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. It allows large language models (LLMs) to interact with web pages through structured accessibility snapshots, eliminating the need for screenshots or visually-tuned models.

How to Use

To use playwright-mcp, install it via the VS Code CLI with the command: `code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'`. After installation, it can be utilized with GitHub Copilot in VS Code.

Key Features

Key features include being fast and lightweight by using Playwright's accessibility tree instead of pixel-based input, being LLM-friendly as it operates purely on structured data without the need for vision models, and providing deterministic tool application to avoid ambiguity common in screenshot-based approaches.

Where to Use

playwright-mcp can be used in various fields such as web navigation, automated form-filling, data extraction from structured content, automated testing driven by LLMs, and general-purpose browser interactions for agents.

Use Cases

Use cases include web navigation and form-filling, data extraction from structured content, automated testing driven by LLMs, and general-purpose browser interaction for agents.

Installation

Generate your exclusive SSE URL:

MCP Server Configuration (for all clients):

Installation in Cursor

1. Click on the Cursor settings icon in the top right, find the 'MCP' option in the left menu;
2. Click the '+ Add' button in the top right of that page, which will automatically open the mcp.json configuration file.
3. Paste the MCP configuration into the file and save it (no need to delete existing content).
4. The MCP settings interface will show a green dot when the configuration is correct.

Note: If the green status is not displayed, please try restarting Cursor.

Installation in Claude

1. Open 'Settings' in the top left corner of the Claude page, go to 'Developer', and click 'Edit Config' to locate the claude_desktop_config.json configuration file;
2. Paste the MCP configuration into the file and save it (insert in the appropriate position, without deleting existing content).

After completion, restart Claude, and you can use MCP functions through the Claude dialog

SDK

Installation in Python

Install composio-toolset by running the following commands in your terminal:

pip install composio_openai

Python example code:

from composio_openai import ComposioToolSet, App
from openai import OpenAI

openai_client = OpenAI()
composio_toolset = ComposioToolSet(entity_id="default")

tools = composio_toolset.get_tools(apps=[App.GITHUB])

Installation in TypeScript

Install composio-core by running the following commands in your terminal:

npm install -g composio_core

TypeScript example code:

import { OpenAI } from "openai";
import { OpenAIToolSet } from "composio-core";

const openaiClient = new OpenAI();
const composioToolset = new OpenAIToolSet();

const tools = await composioToolset.getTools({
  apps: ["github"],
});

Content

Tool List

browser_close

browser_wait

browser_resize

browser_console_messages

browser_handle_dialog

browser_file_upload

browser_install

browser_press_key

browser_navigate

browser_navigate_back

browser_navigate_forward

browser_network_requests

browser_pdf_save

browser_snapshot

browser_click

browser_drag

browser_hover

browser_type

browser_select_option

browser_take_screenshot

browser_tab_list

browser_tab_new

browser_tab_select

browser_tab_close