@midscene/mcp 0.16.1 → 0.16.2

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 CHANGED
@@ -1,68 +1,3 @@
1
1
  # Midscene MCP
2
2
 
3
- ⚠️ Note that midscene is currently only in the experimental stage and not online, and availability is not guaranteed at present
4
-
5
- ## Usage
6
-
7
- ## Features
8
-
9
- Midscene MCP Server allows you to control browsers using natural language commands, supporting the following features:
10
-
11
- - **Page Control:** You can directly control your current browser through the bridge mode provided by chrome devtools
12
- - **Navigation:** Open URLs, go forward, and go back.
13
- - **Interaction:** Clicking, Input, and Hovering.
14
- - **Achieving Goals:** Accomplish tasks by describing goals in natural language, letting AI complete them automatically.
15
- - **Screenshots:** Capture screenshots of the current page.
16
- - **JavaScript Execution:** Execute JavaScript code on the current page.
17
- - **Tab Management:** Get list of tabs, allowing LLM to select which tab to operate on.
18
-
19
- > step1:
20
- * Donwload and Install chrome devtools: https://github.com/web-infra-dev/midscene/actions/runs/14595366638
21
- * Switch to `Bridge Mode` and click allow connection
22
-
23
- > step2:
24
- * Install Midscene MCP Server:
25
-
26
- ```json
27
- {
28
- "mcpServers": {
29
- "mcp-midscene": {
30
- "command": "npx",
31
- "args": [
32
- "-y",
33
- "@midscene/mcp@0.15.2-beta-20250422125908.0"
34
- ],
35
- "env": {
36
- "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
37
- "MIDSCENE_MODEL_NAME": "YOUR_MODEL_NAME",
38
- "MCP_SERVER_REQUEST_TIMEOUT": "800000"
39
- }
40
- }
41
- }
42
- }
43
- ```
44
-
45
- * For reference configuration of the model, you can refer to:
46
-
47
- ## Inspect the MCP server
48
-
49
- > [!NOTE]
50
-
51
- Starting multiple inspect pages may cause the /message sse link error to occur in MTP
52
-
53
- ```bash
54
- # before run this command, you need to build the library first
55
- pnpm run inspect
56
- ```
57
-
58
-
59
- ## TODO
60
-
61
- - [x] Support launching in Puppeteer mode
62
- - [x] Provide comprehensive usage documentation
63
- - [ ] Provide examples
64
- - [ ] Optimize automated tests
65
- - [ ] Test usability/effectiveness
66
- - Tools
67
- - [x] Support getting tab list, allowing LLM to decide which tab to use
68
- - [ ] Test effectiveness of controlling Android
3
+ docs: https://midscenejs.com/mcp.html
package/dist/index.cjs CHANGED
@@ -228,10 +228,6 @@ class MidsceneManager {
228
228
  {
229
229
  type: 'text',
230
230
  text: `Navigated to ${url}`
231
- },
232
- {
233
- type: 'text',
234
- text: `report file: ${agent.reportFile}`
235
231
  }
236
232
  ],
237
233
  isError: false
