@mobilenext/mobile-mcp 0.0.42 → 0.0.44
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/android.js +3 -1
- package/lib/iphone-simulator.js +1 -1
- package/lib/mobilecli.js +10 -1
- package/lib/server.js +23 -0
- package/package.json +6 -4
package/lib/android.js
CHANGED
|
@@ -75,7 +75,7 @@ const BUTTON_MAP = {
|
|
|
75
75
|
"DPAD_RIGHT": "KEYCODE_DPAD_RIGHT",
|
|
76
76
|
};
|
|
77
77
|
const TIMEOUT = 30000;
|
|
78
|
-
const MAX_BUFFER_SIZE = 1024 * 1024 *
|
|
78
|
+
const MAX_BUFFER_SIZE = 1024 * 1024 * 8;
|
|
79
79
|
class AndroidRobot {
|
|
80
80
|
deviceId;
|
|
81
81
|
constructor(deviceId) {
|
|
@@ -500,6 +500,7 @@ class AndroidDeviceManager {
|
|
|
500
500
|
.map(line => line.trim())
|
|
501
501
|
.filter(line => line !== "")
|
|
502
502
|
.filter(line => !line.startsWith("List of devices attached"))
|
|
503
|
+
.filter(line => line.split("\t")[1]?.trim() === "device") // Only include devices that are online and ready
|
|
503
504
|
.map(line => line.split("\t")[0]);
|
|
504
505
|
return names.map(name => ({
|
|
505
506
|
deviceId: name,
|
|
@@ -519,6 +520,7 @@ class AndroidDeviceManager {
|
|
|
519
520
|
.map(line => line.trim())
|
|
520
521
|
.filter(line => line !== "")
|
|
521
522
|
.filter(line => !line.startsWith("List of devices attached"))
|
|
523
|
+
.filter(line => line.split("\t")[1]?.trim() === "device") // Only include devices that are online and ready
|
|
522
524
|
.map(line => line.split("\t")[0]);
|
|
523
525
|
return names.map(deviceId => ({
|
|
524
526
|
deviceId,
|
package/lib/iphone-simulator.js
CHANGED
|
@@ -10,7 +10,7 @@ const webdriver_agent_1 = require("./webdriver-agent");
|
|
|
10
10
|
const robot_1 = require("./robot");
|
|
11
11
|
const TIMEOUT = 30000;
|
|
12
12
|
const WDA_PORT = 8100;
|
|
13
|
-
const MAX_BUFFER_SIZE = 1024 * 1024 *
|
|
13
|
+
const MAX_BUFFER_SIZE = 1024 * 1024 * 8;
|
|
14
14
|
class Simctl {
|
|
15
15
|
simulatorUuid;
|
|
16
16
|
constructor(simulatorUuid) {
|
package/lib/mobilecli.js
CHANGED
|
@@ -5,7 +5,7 @@ const node_fs_1 = require("node:fs");
|
|
|
5
5
|
const node_path_1 = require("node:path");
|
|
6
6
|
const node_child_process_1 = require("node:child_process");
|
|
7
7
|
const TIMEOUT = 30000;
|
|
8
|
-
const MAX_BUFFER_SIZE = 1024 * 1024 *
|
|
8
|
+
const MAX_BUFFER_SIZE = 1024 * 1024 * 8;
|
|
9
9
|
class Mobilecli {
|
|
10
10
|
path = null;
|
|
11
11
|
constructor() { }
|
|
@@ -71,6 +71,15 @@ class Mobilecli {
|
|
|
71
71
|
return "failed " + error.message;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
fleetListDevices() {
|
|
75
|
+
return this.executeCommand(["fleet", "list-devices"]);
|
|
76
|
+
}
|
|
77
|
+
fleetAllocate(platform) {
|
|
78
|
+
return this.executeCommand(["fleet", "allocate", "--platform", platform]);
|
|
79
|
+
}
|
|
80
|
+
fleetRelease(deviceId) {
|
|
81
|
+
return this.executeCommand(["fleet", "release", "--device", deviceId]);
|
|
82
|
+
}
|
|
74
83
|
getDevices(options) {
|
|
75
84
|
const args = ["devices"];
|
|
76
85
|
if (options) {
|
package/lib/server.js
CHANGED
|
@@ -214,6 +214,29 @@ const createMcpServer = () => {
|
|
|
214
214
|
const out = { devices };
|
|
215
215
|
return JSON.stringify(out);
|
|
216
216
|
});
|
|
217
|
+
if (process.env.MOBILEFLEET_ENABLE === "1") {
|
|
218
|
+
tool("mobile_list_fleet_devices", "List Fleet Devices", "List devices available in the remote fleet", {
|
|
219
|
+
noParams
|
|
220
|
+
}, { readOnlyHint: true }, async ({}) => {
|
|
221
|
+
ensureMobilecliAvailable();
|
|
222
|
+
const result = mobilecli.fleetListDevices();
|
|
223
|
+
return result;
|
|
224
|
+
});
|
|
225
|
+
tool("mobile_allocate_fleet_device", "Allocate Fleet Device", "Reserve a device from the remote fleet", {
|
|
226
|
+
platform: zod_1.z.enum(["ios", "android"]).describe("The platform to allocate a device for"),
|
|
227
|
+
}, { destructiveHint: true }, async ({ platform }) => {
|
|
228
|
+
ensureMobilecliAvailable();
|
|
229
|
+
const result = mobilecli.fleetAllocate(platform);
|
|
230
|
+
return result;
|
|
231
|
+
});
|
|
232
|
+
tool("mobile_release_fleet_device", "Release Fleet Device", "Release a device back to the remote fleet", {
|
|
233
|
+
device: zod_1.z.string().describe("The device identifier to release back to the fleet"),
|
|
234
|
+
}, { destructiveHint: true }, async ({ device }) => {
|
|
235
|
+
ensureMobilecliAvailable();
|
|
236
|
+
const result = mobilecli.fleetRelease(device);
|
|
237
|
+
return result;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
217
240
|
tool("mobile_list_apps", "List Apps", "List all the installed apps on the device", {
|
|
218
241
|
device: zod_1.z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you.")
|
|
219
242
|
}, { readOnlyHint: true }, async ({ device }) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilenext/mobile-mcp",
|
|
3
3
|
"mcpName": "io.github.mobile-next/mobile-mcp",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.44",
|
|
5
5
|
"description": "Mobile MCP",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,15 +24,17 @@
|
|
|
24
24
|
"lib"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@modelcontextprotocol/sdk": "1.
|
|
27
|
+
"@modelcontextprotocol/sdk": "1.26.0",
|
|
28
|
+
"ajv": "^8.18.0",
|
|
28
29
|
"commander": "14.0.0",
|
|
29
30
|
"express": "5.1.0",
|
|
30
|
-
"fast-xml-parser": "5.3.
|
|
31
|
+
"fast-xml-parser": "5.3.7",
|
|
32
|
+
"qs": "^6.15.0",
|
|
31
33
|
"zod": "^4.1.13",
|
|
32
34
|
"zod-to-json-schema": "3.25.0"
|
|
33
35
|
},
|
|
34
36
|
"optionalDependencies": {
|
|
35
|
-
"@mobilenext/mobilecli": "0.
|
|
37
|
+
"@mobilenext/mobilecli": "0.1.59"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@eslint/eslintrc": "^3.2.0",
|