@mobilenext/mobile-mcp 1.0.9 → 1.0.10
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/mobile-device.js +3 -2
- package/lib/server.js +12 -0
- package/lib/webdriver-agent.js +1 -1
- package/package.json +2 -2
package/lib/mobile-device.js
CHANGED
|
@@ -175,10 +175,11 @@ class MobileDevice {
|
|
|
175
175
|
await this.doubleTap(x + width / 2, y + height / 2);
|
|
176
176
|
}
|
|
177
177
|
async longPress(x, y, duration) {
|
|
178
|
-
|
|
178
|
+
// mobilecli rejects fractional coordinates and durations, both are parsed as integers
|
|
179
|
+
this.runCommand(["io", "longpress", `${Math.round(x)},${Math.round(y)}`, "--duration", `${Math.round(duration)}`]);
|
|
179
180
|
}
|
|
180
181
|
async longPressByRef(ref, duration) {
|
|
181
|
-
this.runCommand(["io", "longpress", ref, "--duration", `${duration}`]);
|
|
182
|
+
this.runCommand(["io", "longpress", ref, "--duration", `${Math.round(duration)}`]);
|
|
182
183
|
}
|
|
183
184
|
async getElementsOnScreen() {
|
|
184
185
|
const response = this.runJsonCommand(["dump", "ui"]);
|
package/lib/server.js
CHANGED
|
@@ -124,6 +124,7 @@ const createMcpServer = () => {
|
|
|
124
124
|
if (error instanceof robot_1.ActionableError) {
|
|
125
125
|
return {
|
|
126
126
|
content: [{ type: "text", text: `${error.message}. Please fix the issue and try again.` }],
|
|
127
|
+
isError: true,
|
|
127
128
|
};
|
|
128
129
|
}
|
|
129
130
|
else {
|
|
@@ -257,6 +258,17 @@ const createMcpServer = () => {
|
|
|
257
258
|
}
|
|
258
259
|
throw new robot_1.ActionableError(`Device "${deviceId}" not found. Use the mobile_list_available_devices tool to see available devices.`);
|
|
259
260
|
};
|
|
261
|
+
// ponytail: same tool as @posthog/mcp's reportMissing, without pulling in the sdk
|
|
262
|
+
// nothing to report to when telemetry is off, so don't advertise the tool at all
|
|
263
|
+
if (!process.env.MOBILEMCP_DISABLE_TELEMETRY) {
|
|
264
|
+
tool("get_more_tools", "Get More Tools", "Check for additional tools whenever your task might benefit from specialized capabilities - even if existing tools could work as a fallback. " +
|
|
265
|
+
"The context is sent to the mobile-mcp developers, so never include PII, secrets, credentials or other private information in it.", {
|
|
266
|
+
context: zod_1.z.string().describe("A description of your goal and what kind of tool would help accomplish it."),
|
|
267
|
+
}, { readOnlyHint: true, openWorldHint: true }, async ({ context }) => {
|
|
268
|
+
posthog("$mcp_missing_capability", { "$mcp_intent": context }).then();
|
|
269
|
+
return "Unfortunately, we have shown you the full tool list. We have noted your feedback and will work to improve the tool list in the future.";
|
|
270
|
+
});
|
|
271
|
+
}
|
|
260
272
|
tool("mobile_list_available_devices", "List Devices", "List all available devices. This includes both physical mobile devices and mobile simulators and emulators. It returns both Android and iOS devices. " +
|
|
261
273
|
"These are local devices already connected to this machine, ready to use immediately at no cost - for devices from the shared remote cloud fleet, use mobile_list_remote_devices instead.", {}, { readOnlyHint: true, openWorldHint: false }, async ({}, telemetry) => {
|
|
262
274
|
// from today onward, we must have mobilecli working
|
package/lib/webdriver-agent.js
CHANGED
|
@@ -231,7 +231,7 @@ class WebDriverAgent {
|
|
|
231
231
|
return output;
|
|
232
232
|
}
|
|
233
233
|
async getPageSource() {
|
|
234
|
-
const url = `http://${this.host}:${this.port}/source
|
|
234
|
+
const url = `http://${this.host}:${this.port}/source?format=json`;
|
|
235
235
|
const response = await fetch(url);
|
|
236
236
|
const json = await response.json();
|
|
237
237
|
return json;
|
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": "1.0.
|
|
4
|
+
"version": "1.0.10",
|
|
5
5
|
"description": "Mobile MCP",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"commander": "14.0.0",
|
|
33
33
|
"express": "5.1.0",
|
|
34
34
|
"fast-xml-parser": "5.8.0",
|
|
35
|
-
"mobilewright": "0.0.
|
|
35
|
+
"mobilewright": "0.0.65",
|
|
36
36
|
"qs": "^6.15.0",
|
|
37
37
|
"zod": "^4.2.0",
|
|
38
38
|
"zod-to-json-schema": "3.25.0"
|