@szymonrybczak/playwright-mcp 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +21 -8
- package/lib/cjs/_virtual/_commonjsHelpers.js +9 -0
- package/lib/cjs/_virtual/browser.js +11 -0
- package/lib/cjs/_virtual/browser2.js +7 -0
- package/lib/cjs/cloudflare/package.json.js +10 -0
- package/lib/cjs/index.js +28 -0
- package/lib/cjs/node_modules/debug/src/browser.js +290 -0
- package/lib/cjs/node_modules/debug/src/common.js +307 -0
- package/lib/cjs/node_modules/ms/index.js +176 -0
- package/lib/cjs/package.js +9 -0
- package/lib/cjs/src/browserContextFactory.js +240 -0
- package/lib/cjs/src/config.js +77 -0
- package/lib/cjs/src/connection.js +74 -0
- package/lib/cjs/src/context.js +281 -0
- package/lib/cjs/src/fileUtils.js +25 -0
- package/lib/cjs/src/index.js +15 -0
- package/lib/cjs/src/javascript.js +41 -0
- package/lib/cjs/src/manualPromise.js +39 -0
- package/lib/cjs/src/pageSnapshot.js +35 -0
- package/lib/cjs/src/tab.js +91 -0
- package/lib/cjs/src/tools/common.js +60 -0
- package/lib/cjs/src/tools/console.js +36 -0
- package/lib/cjs/src/tools/dialogs.js +44 -0
- package/lib/cjs/src/tools/files.js +43 -0
- package/lib/cjs/src/tools/install.js +49 -0
- package/lib/cjs/src/tools/keyboard.js +38 -0
- package/lib/cjs/src/tools/navigate.js +85 -0
- package/lib/cjs/src/tools/network.js +43 -0
- package/lib/cjs/src/tools/pdf.js +42 -0
- package/lib/cjs/src/tools/screenshot.js +69 -0
- package/lib/cjs/src/tools/snapshot.js +195 -0
- package/lib/cjs/src/tools/tabs.js +110 -0
- package/lib/cjs/src/tools/testing.js +52 -0
- package/lib/cjs/src/tools/tool.js +9 -0
- package/lib/cjs/src/tools/utils.js +75 -0
- package/lib/cjs/src/tools/vision.js +181 -0
- package/lib/cjs/src/tools/wait.js +51 -0
- package/lib/cjs/src/tools.js +54 -0
- package/lib/esm/_virtual/_commonjsHelpers.js +5 -0
- package/lib/esm/_virtual/browser.js +7 -0
- package/lib/esm/_virtual/browser2.js +3 -0
- package/lib/esm/cloudflare/package.json.js +5 -0
- package/lib/esm/index.js +24 -0
- package/lib/esm/node_modules/debug/src/browser.js +286 -0
- package/lib/esm/node_modules/debug/src/common.js +303 -0
- package/lib/esm/node_modules/ms/index.js +172 -0
- package/lib/esm/package.js +5 -0
- package/lib/esm/src/browserContextFactory.js +216 -0
- package/lib/esm/src/config.js +72 -0
- package/lib/esm/src/connection.js +69 -0
- package/lib/esm/src/context.js +277 -0
- package/lib/esm/src/fileUtils.js +20 -0
- package/lib/esm/src/index.js +11 -0
- package/lib/esm/src/javascript.js +35 -0
- package/lib/esm/src/manualPromise.js +35 -0
- package/lib/esm/src/pageSnapshot.js +31 -0
- package/lib/esm/src/tab.js +87 -0
- package/lib/esm/src/tools/common.js +56 -0
- package/lib/esm/src/tools/console.js +32 -0
- package/lib/esm/src/tools/dialogs.js +40 -0
- package/lib/esm/src/tools/files.js +39 -0
- package/lib/esm/src/tools/install.js +45 -0
- package/lib/esm/src/tools/keyboard.js +34 -0
- package/lib/esm/src/tools/navigate.js +81 -0
- package/lib/esm/src/tools/network.js +39 -0
- package/lib/esm/src/tools/pdf.js +38 -0
- package/lib/esm/src/tools/screenshot.js +65 -0
- package/lib/esm/src/tools/snapshot.js +191 -0
- package/lib/esm/src/tools/tabs.js +106 -0
- package/lib/esm/src/tools/testing.js +48 -0
- package/lib/esm/src/tools/tool.js +5 -0
- package/lib/esm/src/tools/utils.js +68 -0
- package/lib/esm/src/tools/vision.js +177 -0
- package/lib/esm/src/tools/wait.js +47 -0
- package/lib/esm/src/tools.js +49 -0
- package/package.json +15 -44
- package/LICENSE +0 -202
- package/README.md +0 -508
- package/cli.js +0 -18
- package/config.d.ts +0 -128
- package/index.js +0 -19
- package/lib/browserContextFactory.js +0 -227
- package/lib/browserServer.js +0 -151
- package/lib/config.js +0 -189
- package/lib/connection.js +0 -82
- package/lib/context.js +0 -291
- package/lib/fileUtils.js +0 -32
- package/lib/httpServer.js +0 -201
- package/lib/index.js +0 -36
- package/lib/javascript.js +0 -49
- package/lib/manualPromise.js +0 -111
- package/lib/package.js +0 -20
- package/lib/pageSnapshot.js +0 -43
- package/lib/program.js +0 -72
- package/lib/server.js +0 -48
- package/lib/tab.js +0 -101
- package/lib/tools/common.js +0 -68
- package/lib/tools/console.js +0 -44
- package/lib/tools/dialogs.js +0 -52
- package/lib/tools/files.js +0 -51
- package/lib/tools/install.js +0 -57
- package/lib/tools/keyboard.js +0 -46
- package/lib/tools/navigate.js +0 -93
- package/lib/tools/network.js +0 -51
- package/lib/tools/pdf.js +0 -49
- package/lib/tools/screenshot.js +0 -77
- package/lib/tools/snapshot.js +0 -204
- package/lib/tools/tabs.js +0 -118
- package/lib/tools/testing.js +0 -60
- package/lib/tools/tool.js +0 -18
- package/lib/tools/utils.js +0 -80
- package/lib/tools/vision.js +0 -189
- package/lib/tools/wait.js +0 -59
- package/lib/tools.js +0 -61
- package/lib/transport.js +0 -133
package/README.md
DELETED
|
@@ -1,508 +0,0 @@
|
|
|
1
|
-
## Cloudflare Playwright MCP
|
|
2
|
-
|
|
3
|
-
[](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/playwright-mcp/tree/main/cloudflare/example)
|
|
4
|
-
|
|
5
|
-
### Overview
|
|
6
|
-
|
|
7
|
-
This project leverages Playwright for automated browser testing and integrates with Cloudflare Workers, [Browser Rendering](https://developers.cloudflare.com/browser-rendering/) and [`@cloudflare/playwright`](https://github.com/cloudflare/playwright) for deployment.
|
|
8
|
-
|
|
9
|
-
### Build and Deploy
|
|
10
|
-
|
|
11
|
-
Follow these steps to set up and deploy the project:
|
|
12
|
-
|
|
13
|
-
1. Install dependencies:
|
|
14
|
-
```bash
|
|
15
|
-
npm ci
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
2. Build:
|
|
19
|
-
```bash
|
|
20
|
-
cd cloudflare
|
|
21
|
-
npm run build
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
3. Deploy to Cloudflare Workers:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
cd cloudflare/example
|
|
28
|
-
npm ci
|
|
29
|
-
npx wrangler deploy
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### Use with Cloudflare AI Playground
|
|
33
|
-
|
|
34
|
-

|
|
35
|
-
|
|
36
|
-
[Cloudflare playground AI](https://playground.ai.cloudflare.com/) is a great way to test MCP servers using LLM models available in Workers AI.
|
|
37
|
-
|
|
38
|
-
- Navigate to https://playground.ai.cloudflare.com/
|
|
39
|
-
- Ensure model is set to `llama-3.3-70b-instruct-fp8-fast`
|
|
40
|
-
- In **MCP Servers**, set **URL** to `https://[my-mcp-url].workers.dev/sse`
|
|
41
|
-
- Click **Connect**
|
|
42
|
-
- Status should update to **Connected** and it should list 14 available tools
|
|
43
|
-
|
|
44
|
-
You can now start to interact with the model, and it will run necessary tools to accomplish what was requested.
|
|
45
|
-
|
|
46
|
-
> [!TIP]
|
|
47
|
-
> For best results, give simple instructions consisting of one single action, e. g., "Create a new todo entry", "Go to cloudflare site", "Take a screenshot"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Example of a conversation:
|
|
51
|
-
|
|
52
|
-
| Role | Message |
|
|
53
|
-
|------|---------|
|
|
54
|
-
| **User** | Go to demo.playwright.dev/todomvc |
|
|
55
|
-
| **Assistant** | *runs browser_navigate tool*<br> The page has been navigated to https://demo.playwright.dev/todomvc/. The page title is "React • TodoMVC". The page snapshot shows the content of the page, including a heading, a textbox, and several links. |
|
|
56
|
-
| **User** | Create some todo entry |
|
|
57
|
-
| **Assistant** | *runs browser_type tool*<br> A new todo entry "Buy groceries" has been created. The page snapshot shows the updated content of the page, including the new todo entry. |
|
|
58
|
-
| **User** | Nice. Now create a todo in parrot style |
|
|
59
|
-
| **Assistant** | *runs browser_type tool*<br> A new todo entry "Polly wants a cracker" has been created in parrot style. The page snapshot shows the updated content of the page, including the new todo entry. |
|
|
60
|
-
| **User** | And create another todo in yoda style |
|
|
61
|
-
| **Assistant** | *runs browser_type tool*<br> A new todo entry "A walk, I must take" has been created in Yoda style. The page snapshot shows the updated content of the page, including the new todo entry. |
|
|
62
|
-
| **User** | Take a screenshot |
|
|
63
|
-
| **Assistant** | *runs browser_take_screenshot tool*<br>  A screenshot of the current page has been taken. The screenshot is in PNG format and is 56KB in size. |
|
|
64
|
-
| **User** | Now click the checkbox of the parrot todo entry |
|
|
65
|
-
| **Assistant** | *runs browser_clickt tool*<br> The checkbox of the parrot todo entry "Polly wants a cracker" has been clicked. The page snapshot shows the updated content of the page, with the checkbox now checked. |
|
|
66
|
-
| **User** | Take a screenshot |
|
|
67
|
-
| **Assistant** | *runs browser_take_screenshot tool*<br>  A screenshot of the current page has been taken. The screenshot is in PNG format and is 58KB in size. |
|
|
68
|
-
| **User** | Remove completed todo entries |
|
|
69
|
-
| **Assistant** | *runs browser_clickt tool*<br> The "Clear completed" button has been clicked. The page snapshot shows the updated content of the page, with the completed todo entry "Polly wants a cracker" removed. |
|
|
70
|
-
| **User** | Take a final screenshot |
|
|
71
|
-
| **Assistant** | *runs browser_take_screenshot tool*<br>  A final screenshot of the current page has been taken. The screenshot is in PNG format and is 50KB in size. |
|
|
72
|
-
|
|
73
|
-
### Use with Claude Desktop
|
|
74
|
-
|
|
75
|
-
As of now, [Claude Desktop](https://claude.ai/download) only supports local MCP servers. To use `playground-mcp` with Claude Desktop we make use of [mcp-remote](https://github.com/geelen/mcp-remote), a tool that proxies remote MCP servers and exposes them locally. Use the following configuration:
|
|
76
|
-
|
|
77
|
-
1. Open the configuration file for Claude Desktop.
|
|
78
|
-
2. Add the following JSON snippet under the `mcpServers` section:
|
|
79
|
-
|
|
80
|
-
```json
|
|
81
|
-
{
|
|
82
|
-
"mcpServers": {
|
|
83
|
-
"cloudflare-playwright-mcp": {
|
|
84
|
-
"command": "npx",
|
|
85
|
-
"args": [
|
|
86
|
-
"mcp-remote",
|
|
87
|
-
"https://[my-mcp-url].workers.dev/sse"
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
3. Save the configuration file and **restart** Claude Desktop to apply the changes.
|
|
95
|
-
|
|
96
|
-
This setup ensures that Claude Desktop can communicate with the Cloudflare Playwright MCP server.
|
|
97
|
-
|
|
98
|
-
Here's an example of a session opening the TODO demo app, adding "buy lemons" and doing a screenshot, taking advantage of playwright-mcp tools and Browser Rendering:
|
|
99
|
-
|
|
100
|
-

|
|
101
|
-
|
|
102
|
-
### Configure in VSCode
|
|
103
|
-
|
|
104
|
-
You can install the Playwright MCP server using the [VS Code CLI](https://code.visualstudio.com/docs/configure/command-line):
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
# For VS Code
|
|
108
|
-
code --add-mcp '{"name":"cloudflare-playwright","type":"sse","url":"https://[my-mcp-url].workers.dev/sse"}'
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# For VS Code Insiders
|
|
113
|
-
code-insiders --add-mcp '{"name":"cloudflare-playwright","type":"sse","url":"https://[my-mcp-url].workers.dev/sse"}'
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
After installation, the Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.
|
|
117
|
-
|
|
118
|
-
### Use with Cursor
|
|
119
|
-
|
|
120
|
-
By default, when `imageResponses` is set to `"auto"`, the server disables inline image responses for Cursor clients. To enable inline screenshots in Cursor, you need to override this behavior:
|
|
121
|
-
|
|
122
|
-
If you're running your own Cloudflare Worker, pass `imageResponses: "allow"` when creating the MCP agent:
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
export const PlaywrightMCP = createMcpAgent(env.BROWSER, {
|
|
126
|
-
imageResponses: 'allow',
|
|
127
|
-
} as any);
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### Tool Modes
|
|
131
|
-
|
|
132
|
-
The tools are available in two modes:
|
|
133
|
-
|
|
134
|
-
1. **Snapshot Mode** (default): Uses accessibility snapshots for better performance and reliability
|
|
135
|
-
2. **Vision Mode**: Uses screenshots for visual-based interactions
|
|
136
|
-
|
|
137
|
-
Vision Mode works best with the computer use models that are able to interact with elements using
|
|
138
|
-
X Y coordinate space, based on the provided screenshot.
|
|
139
|
-
|
|
140
|
-
<!--- Tools generated by update-readme.js -->
|
|
141
|
-
|
|
142
|
-
<details>
|
|
143
|
-
<summary><b>Interactions</b></summary>
|
|
144
|
-
|
|
145
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
146
|
-
|
|
147
|
-
- **browser_snapshot**
|
|
148
|
-
- Title: Page snapshot
|
|
149
|
-
- Description: Capture accessibility snapshot of the current page, this is better than screenshot
|
|
150
|
-
- Parameters: None
|
|
151
|
-
- Read-only: **true**
|
|
152
|
-
|
|
153
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
154
|
-
|
|
155
|
-
- **browser_click**
|
|
156
|
-
- Title: Click
|
|
157
|
-
- Description: Perform click on a web page
|
|
158
|
-
- Parameters:
|
|
159
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
160
|
-
- `ref` (string): Exact target element reference from the page snapshot
|
|
161
|
-
- `doubleClick` (boolean, optional): Whether to perform a double click instead of a single click
|
|
162
|
-
- Read-only: **false**
|
|
163
|
-
|
|
164
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
165
|
-
|
|
166
|
-
- **browser_drag**
|
|
167
|
-
- Title: Drag mouse
|
|
168
|
-
- Description: Perform drag and drop between two elements
|
|
169
|
-
- Parameters:
|
|
170
|
-
- `startElement` (string): Human-readable source element description used to obtain the permission to interact with the element
|
|
171
|
-
- `startRef` (string): Exact source element reference from the page snapshot
|
|
172
|
-
- `endElement` (string): Human-readable target element description used to obtain the permission to interact with the element
|
|
173
|
-
- `endRef` (string): Exact target element reference from the page snapshot
|
|
174
|
-
- Read-only: **false**
|
|
175
|
-
|
|
176
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
177
|
-
|
|
178
|
-
- **browser_hover**
|
|
179
|
-
- Title: Hover mouse
|
|
180
|
-
- Description: Hover over element on page
|
|
181
|
-
- Parameters:
|
|
182
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
183
|
-
- `ref` (string): Exact target element reference from the page snapshot
|
|
184
|
-
- Read-only: **true**
|
|
185
|
-
|
|
186
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
187
|
-
|
|
188
|
-
- **browser_type**
|
|
189
|
-
- Title: Type text
|
|
190
|
-
- Description: Type text into editable element
|
|
191
|
-
- Parameters:
|
|
192
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
193
|
-
- `ref` (string): Exact target element reference from the page snapshot
|
|
194
|
-
- `text` (string): Text to type into the element
|
|
195
|
-
- `submit` (boolean, optional): Whether to submit entered text (press Enter after)
|
|
196
|
-
- `slowly` (boolean, optional): Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
|
|
197
|
-
- Read-only: **false**
|
|
198
|
-
|
|
199
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
200
|
-
|
|
201
|
-
- **browser_select_option**
|
|
202
|
-
- Title: Select option
|
|
203
|
-
- Description: Select an option in a dropdown
|
|
204
|
-
- Parameters:
|
|
205
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
206
|
-
- `ref` (string): Exact target element reference from the page snapshot
|
|
207
|
-
- `values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
|
|
208
|
-
- Read-only: **false**
|
|
209
|
-
|
|
210
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
211
|
-
|
|
212
|
-
- **browser_press_key**
|
|
213
|
-
- Title: Press a key
|
|
214
|
-
- Description: Press a key on the keyboard
|
|
215
|
-
- Parameters:
|
|
216
|
-
- `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
|
|
217
|
-
- Read-only: **false**
|
|
218
|
-
|
|
219
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
220
|
-
|
|
221
|
-
- **browser_wait_for**
|
|
222
|
-
- Title: Wait for
|
|
223
|
-
- Description: Wait for text to appear or disappear or a specified time to pass
|
|
224
|
-
- Parameters:
|
|
225
|
-
- `time` (number, optional): The time to wait in seconds
|
|
226
|
-
- `text` (string, optional): The text to wait for
|
|
227
|
-
- `textGone` (string, optional): The text to wait for to disappear
|
|
228
|
-
- Read-only: **true**
|
|
229
|
-
|
|
230
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
231
|
-
|
|
232
|
-
- **browser_file_upload**
|
|
233
|
-
- Title: Upload files
|
|
234
|
-
- Description: Upload one or multiple files
|
|
235
|
-
- Parameters:
|
|
236
|
-
- `paths` (array): The absolute paths to the files to upload. Can be a single file or multiple files.
|
|
237
|
-
- Read-only: **false**
|
|
238
|
-
|
|
239
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
240
|
-
|
|
241
|
-
- **browser_handle_dialog**
|
|
242
|
-
- Title: Handle a dialog
|
|
243
|
-
- Description: Handle a dialog
|
|
244
|
-
- Parameters:
|
|
245
|
-
- `accept` (boolean): Whether to accept the dialog.
|
|
246
|
-
- `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
|
|
247
|
-
- Read-only: **false**
|
|
248
|
-
|
|
249
|
-
</details>
|
|
250
|
-
|
|
251
|
-
<details>
|
|
252
|
-
<summary><b>Navigation</b></summary>
|
|
253
|
-
|
|
254
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
255
|
-
|
|
256
|
-
- **browser_navigate**
|
|
257
|
-
- Title: Navigate to a URL
|
|
258
|
-
- Description: Navigate to a URL
|
|
259
|
-
- Parameters:
|
|
260
|
-
- `url` (string): The URL to navigate to
|
|
261
|
-
- Read-only: **false**
|
|
262
|
-
|
|
263
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
264
|
-
|
|
265
|
-
- **browser_navigate_back**
|
|
266
|
-
- Title: Go back
|
|
267
|
-
- Description: Go back to the previous page
|
|
268
|
-
- Parameters: None
|
|
269
|
-
- Read-only: **true**
|
|
270
|
-
|
|
271
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
272
|
-
|
|
273
|
-
- **browser_navigate_forward**
|
|
274
|
-
- Title: Go forward
|
|
275
|
-
- Description: Go forward to the next page
|
|
276
|
-
- Parameters: None
|
|
277
|
-
- Read-only: **true**
|
|
278
|
-
|
|
279
|
-
</details>
|
|
280
|
-
|
|
281
|
-
<details>
|
|
282
|
-
<summary><b>Resources</b></summary>
|
|
283
|
-
|
|
284
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
285
|
-
|
|
286
|
-
- **browser_take_screenshot**
|
|
287
|
-
- Title: Take a screenshot
|
|
288
|
-
- Description: Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
|
|
289
|
-
- Parameters:
|
|
290
|
-
- `raw` (boolean, optional): Whether to return without compression (in PNG format). Default is false, which returns a JPEG image.
|
|
291
|
-
- `filename` (string, optional): File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.
|
|
292
|
-
- `element` (string, optional): Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.
|
|
293
|
-
- `ref` (string, optional): Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.
|
|
294
|
-
- Read-only: **true**
|
|
295
|
-
|
|
296
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
297
|
-
|
|
298
|
-
- **browser_pdf_save**
|
|
299
|
-
- Title: Save as PDF
|
|
300
|
-
- Description: Save page as PDF
|
|
301
|
-
- Parameters:
|
|
302
|
-
- `filename` (string, optional): File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.
|
|
303
|
-
- Read-only: **true**
|
|
304
|
-
|
|
305
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
306
|
-
|
|
307
|
-
- **browser_network_requests**
|
|
308
|
-
- Title: List network requests
|
|
309
|
-
- Description: Returns all network requests since loading the page
|
|
310
|
-
- Parameters: None
|
|
311
|
-
- Read-only: **true**
|
|
312
|
-
|
|
313
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
314
|
-
|
|
315
|
-
- **browser_console_messages**
|
|
316
|
-
- Title: Get console messages
|
|
317
|
-
- Description: Returns all console messages
|
|
318
|
-
- Parameters: None
|
|
319
|
-
- Read-only: **true**
|
|
320
|
-
|
|
321
|
-
</details>
|
|
322
|
-
|
|
323
|
-
<details>
|
|
324
|
-
<summary><b>Utilities</b></summary>
|
|
325
|
-
|
|
326
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
327
|
-
|
|
328
|
-
- **browser_install**
|
|
329
|
-
- Title: Install the browser specified in the config
|
|
330
|
-
- Description: Install the browser specified in the config. Call this if you get an error about the browser not being installed.
|
|
331
|
-
- Parameters: None
|
|
332
|
-
- Read-only: **false**
|
|
333
|
-
|
|
334
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
335
|
-
|
|
336
|
-
- **browser_close**
|
|
337
|
-
- Title: Close browser
|
|
338
|
-
- Description: Close the page
|
|
339
|
-
- Parameters: None
|
|
340
|
-
- Read-only: **true**
|
|
341
|
-
|
|
342
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
343
|
-
|
|
344
|
-
- **browser_resize**
|
|
345
|
-
- Title: Resize browser window
|
|
346
|
-
- Description: Resize the browser window
|
|
347
|
-
- Parameters:
|
|
348
|
-
- `width` (number): Width of the browser window
|
|
349
|
-
- `height` (number): Height of the browser window
|
|
350
|
-
- Read-only: **true**
|
|
351
|
-
|
|
352
|
-
</details>
|
|
353
|
-
|
|
354
|
-
<details>
|
|
355
|
-
<summary><b>Tabs</b></summary>
|
|
356
|
-
|
|
357
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
358
|
-
|
|
359
|
-
- **browser_tab_list**
|
|
360
|
-
- Title: List tabs
|
|
361
|
-
- Description: List browser tabs
|
|
362
|
-
- Parameters: None
|
|
363
|
-
- Read-only: **true**
|
|
364
|
-
|
|
365
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
366
|
-
|
|
367
|
-
- **browser_tab_new**
|
|
368
|
-
- Title: Open a new tab
|
|
369
|
-
- Description: Open a new tab
|
|
370
|
-
- Parameters:
|
|
371
|
-
- `url` (string, optional): The URL to navigate to in the new tab. If not provided, the new tab will be blank.
|
|
372
|
-
- Read-only: **true**
|
|
373
|
-
|
|
374
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
375
|
-
|
|
376
|
-
- **browser_tab_select**
|
|
377
|
-
- Title: Select a tab
|
|
378
|
-
- Description: Select a tab by index
|
|
379
|
-
- Parameters:
|
|
380
|
-
- `index` (number): The index of the tab to select
|
|
381
|
-
- Read-only: **true**
|
|
382
|
-
|
|
383
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
384
|
-
|
|
385
|
-
- **browser_tab_close**
|
|
386
|
-
- Title: Close a tab
|
|
387
|
-
- Description: Close a tab
|
|
388
|
-
- Parameters:
|
|
389
|
-
- `index` (number, optional): The index of the tab to close. Closes current tab if not provided.
|
|
390
|
-
- Read-only: **false**
|
|
391
|
-
|
|
392
|
-
</details>
|
|
393
|
-
|
|
394
|
-
<details>
|
|
395
|
-
<summary><b>Testing</b></summary>
|
|
396
|
-
|
|
397
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
398
|
-
|
|
399
|
-
- **browser_generate_playwright_test**
|
|
400
|
-
- Title: Generate a Playwright test
|
|
401
|
-
- Description: Generate a Playwright test for given scenario
|
|
402
|
-
- Parameters:
|
|
403
|
-
- `name` (string): The name of the test
|
|
404
|
-
- `description` (string): The description of the test
|
|
405
|
-
- `steps` (array): The steps of the test
|
|
406
|
-
- Read-only: **true**
|
|
407
|
-
|
|
408
|
-
</details>
|
|
409
|
-
|
|
410
|
-
<details>
|
|
411
|
-
<summary><b>Vision mode</b></summary>
|
|
412
|
-
|
|
413
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
414
|
-
|
|
415
|
-
- **browser_screen_capture**
|
|
416
|
-
- Title: Take a screenshot
|
|
417
|
-
- Description: Take a screenshot of the current page
|
|
418
|
-
- Parameters: None
|
|
419
|
-
- Read-only: **true**
|
|
420
|
-
|
|
421
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
422
|
-
|
|
423
|
-
- **browser_screen_move_mouse**
|
|
424
|
-
- Title: Move mouse
|
|
425
|
-
- Description: Move mouse to a given position
|
|
426
|
-
- Parameters:
|
|
427
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
428
|
-
- `x` (number): X coordinate
|
|
429
|
-
- `y` (number): Y coordinate
|
|
430
|
-
- Read-only: **true**
|
|
431
|
-
|
|
432
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
433
|
-
|
|
434
|
-
- **browser_screen_click**
|
|
435
|
-
- Title: Click
|
|
436
|
-
- Description: Click left mouse button
|
|
437
|
-
- Parameters:
|
|
438
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
439
|
-
- `x` (number): X coordinate
|
|
440
|
-
- `y` (number): Y coordinate
|
|
441
|
-
- Read-only: **false**
|
|
442
|
-
|
|
443
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
444
|
-
|
|
445
|
-
- **browser_screen_drag**
|
|
446
|
-
- Title: Drag mouse
|
|
447
|
-
- Description: Drag left mouse button
|
|
448
|
-
- Parameters:
|
|
449
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
450
|
-
- `startX` (number): Start X coordinate
|
|
451
|
-
- `startY` (number): Start Y coordinate
|
|
452
|
-
- `endX` (number): End X coordinate
|
|
453
|
-
- `endY` (number): End Y coordinate
|
|
454
|
-
- Read-only: **false**
|
|
455
|
-
|
|
456
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
457
|
-
|
|
458
|
-
- **browser_screen_type**
|
|
459
|
-
- Title: Type text
|
|
460
|
-
- Description: Type text
|
|
461
|
-
- Parameters:
|
|
462
|
-
- `text` (string): Text to type into the element
|
|
463
|
-
- `submit` (boolean, optional): Whether to submit entered text (press Enter after)
|
|
464
|
-
- Read-only: **false**
|
|
465
|
-
|
|
466
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
467
|
-
|
|
468
|
-
- **browser_press_key**
|
|
469
|
-
- Title: Press a key
|
|
470
|
-
- Description: Press a key on the keyboard
|
|
471
|
-
- Parameters:
|
|
472
|
-
- `key` (string): Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
|
|
473
|
-
- Read-only: **false**
|
|
474
|
-
|
|
475
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
476
|
-
|
|
477
|
-
- **browser_wait_for**
|
|
478
|
-
- Title: Wait for
|
|
479
|
-
- Description: Wait for text to appear or disappear or a specified time to pass
|
|
480
|
-
- Parameters:
|
|
481
|
-
- `time` (number, optional): The time to wait in seconds
|
|
482
|
-
- `text` (string, optional): The text to wait for
|
|
483
|
-
- `textGone` (string, optional): The text to wait for to disappear
|
|
484
|
-
- Read-only: **true**
|
|
485
|
-
|
|
486
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
487
|
-
|
|
488
|
-
- **browser_file_upload**
|
|
489
|
-
- Title: Upload files
|
|
490
|
-
- Description: Upload one or multiple files
|
|
491
|
-
- Parameters:
|
|
492
|
-
- `paths` (array): The absolute paths to the files to upload. Can be a single file or multiple files.
|
|
493
|
-
- Read-only: **false**
|
|
494
|
-
|
|
495
|
-
<!-- NOTE: This has been generated via update-readme.js -->
|
|
496
|
-
|
|
497
|
-
- **browser_handle_dialog**
|
|
498
|
-
- Title: Handle a dialog
|
|
499
|
-
- Description: Handle a dialog
|
|
500
|
-
- Parameters:
|
|
501
|
-
- `accept` (boolean): Whether to accept the dialog.
|
|
502
|
-
- `promptText` (string, optional): The text of the prompt in case of a prompt dialog.
|
|
503
|
-
- Read-only: **false**
|
|
504
|
-
|
|
505
|
-
</details>
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
<!--- End of tools generated section -->
|
package/cli.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import './lib/program.js';
|
package/config.d.ts
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import type * as playwright from '@szymonrybczak/patchright';
|
|
18
|
-
|
|
19
|
-
export type ToolCapability = 'core' | 'tabs' | 'pdf' | 'history' | 'wait' | 'files' | 'install' | 'testing';
|
|
20
|
-
|
|
21
|
-
export type Config = {
|
|
22
|
-
/**
|
|
23
|
-
* The browser to use.
|
|
24
|
-
*/
|
|
25
|
-
browser?: {
|
|
26
|
-
/**
|
|
27
|
-
* Use browser agent (experimental).
|
|
28
|
-
*/
|
|
29
|
-
browserAgent?: string;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* The type of browser to use.
|
|
33
|
-
*/
|
|
34
|
-
browserName?: 'chromium' | 'firefox' | 'webkit';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Keep the browser profile in memory, do not save it to disk.
|
|
38
|
-
*/
|
|
39
|
-
isolated?: boolean;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Path to a user data directory for browser profile persistence.
|
|
43
|
-
* Temporary directory is created by default.
|
|
44
|
-
*/
|
|
45
|
-
userDataDir?: string;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Launch options passed to
|
|
49
|
-
* @see https://playwright.dev/docs/api/class-browsertype#browser-type-launch-persistent-context
|
|
50
|
-
*
|
|
51
|
-
* This is useful for settings options like `channel`, `headless`, `executablePath`, etc.
|
|
52
|
-
*/
|
|
53
|
-
launchOptions?: playwright.LaunchOptions;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Context options for the browser context.
|
|
57
|
-
*
|
|
58
|
-
* This is useful for settings options like `viewport`.
|
|
59
|
-
*/
|
|
60
|
-
contextOptions?: playwright.BrowserContextOptions;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Chrome DevTools Protocol endpoint to connect to an existing browser instance in case of Chromium family browsers.
|
|
64
|
-
*/
|
|
65
|
-
cdpEndpoint?: string;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Remote endpoint to connect to an existing Playwright server.
|
|
69
|
-
*/
|
|
70
|
-
remoteEndpoint?: string;
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
server?: {
|
|
74
|
-
/**
|
|
75
|
-
* The port to listen on for SSE or MCP transport.
|
|
76
|
-
*/
|
|
77
|
-
port?: number;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* The host to bind the server to. Default is localhost. Use 0.0.0.0 to bind to all interfaces.
|
|
81
|
-
*/
|
|
82
|
-
host?: string;
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* List of enabled tool capabilities. Possible values:
|
|
87
|
-
* - 'core': Core browser automation features.
|
|
88
|
-
* - 'tabs': Tab management features.
|
|
89
|
-
* - 'pdf': PDF generation and manipulation.
|
|
90
|
-
* - 'history': Browser history access.
|
|
91
|
-
* - 'wait': Wait and timing utilities.
|
|
92
|
-
* - 'files': File upload/download support.
|
|
93
|
-
* - 'install': Browser installation utilities.
|
|
94
|
-
*/
|
|
95
|
-
capabilities?: ToolCapability[];
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Run server that uses screenshots (Aria snapshots are used by default).
|
|
99
|
-
*/
|
|
100
|
-
vision?: boolean;
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Whether to save the Playwright trace of the session into the output directory.
|
|
104
|
-
*/
|
|
105
|
-
saveTrace?: boolean;
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The directory to save output files.
|
|
109
|
-
*/
|
|
110
|
-
outputDir?: string;
|
|
111
|
-
|
|
112
|
-
network?: {
|
|
113
|
-
/**
|
|
114
|
-
* List of origins to allow the browser to request. Default is to allow all. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
|
|
115
|
-
*/
|
|
116
|
-
allowedOrigins?: string[];
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* List of origins to block the browser to request. Origins matching both `allowedOrigins` and `blockedOrigins` will be blocked.
|
|
120
|
-
*/
|
|
121
|
-
blockedOrigins?: string[];
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Whether to send image responses to the client. Can be "allow", "omit", or "auto". Defaults to "auto", which sends images if the client can display them.
|
|
126
|
-
*/
|
|
127
|
-
imageResponses?: 'allow' | 'omit' | 'auto';
|
|
128
|
-
};
|
package/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
import { createConnection } from './lib/index.js';
|
|
19
|
-
export { createConnection };
|