mobai-mcp 2.2.1 → 2.3.0
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/dist/index.js +18 -1
- package/dist/resources.js +13 -3
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
9
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
10
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
11
11
|
import * as fs from "fs";
|
|
12
12
|
import * as os from "os";
|
|
13
13
|
import * as path from "path";
|
|
14
|
+
import { RESOURCES, getResourceContent } from "./resources.js";
|
|
14
15
|
const API_BASE_URL = "http://127.0.0.1:8686/api/v1";
|
|
15
16
|
const DEFAULT_TIMEOUT_MS = 300000; // 5 minutes (matches Go httpClient timeout)
|
|
16
17
|
const SCREENSHOT_DIR = path.join(os.tmpdir(), "mobai", "screenshots");
|
|
@@ -350,6 +351,22 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
350
351
|
return { tools: TOOLS };
|
|
351
352
|
});
|
|
352
353
|
// ---------------------------------------------------------------------------
|
|
354
|
+
// Resources (reference docs)
|
|
355
|
+
// ---------------------------------------------------------------------------
|
|
356
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
357
|
+
return { resources: RESOURCES };
|
|
358
|
+
});
|
|
359
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
360
|
+
const { uri } = request.params;
|
|
361
|
+
const text = getResourceContent(uri);
|
|
362
|
+
if (text == null) {
|
|
363
|
+
throw new Error(`Unknown resource: ${uri}`);
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
contents: [{ uri, mimeType: "text/plain", text }],
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
// ---------------------------------------------------------------------------
|
|
353
370
|
// Tool call handler
|
|
354
371
|
// ---------------------------------------------------------------------------
|
|
355
372
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
package/dist/resources.js
CHANGED
|
@@ -236,9 +236,11 @@ const DEVICE_AUTOMATION_REF = `<device-automation-reference>
|
|
|
236
236
|
<field name="from_coords" type="Coordinates" required="one-of"/>
|
|
237
237
|
<field name="to_element" type="TargetElement" required="one-of"/>
|
|
238
238
|
<field name="to_coords" type="Coordinates" required="one-of"/>
|
|
239
|
-
<field name="duration_ms" type="int"
|
|
240
|
-
<field name="press_duration_ms" type="int">
|
|
239
|
+
<field name="duration_ms" type="int">Drag motion duration (default 500)</field>
|
|
240
|
+
<field name="press_duration_ms" type="int">Hold before moving (for moving app icons, picking up list items)</field>
|
|
241
|
+
<field name="hold_duration_ms" type="int">Hold at destination before release (useful for iOS drop zones that need a dwell)</field>
|
|
241
242
|
<example>{"action": "drag", "from": {"predicate": {"text": "Item"}}, "to_element": {"predicate": {"text": "Trash"}}}</example>
|
|
243
|
+
<example>{"action": "drag", "from": {"predicate": {"text": "App"}}, "to_element": {"predicate": {"text": "Folder"}}, "press_duration_ms": 500, "hold_duration_ms": 200}</example>
|
|
242
244
|
</action>
|
|
243
245
|
|
|
244
246
|
<action name="press_key">
|
|
@@ -523,7 +525,7 @@ const TESTING_REF = `<testing-reference>
|
|
|
523
525
|
toggle type:switch near "Wi-Fi" on — modifier-only
|
|
524
526
|
drag "Item" to "Trash" — drag element
|
|
525
527
|
drag 100,200 to 300,400 duration:500 — coordinate drag
|
|
526
|
-
drag "App" to "Folder" press_duration:500 — press-
|
|
528
|
+
drag "App" to "Folder" press_duration:500 hold_duration:200 — press-hold-move-hold-release
|
|
527
529
|
wait_for "Element" timeout:5000 — wait for element
|
|
528
530
|
wait_for type:button bounds:bottom_half timeout:3000 — modifier-only
|
|
529
531
|
delay 1000 — wait N ms
|
|
@@ -599,6 +601,14 @@ const TESTING_REF = `<testing-reference>
|
|
|
599
601
|
tap "Other"
|
|
600
602
|
}
|
|
601
603
|
</conditionals>
|
|
604
|
+
|
|
605
|
+
<run-includes>
|
|
606
|
+
run "./path/to/other.mob" — inline another .mob file at compile time
|
|
607
|
+
run "./auth/login.mob" email="x@y" password="hunter2" — pass args; values overlay the target file's # Param: defaults
|
|
608
|
+
run "/abs/path/to/file.mob" — absolute path is allowed
|
|
609
|
+
run "~/shared/login.mob" — ~ expands to the user home directory
|
|
610
|
+
Path is relative to the calling file's directory unless absolute. Args use key=value (no colon, no quotes around the key). Values may contain \${name} references that resolve from the caller's scope at execute time. The target file's extracts flow back into the caller's scope (flat namespace).
|
|
611
|
+
</run-includes>
|
|
602
612
|
</mob-script-syntax>
|
|
603
613
|
|
|
604
614
|
<apis>
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/MobAI-App/mobai-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "2.
|
|
9
|
+
"version": "2.3.0",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "mobai-mcp",
|
|
14
|
-
"version": "2.
|
|
14
|
+
"version": "2.3.0",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|