@cotestdev/mcp_playwright 0.0.31 → 0.0.33
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 +40 -40
- package/lib/mcp/browser/context.js +2 -6
- package/lib/mcp/browser/tools/runCode.js +2 -2
- package/package.json +34 -34
package/README.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
# @cotestdeve/mcp_playwright
|
|
2
|
-
|
|
3
|
-
Playwright MCP (Model Context Protocol) tools for browser automation.
|
|
4
|
-
|
|
5
|
-
This package provides a standalone, published version of Playwright's MCP tools that can be integrated with MCP-compatible applications and AI assistants.
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @cotestdeve/mcp_playwright
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Features
|
|
14
|
-
|
|
15
|
-
- **execute_playwright_script**: Execute arbitrary Playwright scripts within the MCP context
|
|
16
|
-
- **Browser Dialogs**: Handle dialog boxes with automatic code recording
|
|
17
|
-
- **Tab Management**: Manage browser tabs and windows with code generation
|
|
18
|
-
- **Network Monitoring**: Capture and analyze network requests
|
|
19
|
-
- **Page Verification**: Verify page states and elements
|
|
20
|
-
- **Form Automation**: Fill and submit forms automatically
|
|
21
|
-
- **And 15+ more tools** for complete browser automation
|
|
22
|
-
|
|
23
|
-
## Usage
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
import * as mcp_tools from '@cotestdeve/mcp_playwright';
|
|
27
|
-
|
|
28
|
-
// Use Playwright MCP tools in your MCP server
|
|
29
|
-
const tools = mcp_tools.browserTools;
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Related
|
|
33
|
-
|
|
34
|
-
- [Official Playwright MCP](https://github.com/microsoft/playwright-mcp)
|
|
35
|
-
- [Playwright Documentation](https://playwright.dev)
|
|
36
|
-
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
37
|
-
|
|
38
|
-
## License
|
|
39
|
-
|
|
40
|
-
Apache-2.0
|
|
1
|
+
# @cotestdeve/mcp_playwright
|
|
2
|
+
|
|
3
|
+
Playwright MCP (Model Context Protocol) tools for browser automation.
|
|
4
|
+
|
|
5
|
+
This package provides a standalone, published version of Playwright's MCP tools that can be integrated with MCP-compatible applications and AI assistants.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cotestdeve/mcp_playwright
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **execute_playwright_script**: Execute arbitrary Playwright scripts within the MCP context
|
|
16
|
+
- **Browser Dialogs**: Handle dialog boxes with automatic code recording
|
|
17
|
+
- **Tab Management**: Manage browser tabs and windows with code generation
|
|
18
|
+
- **Network Monitoring**: Capture and analyze network requests
|
|
19
|
+
- **Page Verification**: Verify page states and elements
|
|
20
|
+
- **Form Automation**: Fill and submit forms automatically
|
|
21
|
+
- **And 15+ more tools** for complete browser automation
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import * as mcp_tools from '@cotestdeve/mcp_playwright';
|
|
27
|
+
|
|
28
|
+
// Use Playwright MCP tools in your MCP server
|
|
29
|
+
const tools = mcp_tools.browserTools;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Related
|
|
33
|
+
|
|
34
|
+
- [Official Playwright MCP](https://github.com/microsoft/playwright-mcp)
|
|
35
|
+
- [Playwright Documentation](https://playwright.dev)
|
|
36
|
+
- [Model Context Protocol](https://modelcontextprotocol.io)
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
Apache-2.0
|
|
@@ -178,12 +178,8 @@ class Context {
|
|
|
178
178
|
const result = await this._browserContextFactory.createContext(this._clientInfo, this._abortController.signal, this._runningToolName);
|
|
179
179
|
const { browserContext } = result;
|
|
180
180
|
if (!this.config.allowUnrestrictedFileAccess) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
if (typeof browserContext._setAllowedDirectories === "function") {
|
|
185
|
-
browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
|
|
186
|
-
}
|
|
181
|
+
browserContext._setAllowedProtocols(["http:", "https:", "about:", "data:"]);
|
|
182
|
+
browserContext._setAllowedDirectories(allRootPaths(this._clientInfo));
|
|
187
183
|
}
|
|
188
184
|
await this._setupRequestInterception(browserContext);
|
|
189
185
|
if (this.sessionLog)
|
|
@@ -38,7 +38,7 @@ var import_mcpBundle = require("../../../mcpBundleImpl");
|
|
|
38
38
|
var import_tool = require("./tool");
|
|
39
39
|
var import_common = require("./common");
|
|
40
40
|
const codeSchema = import_common.baseSchema.extend({
|
|
41
|
-
code: import_mcpBundle.z.string().describe(`A
|
|
41
|
+
code: import_mcpBundle.z.string().describe(`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(); }\``)
|
|
42
42
|
});
|
|
43
43
|
const runCode = (0, import_tool.defineTabTool)({
|
|
44
44
|
capability: "core",
|
|
@@ -75,7 +75,7 @@ const runCode = (0, import_tool.defineTabTool)({
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
const scriptSchema = import_common.baseSchema.extend({
|
|
78
|
-
code: import_mcpBundle.z.string().describe(`A
|
|
78
|
+
code: import_mcpBundle.z.string().describe(`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(); }\``),
|
|
79
79
|
params: import_mcpBundle.z.record(import_mcpBundle.z.any()).optional().describe("Parameters to pass to the script.")
|
|
80
80
|
});
|
|
81
81
|
const runScript = (0, import_tool.defineTabTool)({
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cotestdev/mcp_playwright",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Playwright MCP (Model Context Protocol) tools for browser automation",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"bin": {
|
|
8
|
-
"mcp-playwright": "lib/mcp/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"lib/**/*.js",
|
|
12
|
-
"lib/**/*.d.ts",
|
|
13
|
-
"lib/**/*.map"
|
|
14
|
-
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "tsc && node scripts/copy-mcp-tools.js",
|
|
17
|
-
"start": "node lib/
|
|
18
|
-
},
|
|
19
|
-
"keywords": [
|
|
20
|
-
"playwright",
|
|
21
|
-
"mcp",
|
|
22
|
-
"browser-automation",
|
|
23
|
-
"model-context-protocol"
|
|
24
|
-
],
|
|
25
|
-
"author": "",
|
|
26
|
-
"license": "Apache-2.0",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"playwright": "^1.40.0"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^20.0.0",
|
|
32
|
-
"typescript": "^5.0.0"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@cotestdev/mcp_playwright",
|
|
3
|
+
"version": "0.0.33",
|
|
4
|
+
"description": "Playwright MCP (Model Context Protocol) tools for browser automation",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mcp-playwright": "lib/mcp/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"lib/**/*.js",
|
|
12
|
+
"lib/**/*.d.ts",
|
|
13
|
+
"lib/**/*.map"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc && node scripts/copy-mcp-tools.js",
|
|
17
|
+
"start": "node lib/program.js"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"playwright",
|
|
21
|
+
"mcp",
|
|
22
|
+
"browser-automation",
|
|
23
|
+
"model-context-protocol"
|
|
24
|
+
],
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "Apache-2.0",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"playwright": "^1.40.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^20.0.0",
|
|
32
|
+
"typescript": "^5.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|