@playwright/mcp 0.0.56 → 0.0.57
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/README.md +58 -13
- package/config.d.ts +22 -2
- package/package.json +10 -16
- package/playwright-cli.js +23 -0
package/README.md
CHANGED
|
@@ -363,6 +363,10 @@ Playwright MCP server supports following arguments. They can be provided in the
|
|
|
363
363
|
--cdp-endpoint <endpoint> CDP endpoint to connect to.
|
|
364
364
|
--cdp-header <headers...> CDP headers to send with the connect
|
|
365
365
|
request, multiple can be specified.
|
|
366
|
+
--codegen <lang> specify the language to use for code
|
|
367
|
+
generation, possible values:
|
|
368
|
+
"typescript", "none". Default is
|
|
369
|
+
"typescript".
|
|
366
370
|
--config <path> path to the configuration file.
|
|
367
371
|
--console-level <level> level of console messages to return:
|
|
368
372
|
"error", "warning", "info", "debug".
|
|
@@ -400,6 +404,10 @@ Playwright MCP server supports following arguments. They can be provided in the
|
|
|
400
404
|
--no-sandbox disable the sandbox for all process
|
|
401
405
|
types that are normally sandboxed.
|
|
402
406
|
--output-dir <path> path to the directory for output files.
|
|
407
|
+
--output-mode <mode> whether to save snapshots, console
|
|
408
|
+
messages, network logs to a file or to
|
|
409
|
+
the standard output. Can be "file" or
|
|
410
|
+
"stdout". Default is "stdout".
|
|
403
411
|
--port <port> port to listen on for SSE transport.
|
|
404
412
|
--proxy-bypass <bypass> comma-separated domains to bypass proxy,
|
|
405
413
|
for example
|
|
@@ -659,6 +667,11 @@ npx @playwright/mcp@latest --config path/to/config.json
|
|
|
659
667
|
*/
|
|
660
668
|
outputDir?: string;
|
|
661
669
|
|
|
670
|
+
/**
|
|
671
|
+
* Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
|
|
672
|
+
*/
|
|
673
|
+
outputMode?: 'file' | 'stdout';
|
|
674
|
+
|
|
662
675
|
console?: {
|
|
663
676
|
/**
|
|
664
677
|
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
|
|
@@ -705,13 +718,18 @@ npx @playwright/mcp@latest --config path/to/config.json
|
|
|
705
718
|
* When taking snapshots for responses, specifies the mode to use.
|
|
706
719
|
*/
|
|
707
720
|
mode?: 'incremental' | 'full' | 'none';
|
|
708
|
-
}
|
|
721
|
+
};
|
|
709
722
|
|
|
710
723
|
/**
|
|
711
724
|
* Whether to allow file uploads from anywhere on the file system.
|
|
712
725
|
* By default (false), file uploads are restricted to paths within the MCP roots only.
|
|
713
726
|
*/
|
|
714
727
|
allowUnrestrictedFileAccess?: boolean;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Specify the language to use for code generation.
|
|
731
|
+
*/
|
|
732
|
+
codegen?: 'typescript' | 'none';
|
|
715
733
|
}
|
|
716
734
|
```
|
|
717
735
|
|
|
@@ -811,7 +829,7 @@ http.createServer(async (req, res) => {
|
|
|
811
829
|
- Title: Click
|
|
812
830
|
- Description: Perform click on a web page
|
|
813
831
|
- Parameters:
|
|
814
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
832
|
+
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
815
833
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
816
834
|
- `doubleClick` (boolean, optional): Whether to perform a double click instead of a single click
|
|
817
835
|
- `button` (string, optional): Button to click, defaults to left
|
|
@@ -832,7 +850,8 @@ http.createServer(async (req, res) => {
|
|
|
832
850
|
- Title: Get console messages
|
|
833
851
|
- Description: Returns all console messages
|
|
834
852
|
- Parameters:
|
|
835
|
-
- `level` (string
|
|
853
|
+
- `level` (string): Level of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
|
|
854
|
+
- `filename` (string, optional): Filename to save the console messages to. If not provided, messages are returned as text.
|
|
836
855
|
- Read-only: **true**
|
|
837
856
|
|
|
838
857
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -892,7 +911,7 @@ http.createServer(async (req, res) => {
|
|
|
892
911
|
- Title: Hover mouse
|
|
893
912
|
- Description: Hover over element on page
|
|
894
913
|
- Parameters:
|
|
895
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
914
|
+
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
896
915
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
897
916
|
- Read-only: **false**
|
|
898
917
|
|
|
@@ -909,7 +928,7 @@ http.createServer(async (req, res) => {
|
|
|
909
928
|
|
|
910
929
|
- **browser_navigate_back**
|
|
911
930
|
- Title: Go back
|
|
912
|
-
- Description: Go back to the previous page
|
|
931
|
+
- Description: Go back to the previous page in the history
|
|
913
932
|
- Parameters: None
|
|
914
933
|
- Read-only: **false**
|
|
915
934
|
|
|
@@ -919,7 +938,8 @@ http.createServer(async (req, res) => {
|
|
|
919
938
|
- Title: List network requests
|
|
920
939
|
- Description: Returns all network requests since loading the page
|
|
921
940
|
- Parameters:
|
|
922
|
-
- `includeStatic` (boolean
|
|
941
|
+
- `includeStatic` (boolean): Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.
|
|
942
|
+
- `filename` (string, optional): Filename to save the network requests to. If not provided, requests are returned as text.
|
|
923
943
|
- Read-only: **true**
|
|
924
944
|
|
|
925
945
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -956,7 +976,7 @@ http.createServer(async (req, res) => {
|
|
|
956
976
|
- Title: Select option
|
|
957
977
|
- Description: Select an option in a dropdown
|
|
958
978
|
- Parameters:
|
|
959
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
979
|
+
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
960
980
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
961
981
|
- `values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
|
|
962
982
|
- Read-only: **false**
|
|
@@ -976,7 +996,7 @@ http.createServer(async (req, res) => {
|
|
|
976
996
|
- Title: Take a screenshot
|
|
977
997
|
- Description: Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
|
|
978
998
|
- Parameters:
|
|
979
|
-
- `type` (string
|
|
999
|
+
- `type` (string): Image format for the screenshot. Default is png.
|
|
980
1000
|
- `filename` (string, optional): File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory.
|
|
981
1001
|
- `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.
|
|
982
1002
|
- `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.
|
|
@@ -989,7 +1009,7 @@ http.createServer(async (req, res) => {
|
|
|
989
1009
|
- Title: Type text
|
|
990
1010
|
- Description: Type text into editable element
|
|
991
1011
|
- Parameters:
|
|
992
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
1012
|
+
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
993
1013
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
994
1014
|
- `text` (string): Text to type into the element
|
|
995
1015
|
- `submit` (boolean, optional): Whether to submit entered text (press Enter after)
|
|
@@ -1046,18 +1066,25 @@ http.createServer(async (req, res) => {
|
|
|
1046
1066
|
- Title: Click
|
|
1047
1067
|
- Description: Click left mouse button at a given position
|
|
1048
1068
|
- Parameters:
|
|
1049
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
1050
1069
|
- `x` (number): X coordinate
|
|
1051
1070
|
- `y` (number): Y coordinate
|
|
1052
1071
|
- Read-only: **false**
|
|
1053
1072
|
|
|
1054
1073
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1055
1074
|
|
|
1075
|
+
- **browser_mouse_down**
|
|
1076
|
+
- Title: Press mouse down
|
|
1077
|
+
- Description: Press mouse down
|
|
1078
|
+
- Parameters:
|
|
1079
|
+
- `button` (string, optional): Button to press, defaults to left
|
|
1080
|
+
- Read-only: **false**
|
|
1081
|
+
|
|
1082
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1083
|
+
|
|
1056
1084
|
- **browser_mouse_drag_xy**
|
|
1057
1085
|
- Title: Drag mouse
|
|
1058
1086
|
- Description: Drag left mouse button to a given position
|
|
1059
1087
|
- Parameters:
|
|
1060
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
1061
1088
|
- `startX` (number): Start X coordinate
|
|
1062
1089
|
- `startY` (number): Start Y coordinate
|
|
1063
1090
|
- `endX` (number): End X coordinate
|
|
@@ -1070,11 +1097,29 @@ http.createServer(async (req, res) => {
|
|
|
1070
1097
|
- Title: Move mouse
|
|
1071
1098
|
- Description: Move mouse to a given position
|
|
1072
1099
|
- Parameters:
|
|
1073
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
1074
1100
|
- `x` (number): X coordinate
|
|
1075
1101
|
- `y` (number): Y coordinate
|
|
1076
1102
|
- Read-only: **false**
|
|
1077
1103
|
|
|
1104
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1105
|
+
|
|
1106
|
+
- **browser_mouse_up**
|
|
1107
|
+
- Title: Press mouse up
|
|
1108
|
+
- Description: Press mouse up
|
|
1109
|
+
- Parameters:
|
|
1110
|
+
- `button` (string, optional): Button to press, defaults to left
|
|
1111
|
+
- Read-only: **false**
|
|
1112
|
+
|
|
1113
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1114
|
+
|
|
1115
|
+
- **browser_mouse_wheel**
|
|
1116
|
+
- Title: Scroll mouse wheel
|
|
1117
|
+
- Description: Scroll mouse wheel
|
|
1118
|
+
- Parameters:
|
|
1119
|
+
- `deltaX` (number): X delta
|
|
1120
|
+
- `deltaY` (number): Y delta
|
|
1121
|
+
- Read-only: **false**
|
|
1122
|
+
|
|
1078
1123
|
</details>
|
|
1079
1124
|
|
|
1080
1125
|
<details>
|
|
@@ -1100,7 +1145,7 @@ http.createServer(async (req, res) => {
|
|
|
1100
1145
|
- Title: Create locator for element
|
|
1101
1146
|
- Description: Generate locator for the given element to use in tests
|
|
1102
1147
|
- Parameters:
|
|
1103
|
-
- `element` (string): Human-readable element description used to obtain permission to interact with the element
|
|
1148
|
+
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
1104
1149
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
1105
1150
|
- Read-only: **true**
|
|
1106
1151
|
|
package/config.d.ts
CHANGED
|
@@ -16,7 +16,17 @@
|
|
|
16
16
|
|
|
17
17
|
import type * as playwright from 'playwright';
|
|
18
18
|
|
|
19
|
-
export type ToolCapability =
|
|
19
|
+
export type ToolCapability =
|
|
20
|
+
'core' |
|
|
21
|
+
'core-input' |
|
|
22
|
+
'core-navigation' |
|
|
23
|
+
'core-tabs' |
|
|
24
|
+
'core-install' |
|
|
25
|
+
'core-input' |
|
|
26
|
+
'vision' |
|
|
27
|
+
'pdf' |
|
|
28
|
+
'testing' |
|
|
29
|
+
'tracing';
|
|
20
30
|
|
|
21
31
|
export type Config = {
|
|
22
32
|
/**
|
|
@@ -147,6 +157,11 @@ export type Config = {
|
|
|
147
157
|
*/
|
|
148
158
|
outputDir?: string;
|
|
149
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
|
|
162
|
+
*/
|
|
163
|
+
outputMode?: 'file' | 'stdout';
|
|
164
|
+
|
|
150
165
|
console?: {
|
|
151
166
|
/**
|
|
152
167
|
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
|
|
@@ -193,11 +208,16 @@ export type Config = {
|
|
|
193
208
|
* When taking snapshots for responses, specifies the mode to use.
|
|
194
209
|
*/
|
|
195
210
|
mode?: 'incremental' | 'full' | 'none';
|
|
196
|
-
}
|
|
211
|
+
};
|
|
197
212
|
|
|
198
213
|
/**
|
|
199
214
|
* Whether to allow file uploads from anywhere on the file system.
|
|
200
215
|
* By default (false), file uploads are restricted to paths within the MCP roots only.
|
|
201
216
|
*/
|
|
202
217
|
allowUnrestrictedFileAccess?: boolean;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Specify the language to use for code generation.
|
|
221
|
+
*/
|
|
222
|
+
codegen?: 'typescript' | 'none';
|
|
203
223
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"description": "Playwright Tools for MCP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,18 +15,15 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"scripts": {
|
|
18
|
-
"lint": "
|
|
19
|
-
"update-readme": "node update-readme.js",
|
|
20
|
-
"docker-build": "docker build --no-cache -t playwright-mcp-dev:latest .",
|
|
21
|
-
"docker-rm": "docker rm playwright-mcp-dev",
|
|
22
|
-
"docker-run": "docker run -it -p 8080:8080 --name playwright-mcp-dev playwright-mcp-dev:latest",
|
|
18
|
+
"lint": "node update-readme.js",
|
|
23
19
|
"test": "playwright test",
|
|
24
20
|
"ctest": "playwright test --project=chrome",
|
|
25
21
|
"ftest": "playwright test --project=firefox",
|
|
26
22
|
"wtest": "playwright test --project=webkit",
|
|
27
23
|
"dtest": "MCP_IN_DOCKER=1 playwright test --project=chromium-docker",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
24
|
+
"build": "echo OK",
|
|
25
|
+
"npm-publish": "npm run lint && npm run test && npm publish",
|
|
26
|
+
"copy-config": "cp ../../../playwright/packages/playwright/src/mcp/config.d.ts . && perl -pi -e \"s|import type \\* as playwright from 'playwright-core';|import type * as playwright from 'playwright';|\" ./config.d.ts",
|
|
30
27
|
"roll": "npm run copy-config && npm run lint"
|
|
31
28
|
},
|
|
32
29
|
"exports": {
|
|
@@ -37,15 +34,12 @@
|
|
|
37
34
|
}
|
|
38
35
|
},
|
|
39
36
|
"dependencies": {
|
|
40
|
-
"
|
|
41
|
-
"playwright
|
|
37
|
+
"minimist": "^1.2.5",
|
|
38
|
+
"playwright": "1.59.0-alpha-1769208470000",
|
|
39
|
+
"playwright-core": "1.59.0-alpha-1769208470000"
|
|
42
40
|
},
|
|
43
41
|
"bin": {
|
|
44
|
-
"mcp
|
|
45
|
-
|
|
46
|
-
"devDependencies": {
|
|
47
|
-
"@modelcontextprotocol/sdk": "^1.24.0",
|
|
48
|
-
"@playwright/test": "1.58.0-alpha-2026-01-16",
|
|
49
|
-
"@types/node": "^24.3.0"
|
|
42
|
+
"mcp": "cli.js",
|
|
43
|
+
"playwright-cli": "./playwright-cli.js"
|
|
50
44
|
}
|
|
51
45
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
const { program } = require('playwright/lib/mcp/terminal/program');
|
|
19
|
+
const packageJSON = require('./package.json');
|
|
20
|
+
program({ version: packageJSON.version }).catch(e => {
|
|
21
|
+
console.error(e.message);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|