@cotestdev/mcp_playwright 0.0.11 → 0.0.14
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/lib/mcp/cli.js +23 -16
- package/package.json +1 -1
package/lib/mcp/cli.js
CHANGED
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
const { decorateCommand } = require('./program');
|
|
3
|
+
const packageJSON = require('../../package.json');
|
|
4
|
+
|
|
5
|
+
// Import program from playwright dependency
|
|
6
|
+
let program;
|
|
7
|
+
try {
|
|
8
|
+
const { program: prog } = require('playwright-core/lib/cli/program');
|
|
9
|
+
program = prog;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.error('Failed to load playwright program:', e.message);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const command = program.command('run-mcp-server');
|
|
16
|
+
command.description('Interact with the browser over MCP');
|
|
17
|
+
decorateCommand(command, packageJSON.version);
|
|
18
|
+
|
|
19
|
+
// Auto-run the MCP server if no arguments provided
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
if (args.length === 0) {
|
|
22
|
+
// No arguments, automatically run MCP server
|
|
23
|
+
process.argv = ['node', 'cli.js', 'run-mcp-server'];
|
|
24
|
+
}
|
|
17
25
|
|
|
18
|
-
const { program } = require('./program');
|
|
19
26
|
program.parse(process.argv);
|