mobai-mcp 1.3.0 → 1.4.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.
Files changed (2) hide show
  1. package/dist/index.js +282 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -238,6 +238,136 @@ const TOOLS = [
238
238
  required: ["device_id"],
239
239
  },
240
240
  },
241
+ {
242
+ name: "double_tap",
243
+ description: "Double tap an element by index (from UI tree) or coordinates",
244
+ inputSchema: {
245
+ type: "object",
246
+ properties: {
247
+ device_id: {
248
+ type: "string",
249
+ description: "Device ID",
250
+ },
251
+ index: {
252
+ type: "number",
253
+ description: "Element index from UI tree (preferred)",
254
+ },
255
+ x: {
256
+ type: "number",
257
+ description: "X coordinate (use with y instead of index)",
258
+ },
259
+ y: {
260
+ type: "number",
261
+ description: "Y coordinate (use with x instead of index)",
262
+ },
263
+ },
264
+ required: ["device_id"],
265
+ },
266
+ },
267
+ {
268
+ name: "long_press",
269
+ description: "Long press an element by index (from UI tree) or coordinates. Uses a fixed 0.5s hold duration.",
270
+ inputSchema: {
271
+ type: "object",
272
+ properties: {
273
+ device_id: {
274
+ type: "string",
275
+ description: "Device ID",
276
+ },
277
+ index: {
278
+ type: "number",
279
+ description: "Element index from UI tree (preferred)",
280
+ },
281
+ x: {
282
+ type: "number",
283
+ description: "X coordinate (use with y instead of index)",
284
+ },
285
+ y: {
286
+ type: "number",
287
+ description: "Y coordinate (use with x instead of index)",
288
+ },
289
+ },
290
+ required: ["device_id"],
291
+ },
292
+ },
293
+ {
294
+ name: "two_finger_tap",
295
+ description: "Perform a two-finger tap at coordinates (iOS only)",
296
+ inputSchema: {
297
+ type: "object",
298
+ properties: {
299
+ device_id: {
300
+ type: "string",
301
+ description: "Device ID",
302
+ },
303
+ index: {
304
+ type: "number",
305
+ description: "Element index from UI tree (preferred)",
306
+ },
307
+ x: {
308
+ type: "number",
309
+ description: "X coordinate (use with y instead of index)",
310
+ },
311
+ y: {
312
+ type: "number",
313
+ description: "Y coordinate (use with x instead of index)",
314
+ },
315
+ },
316
+ required: ["device_id"],
317
+ },
318
+ },
319
+ {
320
+ name: "drag",
321
+ description: "Drag from one point to another (press, hold, move, release)",
322
+ inputSchema: {
323
+ type: "object",
324
+ properties: {
325
+ device_id: {
326
+ type: "string",
327
+ description: "Device ID",
328
+ },
329
+ from_x: {
330
+ type: "number",
331
+ description: "Starting X coordinate",
332
+ },
333
+ from_y: {
334
+ type: "number",
335
+ description: "Starting Y coordinate",
336
+ },
337
+ to_x: {
338
+ type: "number",
339
+ description: "Ending X coordinate",
340
+ },
341
+ to_y: {
342
+ type: "number",
343
+ description: "Ending Y coordinate",
344
+ },
345
+ duration_ms: {
346
+ type: "number",
347
+ description: "Drag duration in milliseconds (default: 500)",
348
+ },
349
+ press_duration_ms: {
350
+ type: "number",
351
+ description: "Hold duration before dragging in milliseconds (0 = no hold). Use for press-and-drag gestures like moving app icons.",
352
+ },
353
+ },
354
+ required: ["device_id", "from_x", "from_y", "to_x", "to_y"],
355
+ },
356
+ },
357
+ {
358
+ name: "dismiss_keyboard",
359
+ description: "Dismiss the on-screen keyboard if visible",
360
+ inputSchema: {
361
+ type: "object",
362
+ properties: {
363
+ device_id: {
364
+ type: "string",
365
+ description: "Device ID",
366
+ },
367
+ },
368
+ required: ["device_id"],
369
+ },
370
+ },
241
371
  {
242
372
  name: "type_text",
243
373
  description: "Type text on the device (tap input field first to focus)",
@@ -355,7 +485,7 @@ const TOOLS = [
355
485
  description: `Execute a batch of automation steps using the DSL (Domain Specific Language).
356
486
  This is the PREFERRED method for complex automation as it's more reliable than sequential API calls.
357
487
 
358
- DSL supports: observe, tap, type, toggle, swipe, scroll, open_app, navigate, wait_for, assert_*, if_exists, delay, execute_js (web)
488
+ DSL supports: observe, tap, type, toggle, swipe, scroll, open_app, kill_app, navigate, wait_for, screenshot, set_location, reset_location, assert_*, if_exists, delay, execute_js (web)
359
489
 
360
490
  Example DSL script:
361
491
  {
@@ -530,6 +660,78 @@ Example DSL script:
530
660
  required: ["device_id", "script"],
531
661
  },
532
662
  },
663
+ {
664
+ name: "uninstall_app",
665
+ description: "Uninstall an application from the device by bundle ID / package name.",
666
+ inputSchema: {
667
+ type: "object",
668
+ properties: {
669
+ device_id: {
670
+ type: "string",
671
+ description: "Device ID",
672
+ },
673
+ bundle_id: {
674
+ type: "string",
675
+ description: "App bundle ID (iOS) or package name (Android) to uninstall",
676
+ },
677
+ },
678
+ required: ["device_id", "bundle_id"],
679
+ },
680
+ },
681
+ {
682
+ name: "kill_app",
683
+ description: "Force-kill a running application. On iOS (17+), uses CoreDevice appservice SIGKILL. On Android, uses 'am force-stop'.",
684
+ inputSchema: {
685
+ type: "object",
686
+ properties: {
687
+ device_id: {
688
+ type: "string",
689
+ description: "Device ID",
690
+ },
691
+ bundle_id: {
692
+ type: "string",
693
+ description: "Bundle ID / package name of the app to kill",
694
+ },
695
+ },
696
+ required: ["device_id", "bundle_id"],
697
+ },
698
+ },
699
+ {
700
+ name: "set_location",
701
+ description: "Set a simulated GPS location on the device. Supports: iOS (all versions), Android emulators (all versions), Android real devices (12+ only).",
702
+ inputSchema: {
703
+ type: "object",
704
+ properties: {
705
+ device_id: {
706
+ type: "string",
707
+ description: "Device ID",
708
+ },
709
+ lat: {
710
+ type: "number",
711
+ description: "Latitude (-90 to 90)",
712
+ },
713
+ lon: {
714
+ type: "number",
715
+ description: "Longitude (-180 to 180)",
716
+ },
717
+ },
718
+ required: ["device_id", "lat", "lon"],
719
+ },
720
+ },
721
+ {
722
+ name: "reset_location",
723
+ description: "Reset the device location to its real GPS position, removing any simulated location. Supports: iOS (all versions), Android emulators (all versions), Android real devices (12+ only).",
724
+ inputSchema: {
725
+ type: "object",
726
+ properties: {
727
+ device_id: {
728
+ type: "string",
729
+ description: "Device ID",
730
+ },
731
+ },
732
+ required: ["device_id"],
733
+ },
734
+ },
533
735
  {
534
736
  name: "http_request",
535
737
  description: `Make a raw HTTP request to the MobAI API. Use this for advanced operations not covered by other tools.
@@ -616,6 +818,56 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
616
818
  result = await makeRequest("POST", `/devices/${args?.device_id}/tap`, body);
617
819
  break;
618
820
  }
821
+ case "double_tap": {
822
+ const body = {};
823
+ if (args?.index !== undefined)
824
+ body.index = args.index;
825
+ if (args?.x !== undefined && args?.y !== undefined) {
826
+ body.x = args.x;
827
+ body.y = args.y;
828
+ }
829
+ result = await makeRequest("POST", `/devices/${args?.device_id}/double-tap`, body);
830
+ break;
831
+ }
832
+ case "long_press": {
833
+ const body = {};
834
+ if (args?.index !== undefined)
835
+ body.index = args.index;
836
+ if (args?.x !== undefined && args?.y !== undefined) {
837
+ body.x = args.x;
838
+ body.y = args.y;
839
+ }
840
+ result = await makeRequest("POST", `/devices/${args?.device_id}/long-press`, body);
841
+ break;
842
+ }
843
+ case "two_finger_tap": {
844
+ const body = {};
845
+ if (args?.index !== undefined)
846
+ body.index = args.index;
847
+ if (args?.x !== undefined && args?.y !== undefined) {
848
+ body.x = args.x;
849
+ body.y = args.y;
850
+ }
851
+ result = await makeRequest("POST", `/devices/${args?.device_id}/two-finger-tap`, body);
852
+ break;
853
+ }
854
+ case "drag": {
855
+ const dragBody = {
856
+ fromX: args?.from_x,
857
+ fromY: args?.from_y,
858
+ toX: args?.to_x,
859
+ toY: args?.to_y,
860
+ duration: args?.duration_ms ?? 500,
861
+ };
862
+ if (args?.press_duration_ms) {
863
+ dragBody.pressDuration = args.press_duration_ms;
864
+ }
865
+ result = await makeRequest("POST", `/devices/${args?.device_id}/drag`, dragBody);
866
+ break;
867
+ }
868
+ case "dismiss_keyboard":
869
+ result = await makeRequest("POST", `/devices/${args?.device_id}/dismiss-keyboard`);
870
+ break;
619
871
  case "type_text":
620
872
  result = await makeRequest("POST", `/devices/${args?.device_id}/type`, { text: args?.text });
621
873
  break;
@@ -642,6 +894,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
642
894
  case "get_ocr":
643
895
  result = await makeRequest("GET", `/devices/${args?.device_id}/ocr`);
644
896
  break;
897
+ case "uninstall_app":
898
+ result = await makeRequest("DELETE", `/devices/${args?.device_id}/apps/${encodeURIComponent(args?.bundle_id)}`);
899
+ break;
900
+ case "kill_app":
901
+ result = await makeRequest("POST", `/devices/${args?.device_id}/kill-app`, {
902
+ bundleId: args?.bundle_id,
903
+ });
904
+ break;
905
+ case "set_location":
906
+ result = await makeRequest("POST", `/devices/${args?.device_id}/location`, {
907
+ lat: args?.lat,
908
+ lon: args?.lon,
909
+ });
910
+ break;
911
+ case "reset_location":
912
+ result = await makeRequest("DELETE", `/devices/${args?.device_id}/location`);
913
+ break;
645
914
  case "execute_dsl":
646
915
  result = await makeRequest("POST", `/devices/${args?.device_id}/dsl/execute`, args?.script, 300000 // 5 minutes
647
916
  );
@@ -822,10 +1091,17 @@ const API_REFERENCE = `# MobAI API Reference
822
1091
  | Endpoint | Method | Description |
823
1092
  |----------|--------|-------------|
824
1093
  | /devices/{id}/tap | POST | Tap element: {"index": N} or {"x": X, "y": Y} |
1094
+ | /devices/{id}/double-tap | POST | Double tap: {"index": N} or {"x": X, "y": Y} |
1095
+ | /devices/{id}/long-press | POST | Long press (0.5s): {"index": N} or {"x": X, "y": Y} |
1096
+ | /devices/{id}/two-finger-tap | POST | Two-finger tap (iOS): {"index": N} or {"x": X, "y": Y} |
825
1097
  | /devices/{id}/swipe | POST | Swipe: {"fromX", "fromY", "toX", "toY", "duration"} |
1098
+ | /devices/{id}/drag | POST | Drag: {"fromX", "fromY", "toX", "toY", "duration", "pressDuration"} |
826
1099
  | /devices/{id}/type | POST | Type text: {"text": "..."} |
1100
+ | /devices/{id}/dismiss-keyboard | POST | Dismiss on-screen keyboard |
827
1101
  | /devices/{id}/go-home | POST | Go to home screen |
828
1102
  | /devices/{id}/launch-app | POST | Launch app: {"bundleId": "..."} |
1103
+ | /devices/{id}/apps/{bundleId} | DELETE | Uninstall app by bundle ID |
1104
+ | /devices/{id}/kill-app | POST | Kill app: {"bundleId": "..."} |
829
1105
 
830
1106
  ## DSL Execution
831
1107
 
@@ -931,12 +1207,16 @@ The DSL (Domain Specific Language) enables batch execution of multiple automatio
931
1207
  | scroll | Scroll in container | direction, predicate (container), to_element |
932
1208
  | open_app | Launch app | bundle_id |
933
1209
  | navigate | Go home/back | target ("home", "back") |
934
- | wait_for | Wait for element | predicate, timeout_ms |
1210
+ | wait_for | Wait for element or UI stability | predicate, timeout_ms, poll_interval_ms, stable (wait for UI to stop changing) |
1211
+ | screenshot | Save screenshot to file | file_path (directory), name (optional filename) |
935
1212
  | assert_exists | Verify element exists | predicate, timeout_ms |
936
1213
  | assert_not_exists | Verify element gone | predicate |
937
1214
  | delay | Wait fixed time | duration_ms |
938
1215
  | if_exists | Conditional | predicate, then, else |
939
1216
  | select_web_context | Select browser/WebView | url_contains, title_contains (optional filters) |
1217
+ | kill_app | Force-kill running app | bundle_id |
1218
+ | set_location | Simulate GPS location (Android 12+ for real devices) | lat, lon |
1219
+ | reset_location | Reset to real GPS (Android 12+ for real devices) | (no fields) |
940
1220
  | metrics_start | Start performance monitoring | types, bundle_id, label, thresholds, capture_logs |
941
1221
  | metrics_stop | Stop monitoring, get summary | format ("summary" or "detailed") |
942
1222
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobai-mcp",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "mcpName": "io.github.MobAI-App/mobai-mcp",
5
5
  "description": "MCP server for MobAI - AI-powered mobile device automation",
6
6
  "type": "module",