Skip to content

Commit 62c9ff4

Browse files
authored
feat: support remote devices (#273)
1 parent 50fb549 commit 62c9ff4

4 files changed

Lines changed: 64 additions & 5 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"zod-to-json-schema": "3.25.0"
3535
},
3636
"optionalDependencies": {
37-
"@mobilenext/mobilecli": "0.0.54"
37+
"@mobilenext/mobilecli": "0.1.59"
3838
},
3939
"devDependencies": {
4040
"@eslint/eslintrc": "^3.2.0",

src/mobilecli.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,18 @@ export class Mobilecli {
104104
}
105105
}
106106

107+
fleetListDevices(): string {
108+
return this.executeCommand(["fleet", "list-devices"]);
109+
}
110+
111+
fleetAllocate(platform: "ios" | "android"): string {
112+
return this.executeCommand(["fleet", "allocate", "--platform", platform]);
113+
}
114+
115+
fleetRelease(deviceId: string): string {
116+
return this.executeCommand(["fleet", "release", "--device", deviceId]);
117+
}
118+
107119
getDevices(options?: MobilecliDevicesOptions): MobilecliDevicesResponse {
108120
const args = ["devices"];
109121

src/server.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,53 @@ export const createMcpServer = (): McpServer => {
256256
);
257257

258258

259+
if (process.env.MOBILEFLEET_ENABLE === "1") {
260+
tool(
261+
"mobile_list_fleet_devices",
262+
"List Fleet Devices",
263+
"List devices available in the remote fleet",
264+
{
265+
noParams
266+
},
267+
{ readOnlyHint: true },
268+
async ({}) => {
269+
ensureMobilecliAvailable();
270+
const result = mobilecli.fleetListDevices();
271+
return result;
272+
}
273+
);
274+
275+
tool(
276+
"mobile_allocate_fleet_device",
277+
"Allocate Fleet Device",
278+
"Reserve a device from the remote fleet",
279+
{
280+
platform: z.enum(["ios", "android"]).describe("The platform to allocate a device for"),
281+
},
282+
{ destructiveHint: true },
283+
async ({ platform }) => {
284+
ensureMobilecliAvailable();
285+
const result = mobilecli.fleetAllocate(platform);
286+
return result;
287+
}
288+
);
289+
290+
tool(
291+
"mobile_release_fleet_device",
292+
"Release Fleet Device",
293+
"Release a device back to the remote fleet",
294+
{
295+
device: z.string().describe("The device identifier to release back to the fleet"),
296+
},
297+
{ destructiveHint: true },
298+
async ({ device }) => {
299+
ensureMobilecliAvailable();
300+
const result = mobilecli.fleetRelease(device);
301+
return result;
302+
}
303+
);
304+
}
305+
259306
tool(
260307
"mobile_list_apps",
261308
"List Apps",

0 commit comments

Comments
 (0)