Skip to content

Commit 3a4eb9b

Browse files
committed
playwright mcp
1 parent 06e2517 commit 3a4eb9b

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

docs/mcp/playwright.mdx

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: 'Playwright'
3+
description: 'Using Playwright MCP with PraisonAI'
4+
---
5+
6+
# Playwright MCP
7+
8+
[Playwright](https://playwright.dev/) is a powerful browser automation tool that can be used with the Model Context Protocol (MCP) to enable agents to interact with web browsers.
9+
10+
## Installation
11+
12+
To use Playwright with MCP, you'll need to install the Playwright MCP package:
13+
14+
```bash
15+
npm install @playwright/mcp
16+
```
17+
18+
## Running the Playwright MCP Server
19+
20+
You need to run the Playwright MCP server in a separate terminal before your agent can use it:
21+
22+
```bash
23+
npx @playwright/mcp@latest --port 8931
24+
```
25+
26+
This will start a Playwright MCP server on port 8931 that your agent can connect to.
27+
28+
## Using Playwright MCP with PraisonAI
29+
30+
Once the Playwright MCP server is running, you can create an agent that uses it as a tool:
31+
32+
```python
33+
from praisonaiagents import Agent, MCP
34+
35+
search_agent = Agent(
36+
instructions="""You help search the web.""",
37+
llm="gpt-4o-mini",
38+
tools=MCP("http://localhost:8931/sse")
39+
)
40+
41+
search_agent.start("Find about Praison AI")
42+
```
43+
44+
The agent will be able to use Playwright to automate browser interactions and search the web.
45+
46+
## Advanced Configuration
47+
48+
You can customize the Playwright MCP server by passing additional options:
49+
50+
```bash
51+
npx @playwright/mcp@latest --port 8931 --browser chromium
52+
```
53+
54+
For more information on available options, refer to the [Playwright MCP documentation](https://github.com/microsoft/playwright/tree/main/packages/mcp).

docs/mint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@
251251
"mcp/anthropic",
252252
"mcp/gemini",
253253
"mcp/mistral",
254+
"mcp/playwright",
254255
"mcp/whatsapp",
255256
"mcp/perplexity",
256257
"mcp/ollama-python",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from praisonaiagents import Agent, MCP
2+
3+
search_agent = Agent(
4+
instructions="""You help search the web.""",
5+
llm="gpt-4o-mini",
6+
tools=MCP("http://localhost:8931/sse")
7+
)
8+
9+
search_agent.start("Find about Praison AI")

0 commit comments

Comments
 (0)