@mobilenext/mobile-mcp 0.0.52 → 0.0.54

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/mobilecli.js CHANGED
@@ -77,14 +77,29 @@ class Mobilecli {
77
77
  return "failed " + error.message;
78
78
  }
79
79
  }
80
- fleetListDevices() {
81
- return this.executeCommand(["fleet", "list-devices"]);
80
+ remoteListDevices() {
81
+ return this.executeCommand(["remote", "list-devices"]);
82
82
  }
83
- fleetAllocate(platform) {
84
- return this.executeCommand(["fleet", "allocate", "--platform", platform]);
83
+ remoteAllocate(platform) {
84
+ return this.executeCommand(["remote", "allocate", "--platform", platform]);
85
85
  }
86
- fleetRelease(deviceId) {
87
- return this.executeCommand(["fleet", "release", "--device", deviceId]);
86
+ remoteRelease(deviceId) {
87
+ return this.executeCommand(["remote", "release", "--device", deviceId]);
88
+ }
89
+ crashesList(deviceId) {
90
+ const output = this.executeCommand(["device", "crashes", "list", "--device", deviceId]);
91
+ return JSON.parse(output);
92
+ }
93
+ crashesGet(deviceId, id) {
94
+ const output = this.executeCommandBuffer(["device", "crashes", "get", id, "--device", deviceId]);
95
+ return JSON.parse(output.toString().trim());
96
+ }
97
+ agentStatus(deviceId) {
98
+ const output = this.executeCommand(["agent", "status", "--device", deviceId]);
99
+ return JSON.parse(output);
100
+ }
101
+ agentInstall(deviceId) {
102
+ this.executeCommand(["agent", "install", "--device", deviceId]);
88
103
  }
89
104
  getDevices(options) {
90
105
  const args = ["devices"];
package/lib/server.js CHANGED
@@ -91,6 +91,7 @@ const createMcpServer = () => {
91
91
  Product: "mobile-mcp",
92
92
  Version: (0, exports.getAgentVersion)(),
93
93
  NodeVersion: process.version,
94
+ CI: process.env.CI || "0",
94
95
  };
95
96
  const clientName = getClientName();
96
97
  if (clientName !== "unknown") {
@@ -118,6 +119,7 @@ const createMcpServer = () => {
118
119
  };
119
120
  const mobilecli = new mobilecli_1.Mobilecli();
120
121
  const activeRecordings = new Map();
122
+ const agentVerifiedSimulators = new Set();
121
123
  posthog("launch", {}).then();
122
124
  const ensureMobilecliAvailable = () => {
123
125
  try {
@@ -156,6 +158,13 @@ const createMcpServer = () => {
156
158
  if (response.status === "ok" && response.data && response.data.devices) {
157
159
  for (const device of response.data.devices) {
158
160
  if (device.id === deviceId) {
161
+ if (!agentVerifiedSimulators.has(deviceId)) {
162
+ const agentStatus = mobilecli.agentStatus(deviceId);
163
+ if (agentStatus.status === "fail") {
164
+ mobilecli.agentInstall(deviceId);
165
+ }
166
+ agentVerifiedSimulators.add(deviceId);
167
+ }
159
168
  return new mobile_device_1.MobileDevice(deviceId);
160
169
  }
161
170
  }
@@ -219,23 +228,23 @@ const createMcpServer = () => {
219
228
  return JSON.stringify(out);
220
229
  });
221
230
  if (process.env.MOBILEFLEET_ENABLE === "1") {
222
- tool("mobile_list_fleet_devices", "List Fleet Devices", "List devices available in the remote fleet", {}, { readOnlyHint: true }, async ({}) => {
231
+ tool("mobile_list_remote_devices", "List Remote Devices", "List devices available in the remote fleet", {}, { readOnlyHint: true }, async ({}) => {
223
232
  ensureMobilecliAvailable();
224
- const result = mobilecli.fleetListDevices();
233
+ const result = mobilecli.remoteListDevices();
225
234
  return result;
226
235
  });
227
- tool("mobile_allocate_fleet_device", "Allocate Fleet Device", "Reserve a device from the remote fleet", {
236
+ tool("mobile_allocate_remote_device", "Allocate Remote Device", "Reserve a device from the remote fleet", {
228
237
  platform: zod_1.z.enum(["ios", "android"]).describe("The platform to allocate a device for"),
229
238
  }, { destructiveHint: true }, async ({ platform }) => {
230
239
  ensureMobilecliAvailable();
231
- const result = mobilecli.fleetAllocate(platform);
240
+ const result = mobilecli.remoteAllocate(platform);
232
241
  return result;
233
242
  });
234
- tool("mobile_release_fleet_device", "Release Fleet Device", "Release a device back to the remote fleet", {
235
- device: zod_1.z.string().describe("The device identifier to release back to the fleet"),
243
+ tool("mobile_release_remote_device", "Release Remote Device", "Release a device back to the remote fleet", {
244
+ device: zod_1.z.string().describe("The device identifier to release back to the remote fleet"),
236
245
  }, { destructiveHint: true }, async ({ device }) => {
237
246
  ensureMobilecliAvailable();
238
- const result = mobilecli.fleetRelease(device);
247
+ const result = mobilecli.remoteRelease(device);
239
248
  return result;
240
249
  });
241
250
  }
@@ -532,6 +541,21 @@ const createMcpServer = () => {
532
541
  const fileSizeMB = (stats.size / (1024 * 1024)).toFixed(2);
533
542
  return `Recording stopped. File: ${outputPath} (${fileSizeMB} MB, ~${durationSeconds}s)`;
534
543
  });
544
+ tool("mobile_list_crashes", "List Crash Reports", "List crash reports available on the device", {
545
+ device: zod_1.z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
546
+ }, { readOnlyHint: true }, async ({ device }) => {
547
+ ensureMobilecliAvailable();
548
+ const response = mobilecli.crashesList(device);
549
+ return JSON.stringify(response.data);
550
+ });
551
+ tool("mobile_get_crash", "Get Crash Report", "Get the full content of a crash report by its ID. Use mobile_list_crashes to find available crash IDs.", {
552
+ device: zod_1.z.string().describe("The device identifier to use. Use mobile_list_available_devices to find which devices are available to you."),
553
+ id: zod_1.z.string().describe("The crash report ID to retrieve"),
554
+ }, { readOnlyHint: true }, async ({ device, id }) => {
555
+ ensureMobilecliAvailable();
556
+ const response = mobilecli.crashesGet(device, id);
557
+ return response.data.content;
558
+ });
535
559
  return server;
536
560
  };
537
561
  exports.createMcpServer = createMcpServer;
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.52",
4
+ "version": "0.0.54",
5
5
  "description": "Mobile MCP",
6
6
  "repository": {
7
7
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "zod-to-json-schema": "3.25.0"
35
35
  },
36
36
  "optionalDependencies": {
37
- "mobilecli": "0.2.0"
37
+ "mobilecli": "0.3.70"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@eslint/eslintrc": "^3.2.0",