@playwright/mcp 0.0.68 → 0.0.69
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 +343 -40
- package/cli.js +9 -1
- package/config.d.ts +14 -25
- package/index.js +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -72,6 +72,26 @@ amp mcp add playwright -- npx @playwright/mcp@latest
|
|
|
72
72
|
|
|
73
73
|
</details>
|
|
74
74
|
|
|
75
|
+
<details>
|
|
76
|
+
<summary>Antigravity</summary>
|
|
77
|
+
|
|
78
|
+
Add via the Antigravity settings or by updating your configuration file:
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"mcpServers": {
|
|
83
|
+
"playwright": {
|
|
84
|
+
"command": "npx",
|
|
85
|
+
"args": [
|
|
86
|
+
"@playwright/mcp@latest"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
</details>
|
|
94
|
+
|
|
75
95
|
<details>
|
|
76
96
|
<summary>Claude Code</summary>
|
|
77
97
|
|
|
@@ -220,6 +240,8 @@ Go to `Advanced settings` -> `Extensions` -> `Add custom extension`. Name to you
|
|
|
220
240
|
<details>
|
|
221
241
|
<summary>Kiro</summary>
|
|
222
242
|
|
|
243
|
+
[](https://kiro.dev/launch/mcp/add?name=playwright&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22%40playwright%2Fmcp%40latest%22%5D%7D)
|
|
244
|
+
|
|
223
245
|
Follow the MCP Servers [documentation](https://kiro.dev/docs/mcp/). For example in `.kiro/settings/mcp.json`:
|
|
224
246
|
|
|
225
247
|
```json
|
|
@@ -366,11 +388,9 @@ Playwright MCP server supports following arguments. They can be provided in the
|
|
|
366
388
|
| --proxy-server <proxy> | specify proxy server, for example "http://myproxy:3128" or "socks5://myproxy:8080"<br>*env* `PLAYWRIGHT_MCP_PROXY_SERVER` |
|
|
367
389
|
| --sandbox | enable the sandbox for all process types that are normally not sandboxed.<br>*env* `PLAYWRIGHT_MCP_SANDBOX` |
|
|
368
390
|
| --save-session | Whether to save the Playwright MCP session into the output directory.<br>*env* `PLAYWRIGHT_MCP_SAVE_SESSION` |
|
|
369
|
-
| --save-trace | Whether to save the Playwright Trace of the session into the output directory.<br>*env* `PLAYWRIGHT_MCP_SAVE_TRACE` |
|
|
370
|
-
| --save-video <size> | Whether to save the video of the session into the output directory. For example "--save-video=800x600"<br>*env* `PLAYWRIGHT_MCP_SAVE_VIDEO` |
|
|
371
391
|
| --secrets <path> | path to a file containing secrets in the dotenv format<br>*env* `PLAYWRIGHT_MCP_SECRETS` |
|
|
372
392
|
| --shared-browser-context | reuse the same browser context between all connected HTTP clients.<br>*env* `PLAYWRIGHT_MCP_SHARED_BROWSER_CONTEXT` |
|
|
373
|
-
| --snapshot-mode <mode> | when taking snapshots for responses, specifies the mode to use. Can be "
|
|
393
|
+
| --snapshot-mode <mode> | when taking snapshots for responses, specifies the mode to use. Can be "full" or "none". Default is "full".<br>*env* `PLAYWRIGHT_MCP_SNAPSHOT_MODE` |
|
|
374
394
|
| --storage-state <path> | path to the storage state file for isolated sessions.<br>*env* `PLAYWRIGHT_MCP_STORAGE_STATE` |
|
|
375
395
|
| --test-id-attribute <attribute> | specify the attribute to use for test ids, defaults to "data-testid"<br>*env* `PLAYWRIGHT_MCP_TEST_ID_ATTRIBUTE` |
|
|
376
396
|
| --timeout-action <timeout> | specify action timeout in milliseconds, defaults to 5000ms<br>*env* `PLAYWRIGHT_MCP_TIMEOUT_ACTION` |
|
|
@@ -578,28 +598,15 @@ npx @playwright/mcp@latest --config path/to/config.json
|
|
|
578
598
|
*/
|
|
579
599
|
saveSession?: boolean;
|
|
580
600
|
|
|
581
|
-
/**
|
|
582
|
-
* Whether to save the Playwright trace of the session into the output directory.
|
|
583
|
-
*/
|
|
584
|
-
saveTrace?: boolean;
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* If specified, saves the Playwright video of the session into the output directory.
|
|
588
|
-
*/
|
|
589
|
-
saveVideo?: {
|
|
590
|
-
width: number;
|
|
591
|
-
height: number;
|
|
592
|
-
};
|
|
593
|
-
|
|
594
601
|
/**
|
|
595
602
|
* Reuse the same browser context between all connected HTTP clients.
|
|
596
603
|
*/
|
|
597
604
|
sharedBrowserContext?: boolean;
|
|
598
605
|
|
|
599
606
|
/**
|
|
600
|
-
* Secrets are used to
|
|
601
|
-
*
|
|
602
|
-
*
|
|
607
|
+
* Secrets are used to replace matching plain text in the tool responses to prevent the LLM
|
|
608
|
+
* from accidentally getting sensitive data. It is a convenience and not a security feature,
|
|
609
|
+
* make sure to always examine information coming in and from the tool on the client.
|
|
603
610
|
*/
|
|
604
611
|
secrets?: Record<string, string>;
|
|
605
612
|
|
|
@@ -608,11 +615,6 @@ npx @playwright/mcp@latest --config path/to/config.json
|
|
|
608
615
|
*/
|
|
609
616
|
outputDir?: string;
|
|
610
617
|
|
|
611
|
-
/**
|
|
612
|
-
* Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
|
|
613
|
-
*/
|
|
614
|
-
outputMode?: 'file' | 'stdout';
|
|
615
|
-
|
|
616
618
|
console?: {
|
|
617
619
|
/**
|
|
618
620
|
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
|
|
@@ -655,6 +657,11 @@ npx @playwright/mcp@latest --config path/to/config.json
|
|
|
655
657
|
* Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
|
|
656
658
|
*/
|
|
657
659
|
navigation?: number;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Configures default expect timeout: https://playwright.dev/docs/test-timeouts#expect-timeout. Defaults to 5000ms.
|
|
663
|
+
*/
|
|
664
|
+
expect?: number;
|
|
658
665
|
};
|
|
659
666
|
|
|
660
667
|
/**
|
|
@@ -666,12 +673,14 @@ npx @playwright/mcp@latest --config path/to/config.json
|
|
|
666
673
|
/**
|
|
667
674
|
* When taking snapshots for responses, specifies the mode to use.
|
|
668
675
|
*/
|
|
669
|
-
mode?: '
|
|
676
|
+
mode?: 'full' | 'none';
|
|
670
677
|
};
|
|
671
678
|
|
|
672
679
|
/**
|
|
673
|
-
*
|
|
674
|
-
*
|
|
680
|
+
* allowUnrestrictedFileAccess acts as a guardrail to prevent the LLM from accidentally
|
|
681
|
+
* wandering outside its intended workspace. It is a convenience defense to catch unintended
|
|
682
|
+
* file access, not a secure boundary; a deliberate attempt to reach other directories can be
|
|
683
|
+
* easily worked around, so always rely on client-level permissions for true security.
|
|
675
684
|
*/
|
|
676
685
|
allowUnrestrictedFileAccess?: boolean;
|
|
677
686
|
|
|
@@ -707,6 +716,10 @@ And then in MCP client config, set the `url` to the HTTP endpoint:
|
|
|
707
716
|
}
|
|
708
717
|
```
|
|
709
718
|
|
|
719
|
+
## Security
|
|
720
|
+
|
|
721
|
+
Playwright MCP is **not** a security boundary. See [MCP Security Best Practices](https://modelcontextprotocol.io/docs/tutorials/security/security_best_practices) for guidance on securing your deployment.
|
|
722
|
+
|
|
710
723
|
<details>
|
|
711
724
|
<summary><b>Docker</b></summary>
|
|
712
725
|
|
|
@@ -731,7 +744,7 @@ docker run -d -i --rm --init --pull=always \
|
|
|
731
744
|
--name playwright \
|
|
732
745
|
-p 8931:8931 \
|
|
733
746
|
mcr.microsoft.com/playwright/mcp \
|
|
734
|
-
cli.js --headless --browser chromium --no-sandbox --port 8931
|
|
747
|
+
cli.js --headless --browser chromium --no-sandbox --port 8931 --host 0.0.0.0
|
|
735
748
|
```
|
|
736
749
|
|
|
737
750
|
The server will listen on host port **8931** and can be reached by any MCP client.
|
|
@@ -780,6 +793,7 @@ http.createServer(async (req, res) => {
|
|
|
780
793
|
- Parameters:
|
|
781
794
|
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
782
795
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
796
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available
|
|
783
797
|
- `doubleClick` (boolean, optional): Whether to perform a double click instead of a single click
|
|
784
798
|
- `button` (string, optional): Button to click, defaults to left
|
|
785
799
|
- `modifiers` (array, optional): Modifier keys to press
|
|
@@ -800,6 +814,7 @@ http.createServer(async (req, res) => {
|
|
|
800
814
|
- Description: Returns all console messages
|
|
801
815
|
- Parameters:
|
|
802
816
|
- `level` (string): Level of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
|
|
817
|
+
- `all` (boolean, optional): Return all console messages since the beginning of the session, not just since the last navigation. Defaults to false.
|
|
803
818
|
- `filename` (string, optional): Filename to save the console messages to. If not provided, messages are returned as text.
|
|
804
819
|
- Read-only: **true**
|
|
805
820
|
|
|
@@ -811,8 +826,10 @@ http.createServer(async (req, res) => {
|
|
|
811
826
|
- Parameters:
|
|
812
827
|
- `startElement` (string): Human-readable source element description used to obtain the permission to interact with the element
|
|
813
828
|
- `startRef` (string): Exact source element reference from the page snapshot
|
|
829
|
+
- `startSelector` (string, optional): CSS or role selector for the source element, when ref is not available
|
|
814
830
|
- `endElement` (string): Human-readable target element description used to obtain the permission to interact with the element
|
|
815
831
|
- `endRef` (string): Exact target element reference from the page snapshot
|
|
832
|
+
- `endSelector` (string, optional): CSS or role selector for the target element, when ref is not available
|
|
816
833
|
- Read-only: **false**
|
|
817
834
|
|
|
818
835
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -824,6 +841,8 @@ http.createServer(async (req, res) => {
|
|
|
824
841
|
- `function` (string): () => { /* code */ } or (element) => { /* code */ } when element is provided
|
|
825
842
|
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
826
843
|
- `ref` (string, optional): Exact target element reference from the page snapshot
|
|
844
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available.
|
|
845
|
+
- `filename` (string, optional): Filename to save the result to. If not provided, result is returned as text.
|
|
827
846
|
- Read-only: **false**
|
|
828
847
|
|
|
829
848
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -862,6 +881,7 @@ http.createServer(async (req, res) => {
|
|
|
862
881
|
- Parameters:
|
|
863
882
|
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
864
883
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
884
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available
|
|
865
885
|
- Read-only: **false**
|
|
866
886
|
|
|
867
887
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -887,7 +907,10 @@ http.createServer(async (req, res) => {
|
|
|
887
907
|
- Title: List network requests
|
|
888
908
|
- Description: Returns all network requests since loading the page
|
|
889
909
|
- Parameters:
|
|
890
|
-
- `
|
|
910
|
+
- `static` (boolean): Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.
|
|
911
|
+
- `requestBody` (boolean): Whether to include request body. Defaults to false.
|
|
912
|
+
- `requestHeaders` (boolean): Whether to include request headers. Defaults to false.
|
|
913
|
+
- `filter` (string, optional): Only return requests whose URL matches this regexp (e.g. "/api/.*user").
|
|
891
914
|
- `filename` (string, optional): Filename to save the network requests to. If not provided, requests are returned as text.
|
|
892
915
|
- Read-only: **true**
|
|
893
916
|
|
|
@@ -916,7 +939,8 @@ http.createServer(async (req, res) => {
|
|
|
916
939
|
- Title: Run Playwright code
|
|
917
940
|
- Description: Run Playwright code snippet
|
|
918
941
|
- Parameters:
|
|
919
|
-
- `code` (string): A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }`
|
|
942
|
+
- `code` (string, optional): A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page.getByRole('button', { name: 'Submit' }).click(); return await page.title(); }`
|
|
943
|
+
- `filename` (string, optional): Load code from the specified file. If both code and filename are provided, code will be ignored.
|
|
920
944
|
- Read-only: **false**
|
|
921
945
|
|
|
922
946
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -927,6 +951,7 @@ http.createServer(async (req, res) => {
|
|
|
927
951
|
- Parameters:
|
|
928
952
|
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
929
953
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
954
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available
|
|
930
955
|
- `values` (array): Array of values to select in the dropdown. This can be a single value or multiple values.
|
|
931
956
|
- Read-only: **false**
|
|
932
957
|
|
|
@@ -937,6 +962,8 @@ http.createServer(async (req, res) => {
|
|
|
937
962
|
- Description: Capture accessibility snapshot of the current page, this is better than screenshot
|
|
938
963
|
- Parameters:
|
|
939
964
|
- `filename` (string, optional): Save snapshot to markdown file instead of returning it in the response.
|
|
965
|
+
- `selector` (string, optional): Element selector of the root element to capture a partial snapshot instead of the whole page
|
|
966
|
+
- `depth` (number, optional): Limit the depth of the snapshot tree
|
|
940
967
|
- Read-only: **true**
|
|
941
968
|
|
|
942
969
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -949,6 +976,7 @@ http.createServer(async (req, res) => {
|
|
|
949
976
|
- `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.
|
|
950
977
|
- `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.
|
|
951
978
|
- `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.
|
|
979
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available.
|
|
952
980
|
- `fullPage` (boolean, optional): When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.
|
|
953
981
|
- Read-only: **true**
|
|
954
982
|
|
|
@@ -960,6 +988,7 @@ http.createServer(async (req, res) => {
|
|
|
960
988
|
- Parameters:
|
|
961
989
|
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
962
990
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
991
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available
|
|
963
992
|
- `text` (string): Text to type into the element
|
|
964
993
|
- `submit` (boolean, optional): Whether to submit entered text (press Enter after)
|
|
965
994
|
- `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.
|
|
@@ -996,16 +1025,289 @@ http.createServer(async (req, res) => {
|
|
|
996
1025
|
<details>
|
|
997
1026
|
<summary><b>Browser installation</b></summary>
|
|
998
1027
|
|
|
1028
|
+
</details>
|
|
1029
|
+
|
|
1030
|
+
<details>
|
|
1031
|
+
<summary><b>Configuration (opt-in via --caps=config)</b></summary>
|
|
1032
|
+
|
|
1033
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1034
|
+
|
|
1035
|
+
- **browser_get_config**
|
|
1036
|
+
- Title: Get config
|
|
1037
|
+
- Description: Get the final resolved config after merging CLI options, environment variables and config file.
|
|
1038
|
+
- Parameters: None
|
|
1039
|
+
- Read-only: **true**
|
|
1040
|
+
|
|
1041
|
+
</details>
|
|
1042
|
+
|
|
1043
|
+
<details>
|
|
1044
|
+
<summary><b>Network (opt-in via --caps=network)</b></summary>
|
|
1045
|
+
|
|
1046
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1047
|
+
|
|
1048
|
+
- **browser_network_state_set**
|
|
1049
|
+
- Title: Set network state
|
|
1050
|
+
- Description: Sets the browser network state to online or offline. When offline, all network requests will fail.
|
|
1051
|
+
- Parameters:
|
|
1052
|
+
- `state` (string): Set to "offline" to simulate offline mode, "online" to restore network connectivity
|
|
1053
|
+
- Read-only: **false**
|
|
1054
|
+
|
|
1055
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1056
|
+
|
|
1057
|
+
- **browser_route**
|
|
1058
|
+
- Title: Mock network requests
|
|
1059
|
+
- Description: Set up a route to mock network requests matching a URL pattern
|
|
1060
|
+
- Parameters:
|
|
1061
|
+
- `pattern` (string): URL pattern to match (e.g., "**/api/users", "**/*.{png,jpg}")
|
|
1062
|
+
- `status` (number, optional): HTTP status code to return (default: 200)
|
|
1063
|
+
- `body` (string, optional): Response body (text or JSON string)
|
|
1064
|
+
- `contentType` (string, optional): Content-Type header (e.g., "application/json", "text/html")
|
|
1065
|
+
- `headers` (array, optional): Headers to add in "Name: Value" format
|
|
1066
|
+
- `removeHeaders` (string, optional): Comma-separated list of header names to remove from request
|
|
1067
|
+
- Read-only: **false**
|
|
1068
|
+
|
|
999
1069
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1000
1070
|
|
|
1001
|
-
- **
|
|
1002
|
-
- Title:
|
|
1003
|
-
- Description:
|
|
1071
|
+
- **browser_route_list**
|
|
1072
|
+
- Title: List network routes
|
|
1073
|
+
- Description: List all active network routes
|
|
1004
1074
|
- Parameters: None
|
|
1075
|
+
- Read-only: **true**
|
|
1076
|
+
|
|
1077
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1078
|
+
|
|
1079
|
+
- **browser_unroute**
|
|
1080
|
+
- Title: Remove network routes
|
|
1081
|
+
- Description: Remove network routes matching a pattern (or all routes if no pattern specified)
|
|
1082
|
+
- Parameters:
|
|
1083
|
+
- `pattern` (string, optional): URL pattern to unroute (omit to remove all routes)
|
|
1005
1084
|
- Read-only: **false**
|
|
1006
1085
|
|
|
1007
1086
|
</details>
|
|
1008
1087
|
|
|
1088
|
+
<details>
|
|
1089
|
+
<summary><b>Storage (opt-in via --caps=storage)</b></summary>
|
|
1090
|
+
|
|
1091
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1092
|
+
|
|
1093
|
+
- **browser_cookie_clear**
|
|
1094
|
+
- Title: Clear cookies
|
|
1095
|
+
- Description: Clear all cookies
|
|
1096
|
+
- Parameters: None
|
|
1097
|
+
- Read-only: **false**
|
|
1098
|
+
|
|
1099
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1100
|
+
|
|
1101
|
+
- **browser_cookie_delete**
|
|
1102
|
+
- Title: Delete cookie
|
|
1103
|
+
- Description: Delete a specific cookie
|
|
1104
|
+
- Parameters:
|
|
1105
|
+
- `name` (string): Cookie name to delete
|
|
1106
|
+
- Read-only: **false**
|
|
1107
|
+
|
|
1108
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1109
|
+
|
|
1110
|
+
- **browser_cookie_get**
|
|
1111
|
+
- Title: Get cookie
|
|
1112
|
+
- Description: Get a specific cookie by name
|
|
1113
|
+
- Parameters:
|
|
1114
|
+
- `name` (string): Cookie name to get
|
|
1115
|
+
- Read-only: **true**
|
|
1116
|
+
|
|
1117
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1118
|
+
|
|
1119
|
+
- **browser_cookie_list**
|
|
1120
|
+
- Title: List cookies
|
|
1121
|
+
- Description: List all cookies (optionally filtered by domain/path)
|
|
1122
|
+
- Parameters:
|
|
1123
|
+
- `domain` (string, optional): Filter cookies by domain
|
|
1124
|
+
- `path` (string, optional): Filter cookies by path
|
|
1125
|
+
- Read-only: **true**
|
|
1126
|
+
|
|
1127
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1128
|
+
|
|
1129
|
+
- **browser_cookie_set**
|
|
1130
|
+
- Title: Set cookie
|
|
1131
|
+
- Description: Set a cookie with optional flags (domain, path, expires, httpOnly, secure, sameSite)
|
|
1132
|
+
- Parameters:
|
|
1133
|
+
- `name` (string): Cookie name
|
|
1134
|
+
- `value` (string): Cookie value
|
|
1135
|
+
- `domain` (string, optional): Cookie domain
|
|
1136
|
+
- `path` (string, optional): Cookie path
|
|
1137
|
+
- `expires` (number, optional): Cookie expiration as Unix timestamp
|
|
1138
|
+
- `httpOnly` (boolean, optional): Whether the cookie is HTTP only
|
|
1139
|
+
- `secure` (boolean, optional): Whether the cookie is secure
|
|
1140
|
+
- `sameSite` (string, optional): Cookie SameSite attribute
|
|
1141
|
+
- Read-only: **false**
|
|
1142
|
+
|
|
1143
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1144
|
+
|
|
1145
|
+
- **browser_localstorage_clear**
|
|
1146
|
+
- Title: Clear localStorage
|
|
1147
|
+
- Description: Clear all localStorage
|
|
1148
|
+
- Parameters: None
|
|
1149
|
+
- Read-only: **false**
|
|
1150
|
+
|
|
1151
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1152
|
+
|
|
1153
|
+
- **browser_localstorage_delete**
|
|
1154
|
+
- Title: Delete localStorage item
|
|
1155
|
+
- Description: Delete a localStorage item
|
|
1156
|
+
- Parameters:
|
|
1157
|
+
- `key` (string): Key to delete
|
|
1158
|
+
- Read-only: **false**
|
|
1159
|
+
|
|
1160
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1161
|
+
|
|
1162
|
+
- **browser_localstorage_get**
|
|
1163
|
+
- Title: Get localStorage item
|
|
1164
|
+
- Description: Get a localStorage item by key
|
|
1165
|
+
- Parameters:
|
|
1166
|
+
- `key` (string): Key to get
|
|
1167
|
+
- Read-only: **true**
|
|
1168
|
+
|
|
1169
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1170
|
+
|
|
1171
|
+
- **browser_localstorage_list**
|
|
1172
|
+
- Title: List localStorage
|
|
1173
|
+
- Description: List all localStorage key-value pairs
|
|
1174
|
+
- Parameters: None
|
|
1175
|
+
- Read-only: **true**
|
|
1176
|
+
|
|
1177
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1178
|
+
|
|
1179
|
+
- **browser_localstorage_set**
|
|
1180
|
+
- Title: Set localStorage item
|
|
1181
|
+
- Description: Set a localStorage item
|
|
1182
|
+
- Parameters:
|
|
1183
|
+
- `key` (string): Key to set
|
|
1184
|
+
- `value` (string): Value to set
|
|
1185
|
+
- Read-only: **false**
|
|
1186
|
+
|
|
1187
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1188
|
+
|
|
1189
|
+
- **browser_sessionstorage_clear**
|
|
1190
|
+
- Title: Clear sessionStorage
|
|
1191
|
+
- Description: Clear all sessionStorage
|
|
1192
|
+
- Parameters: None
|
|
1193
|
+
- Read-only: **false**
|
|
1194
|
+
|
|
1195
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1196
|
+
|
|
1197
|
+
- **browser_sessionstorage_delete**
|
|
1198
|
+
- Title: Delete sessionStorage item
|
|
1199
|
+
- Description: Delete a sessionStorage item
|
|
1200
|
+
- Parameters:
|
|
1201
|
+
- `key` (string): Key to delete
|
|
1202
|
+
- Read-only: **false**
|
|
1203
|
+
|
|
1204
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1205
|
+
|
|
1206
|
+
- **browser_sessionstorage_get**
|
|
1207
|
+
- Title: Get sessionStorage item
|
|
1208
|
+
- Description: Get a sessionStorage item by key
|
|
1209
|
+
- Parameters:
|
|
1210
|
+
- `key` (string): Key to get
|
|
1211
|
+
- Read-only: **true**
|
|
1212
|
+
|
|
1213
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1214
|
+
|
|
1215
|
+
- **browser_sessionstorage_list**
|
|
1216
|
+
- Title: List sessionStorage
|
|
1217
|
+
- Description: List all sessionStorage key-value pairs
|
|
1218
|
+
- Parameters: None
|
|
1219
|
+
- Read-only: **true**
|
|
1220
|
+
|
|
1221
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1222
|
+
|
|
1223
|
+
- **browser_sessionstorage_set**
|
|
1224
|
+
- Title: Set sessionStorage item
|
|
1225
|
+
- Description: Set a sessionStorage item
|
|
1226
|
+
- Parameters:
|
|
1227
|
+
- `key` (string): Key to set
|
|
1228
|
+
- `value` (string): Value to set
|
|
1229
|
+
- Read-only: **false**
|
|
1230
|
+
|
|
1231
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1232
|
+
|
|
1233
|
+
- **browser_set_storage_state**
|
|
1234
|
+
- Title: Restore storage state
|
|
1235
|
+
- Description: Restore storage state (cookies, local storage) from a file. This clears existing cookies and local storage before restoring.
|
|
1236
|
+
- Parameters:
|
|
1237
|
+
- `filename` (string): Path to the storage state file to restore from
|
|
1238
|
+
- Read-only: **false**
|
|
1239
|
+
|
|
1240
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1241
|
+
|
|
1242
|
+
- **browser_storage_state**
|
|
1243
|
+
- Title: Save storage state
|
|
1244
|
+
- Description: Save storage state (cookies, local storage) to a file for later reuse
|
|
1245
|
+
- Parameters:
|
|
1246
|
+
- `filename` (string, optional): File name to save the storage state to. Defaults to `storage-state-{timestamp}.json` if not specified.
|
|
1247
|
+
- Read-only: **true**
|
|
1248
|
+
|
|
1249
|
+
</details>
|
|
1250
|
+
|
|
1251
|
+
<details>
|
|
1252
|
+
<summary><b>DevTools (opt-in via --caps=devtools)</b></summary>
|
|
1253
|
+
|
|
1254
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1255
|
+
|
|
1256
|
+
- **browser_resume**
|
|
1257
|
+
- Title: Resume paused script execution
|
|
1258
|
+
- Description: Resume script execution after it was paused. When called with step set to true, execution will pause again before the next action.
|
|
1259
|
+
- Parameters:
|
|
1260
|
+
- `step` (boolean, optional): When true, execution will pause again before the next action, allowing step-by-step debugging.
|
|
1261
|
+
- `location` (string, optional): Pause execution at a specific <file>:<line>, e.g. "example.spec.ts:42".
|
|
1262
|
+
- Read-only: **false**
|
|
1263
|
+
|
|
1264
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1265
|
+
|
|
1266
|
+
- **browser_start_tracing**
|
|
1267
|
+
- Title: Start tracing
|
|
1268
|
+
- Description: Start trace recording
|
|
1269
|
+
- Parameters: None
|
|
1270
|
+
- Read-only: **true**
|
|
1271
|
+
|
|
1272
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1273
|
+
|
|
1274
|
+
- **browser_start_video**
|
|
1275
|
+
- Title: Start video
|
|
1276
|
+
- Description: Start video recording
|
|
1277
|
+
- Parameters:
|
|
1278
|
+
- `filename` (string, optional): Filename to save the video.
|
|
1279
|
+
- `size` (object, optional): Video size
|
|
1280
|
+
- Read-only: **true**
|
|
1281
|
+
|
|
1282
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1283
|
+
|
|
1284
|
+
- **browser_stop_tracing**
|
|
1285
|
+
- Title: Stop tracing
|
|
1286
|
+
- Description: Stop trace recording
|
|
1287
|
+
- Parameters: None
|
|
1288
|
+
- Read-only: **true**
|
|
1289
|
+
|
|
1290
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1291
|
+
|
|
1292
|
+
- **browser_stop_video**
|
|
1293
|
+
- Title: Stop video
|
|
1294
|
+
- Description: Stop video recording
|
|
1295
|
+
- Parameters: None
|
|
1296
|
+
- Read-only: **true**
|
|
1297
|
+
|
|
1298
|
+
<!-- NOTE: This has been generated via update-readme.js -->
|
|
1299
|
+
|
|
1300
|
+
- **browser_video_chapter**
|
|
1301
|
+
- Title: Video chapter
|
|
1302
|
+
- Description: Add a chapter marker to the video recording. Shows a full-screen chapter card with blurred backdrop.
|
|
1303
|
+
- Parameters:
|
|
1304
|
+
- `title` (string): Chapter title
|
|
1305
|
+
- `description` (string, optional): Chapter description
|
|
1306
|
+
- `duration` (number, optional): Duration in milliseconds to show the chapter card
|
|
1307
|
+
- Read-only: **true**
|
|
1308
|
+
|
|
1309
|
+
</details>
|
|
1310
|
+
|
|
1009
1311
|
<details>
|
|
1010
1312
|
<summary><b>Coordinate-based (opt-in via --caps=vision)</b></summary>
|
|
1011
1313
|
|
|
@@ -1013,10 +1315,13 @@ http.createServer(async (req, res) => {
|
|
|
1013
1315
|
|
|
1014
1316
|
- **browser_mouse_click_xy**
|
|
1015
1317
|
- Title: Click
|
|
1016
|
-
- Description: Click
|
|
1318
|
+
- Description: Click mouse button at a given position
|
|
1017
1319
|
- Parameters:
|
|
1018
1320
|
- `x` (number): X coordinate
|
|
1019
1321
|
- `y` (number): Y coordinate
|
|
1322
|
+
- `button` (string, optional): Button to click, defaults to left
|
|
1323
|
+
- `clickCount` (number, optional): Number of clicks, defaults to 1
|
|
1324
|
+
- `delay` (number, optional): Time to wait between mouse down and mouse up in milliseconds, defaults to 0
|
|
1020
1325
|
- Read-only: **false**
|
|
1021
1326
|
|
|
1022
1327
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -1096,6 +1401,7 @@ http.createServer(async (req, res) => {
|
|
|
1096
1401
|
- Parameters:
|
|
1097
1402
|
- `element` (string, optional): Human-readable element description used to obtain permission to interact with the element
|
|
1098
1403
|
- `ref` (string): Exact target element reference from the page snapshot
|
|
1404
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available
|
|
1099
1405
|
- Read-only: **true**
|
|
1100
1406
|
|
|
1101
1407
|
<!-- NOTE: This has been generated via update-readme.js -->
|
|
@@ -1116,6 +1422,7 @@ http.createServer(async (req, res) => {
|
|
|
1116
1422
|
- Parameters:
|
|
1117
1423
|
- `element` (string): Human-readable list description
|
|
1118
1424
|
- `ref` (string): Exact target element reference that points to the list
|
|
1425
|
+
- `selector` (string, optional): CSS or role selector for the target list, when "ref" is not available.
|
|
1119
1426
|
- `items` (array): Items to verify
|
|
1120
1427
|
- Read-only: **false**
|
|
1121
1428
|
|
|
@@ -1136,16 +1443,12 @@ http.createServer(async (req, res) => {
|
|
|
1136
1443
|
- Parameters:
|
|
1137
1444
|
- `type` (string): Type of the element
|
|
1138
1445
|
- `element` (string): Human-readable element description
|
|
1139
|
-
- `ref` (string): Exact target element reference
|
|
1446
|
+
- `ref` (string): Exact target element reference from the page snapshot
|
|
1447
|
+
- `selector` (string, optional): CSS or role selector for the target element, when "ref" is not available
|
|
1140
1448
|
- `value` (string): Value to verify. For checkbox, use "true" or "false".
|
|
1141
1449
|
- Read-only: **false**
|
|
1142
1450
|
|
|
1143
1451
|
</details>
|
|
1144
1452
|
|
|
1145
|
-
<details>
|
|
1146
|
-
<summary><b>Tracing (opt-in via --caps=tracing)</b></summary>
|
|
1147
|
-
|
|
1148
|
-
</details>
|
|
1149
|
-
|
|
1150
1453
|
|
|
1151
1454
|
<!--- End of tools generated section -->
|
package/cli.js
CHANGED
|
@@ -16,9 +16,17 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
const { program } = require('playwright-core/lib/utilsBundle');
|
|
19
|
-
const { decorateMCPCommand } = require('playwright/lib/mcp/program');
|
|
19
|
+
const { decorateMCPCommand } = require('playwright-core/lib/tools/mcp/program');
|
|
20
|
+
|
|
21
|
+
if (process.argv.includes('install-browser')) {
|
|
22
|
+
const argv = process.argv.map(arg => arg === 'install-browser' ? 'install' : arg);
|
|
23
|
+
const { program: mainProgram } = require('playwright-core/lib/cli/program');
|
|
24
|
+
mainProgram.parse(argv);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
const packageJSON = require('./package.json');
|
|
22
29
|
const p = program.version('Version ' + packageJSON.version).name('Playwright MCP');
|
|
23
30
|
decorateMCPCommand(p, packageJSON.version)
|
|
31
|
+
|
|
24
32
|
void program.parseAsync(process.argv);
|
package/config.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import type * as playwright from '
|
|
17
|
+
import type * as playwright from '../../..';
|
|
18
18
|
|
|
19
19
|
export type ToolCapability =
|
|
20
20
|
'config' |
|
|
@@ -137,28 +137,15 @@ export type Config = {
|
|
|
137
137
|
*/
|
|
138
138
|
saveSession?: boolean;
|
|
139
139
|
|
|
140
|
-
/**
|
|
141
|
-
* Whether to save the Playwright trace of the session into the output directory.
|
|
142
|
-
*/
|
|
143
|
-
saveTrace?: boolean;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* If specified, saves the Playwright video of the session into the output directory.
|
|
147
|
-
*/
|
|
148
|
-
saveVideo?: {
|
|
149
|
-
width: number;
|
|
150
|
-
height: number;
|
|
151
|
-
};
|
|
152
|
-
|
|
153
140
|
/**
|
|
154
141
|
* Reuse the same browser context between all connected HTTP clients.
|
|
155
142
|
*/
|
|
156
143
|
sharedBrowserContext?: boolean;
|
|
157
144
|
|
|
158
145
|
/**
|
|
159
|
-
* Secrets are used to
|
|
160
|
-
*
|
|
161
|
-
*
|
|
146
|
+
* Secrets are used to replace matching plain text in the tool responses to prevent the LLM
|
|
147
|
+
* from accidentally getting sensitive data. It is a convenience and not a security feature,
|
|
148
|
+
* make sure to always examine information coming in and from the tool on the client.
|
|
162
149
|
*/
|
|
163
150
|
secrets?: Record<string, string>;
|
|
164
151
|
|
|
@@ -167,11 +154,6 @@ export type Config = {
|
|
|
167
154
|
*/
|
|
168
155
|
outputDir?: string;
|
|
169
156
|
|
|
170
|
-
/**
|
|
171
|
-
* Whether to save snapshots, console messages, network logs and other session logs to a file or to the standard output. Defaults to "stdout".
|
|
172
|
-
*/
|
|
173
|
-
outputMode?: 'file' | 'stdout';
|
|
174
|
-
|
|
175
157
|
console?: {
|
|
176
158
|
/**
|
|
177
159
|
* The level of console messages to return. Each level includes the messages of more severe levels. Defaults to "info".
|
|
@@ -214,6 +196,11 @@ export type Config = {
|
|
|
214
196
|
* Configures default navigation timeout: https://playwright.dev/docs/api/class-page#page-set-default-navigation-timeout. Defaults to 60000ms.
|
|
215
197
|
*/
|
|
216
198
|
navigation?: number;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Configures default expect timeout: https://playwright.dev/docs/test-timeouts#expect-timeout. Defaults to 5000ms.
|
|
202
|
+
*/
|
|
203
|
+
expect?: number;
|
|
217
204
|
};
|
|
218
205
|
|
|
219
206
|
/**
|
|
@@ -225,12 +212,14 @@ export type Config = {
|
|
|
225
212
|
/**
|
|
226
213
|
* When taking snapshots for responses, specifies the mode to use.
|
|
227
214
|
*/
|
|
228
|
-
mode?: '
|
|
215
|
+
mode?: 'full' | 'none';
|
|
229
216
|
};
|
|
230
217
|
|
|
231
218
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
219
|
+
* allowUnrestrictedFileAccess acts as a guardrail to prevent the LLM from accidentally
|
|
220
|
+
* wandering outside its intended workspace. It is a convenience defense to catch unintended
|
|
221
|
+
* file access, not a secure boundary; a deliberate attempt to reach other directories can be
|
|
222
|
+
* easily worked around, so always rely on client-level permissions for true security.
|
|
234
223
|
*/
|
|
235
224
|
allowUnrestrictedFileAccess?: boolean;
|
|
236
225
|
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playwright/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"description": "Playwright Tools for MCP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"name": "Microsoft Corporation"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
|
+
"mcpName": "io.github.microsoft/playwright-mcp",
|
|
17
18
|
"scripts": {
|
|
18
19
|
"lint": "node update-readme.js",
|
|
19
20
|
"test": "playwright test",
|
|
@@ -32,8 +33,8 @@
|
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"playwright": "1.59.0-alpha-
|
|
36
|
-
"playwright-core": "1.59.0-alpha-
|
|
36
|
+
"playwright": "1.59.0-alpha-1774912654000",
|
|
37
|
+
"playwright-core": "1.59.0-alpha-1774912654000"
|
|
37
38
|
},
|
|
38
39
|
"bin": {
|
|
39
40
|
"playwright-mcp": "cli.js"
|