@@ -505,26 +501,17 @@ const PROMPTS = {
505
501
  (0, utils_namespaceObject.setIsMcp)(true);
506
502
  const src_server = new mcp_js_namespaceObject.McpServer({
507
503
  name: '@midscene/mcp',
508
- version: '0.16.1',
504
+ version: '0.16.2',
509
505
  description: 'Midscene MCP Server: Control the browser using natural language commands for navigation, clicking, input, hovering, and achieving goals. Also supports screenshots and JavaScript execution.'
510
506
  });
511
- src_server.resource('playwright-example', 'file:///playwright-example.mdx', async (uri)=>({
512
- contents: [
507
+ src_server.tool('midscene_playwright_example', 'Provides Playwright code examples for Midscene. If users need to generate Midscene test cases, they can call this method to get sample Midscene Playwright test cases for generating end-user test cases. Each step must first be verified using the mcp method, and then the final test case is generated based on the playwright example according to the steps executed by mcp', {}, async ()=>({
508
+ content: [
513
509
  {
514
- uri: uri.href,
515
- text: PROMPTS.PLAYWRIGHT_CODE_EXAMPLE,
516
- mimeType: 'text/plain'
510
+ type: 'text',
511
+ text: PROMPTS.PLAYWRIGHT_CODE_EXAMPLE
517
512
  }
518
- ]
519
- }));
520
- src_server.resource('midscene-api-docs', 'file:///midscene-api-docs.mdx', async (uri)=>({
521
- contents: [
522
- {
523
- uri: uri.href,
524
- text: PROMPTS.MIDSCENE_API_DOCS,
525
- mimeType: 'text/plain'
526
- }
527
- ]
513
+ ],
514
+ isError: false
528
515
  }));
529
516
  const midsceneManager = new MidsceneManager(src_server);
530
517
  async function runServer() {
@@ -534,8 +521,8 @@ async function runServer() {
534
521
  runServer().catch(console.error);
535
522
  process.stdin.on('close', ()=>{
536
523
  console.error('Midscene MCP Server closing, cleaning up browser...');
537
- midsceneManager.closeBrowser().catch(console.error);
538
524
  src_server.close();
525
+ midsceneManager.closeBrowser().catch(console.error);
539
526
  });
540
527
  for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
541
528
  Object.defineProperty(exports, '__esModule', {
package/dist/index.js CHANGED
@@ -206,10 +206,6 @@ class MidsceneManager {
206
206
  {
207
207
  type: 'text',
208
208
  text: `Navigated to ${url}`
209
- },
210
- {
211
- type: 'text',
212
- text: `report file: ${agent.reportFile}`
213
209
  }
214
210
  ],
215
211
  isError: false
@@ -479,26 +475,17 @@ const PROMPTS = {
479
475
  (0, __WEBPACK_EXTERNAL_MODULE__midscene_shared_utils_b0457388__.setIsMcp)(true);
480
476
  const src_server = new __WEBPACK_EXTERNAL_MODULE__modelcontextprotocol_sdk_server_mcp_js_2c42c5d0__.McpServer({
481
477
  name: '@midscene/mcp',
482
- version: '0.16.1',
478
+ version: '0.16.2',
483
479
  description: 'Midscene MCP Server: Control the browser using natural language commands for navigation, clicking, input, hovering, and achieving goals. Also supports screenshots and JavaScript execution.'
484
480
  });
485
- src_server.resource('playwright-example', 'file:///playwright-example.mdx', async (uri)=>({
486
- contents: [
481
+ src_server.tool('midscene_playwright_example', 'Provides Playwright code examples for Midscene. If users need to generate Midscene test cases, they can call this method to get sample Midscene Playwright test cases for generating end-user test cases. Each step must first be verified using the mcp method, and then the final test case is generated based on the playwright example according to the steps executed by mcp', {}, async ()=>({
482
+ content: [
487
483
  {
488
- uri: uri.href,
489
- text: PROMPTS.PLAYWRIGHT_CODE_EXAMPLE,
490
- mimeType: 'text/plain'
484
+ type: 'text',
485
+ text: PROMPTS.PLAYWRIGHT_CODE_EXAMPLE
491
486
  }
492
- ]
493
- }));
494
- src_server.resource('midscene-api-docs', 'file:///midscene-api-docs.mdx', async (uri)=>({
495
- contents: [
496
- {
497
- uri: uri.href,
498
- text: PROMPTS.MIDSCENE_API_DOCS,
499
- mimeType: 'text/plain'
500
- }
501
- ]
487
+ ],
488
+ isError: false
502
489
  }));
503
490
  const midsceneManager = new MidsceneManager(src_server);
504
491
  async function runServer() {
@@ -508,6 +495,6 @@ async function runServer() {
508
495
  runServer().catch(console.error);
509
496
  process.stdin.on('close', ()=>{
510
497
  console.error('Midscene MCP Server closing, cleaning up browser...');
511
- midsceneManager.closeBrowser().catch(console.error);
512
498
  src_server.close();
499
+ midsceneManager.closeBrowser().catch(console.error);
513
500
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/mcp",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -9,9 +9,7 @@
9
9
  "require": "./dist/index.cjs"
10
10
  }
11
11
  },
12
- "bin": {
13
- "midscene-mcp": "dist/index.cjs"
14
- },
12
+ "bin": "dist/index.cjs",
15
13
  "main": "./dist/index.cjs",
16
14
  "module": "./dist/index.js",
17
15
  "types": "./dist/index.d.ts",
@@ -30,9 +28,9 @@
30
28
  "@modelcontextprotocol/sdk": "1.10.1",
31
29
  "puppeteer": "24.2.0",
32
30
  "zod": "3.24.3",
33
- "@midscene/web": "0.16.1",
34
- "@midscene/shared": "0.16.1",
35
- "@midscene/core": "0.16.1"
31
+ "@midscene/shared": "0.16.2",
32
+ "@midscene/core": "0.16.2",
33
+ "@midscene/web": "0.16.2"
36
34
  },
37
35
  "scripts": {
38
36
  "build": "rslib build",