@mobilenext/mobile-mcp 0.0.24 → 0.0.25
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/README.md +21 -19
- package/lib/android.js +12 -4
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
# Mobile Next - MCP server for Mobile Development and Automation
|
|
1
|
+
# Mobile Next - MCP server for Mobile Development and Automation | iOS, Android, Simulator, Emulator, and Real Devices
|
|
2
2
|
|
|
3
|
-
This is a [Model Context Protocol (MCP) server](https://github.com/modelcontextprotocol) that enables scalable mobile automation, development through a platform-agnostic interface, eliminating the need for distinct iOS or Android knowledge. You can run it on emulators, simulators, and
|
|
3
|
+
This is a [Model Context Protocol (MCP) server](https://github.com/modelcontextprotocol) that enables scalable mobile automation, development through a platform-agnostic interface, eliminating the need for distinct iOS or Android knowledge. You can run it on emulators, simulators, and real devices (iOS and Android).
|
|
4
4
|
This server allows Agents and LLMs to interact with native iOS/Android applications and devices through structured accessibility snapshots or coordinate-based taps based on screenshots.
|
|
5
5
|
|
|
6
6
|
<h4 align="center">
|
|
7
|
-
<a href="https://github.com/mobile-next/mobile-mcp">
|
|
7
|
+
<a href="https://github.com/mobile-next/mobile-mcp">
|
|
8
8
|
<img src="https://img.shields.io/github/stars/mobile-next/mobile-mcp" alt="Mobile Next Stars" />
|
|
9
9
|
</a>
|
|
10
|
-
|
|
10
|
+
<a href="https://github.com/mobile-next/mobile-mcp">
|
|
11
11
|
<img src="https://img.shields.io/github/contributors/mobile-next/mobile-mcp?color=green" alt="Mobile Next Downloads" />
|
|
12
12
|
</a>
|
|
13
13
|
<a href="https://www.npmjs.com/package/@mobilenext/mobile-mcp">
|
|
14
|
-
<img src="https://img.shields.io/npm/dm/@mobilenext/mobile-mcp?logo=npm&style=flat&color=red" alt="npm"
|
|
14
|
+
<img src="https://img.shields.io/npm/dm/@mobilenext/mobile-mcp?logo=npm&style=flat&color=red" alt="npm" />
|
|
15
15
|
</a>
|
|
16
|
-
<a href="https://github.com/mobile-next/mobile-mcp/releases">
|
|
17
|
-
<img src="https://img.shields.io/github/release/mobile-next/mobile-mcp"
|
|
16
|
+
<a href="https://github.com/mobile-next/mobile-mcp/releases">
|
|
17
|
+
<img src="https://img.shields.io/github/release/mobile-next/mobile-mcp" />
|
|
18
18
|
</a>
|
|
19
|
-
<a href="https://github.com/mobile-next/mobile-mcp/blob/main/LICENSE">
|
|
20
|
-
<img src="https://img.shields.io/badge/license-Apache 2.0-blue.svg" alt="Mobile MCP is released under the Apache-2.0 License"
|
|
19
|
+
<a href="https://github.com/mobile-next/mobile-mcp/blob/main/LICENSE">
|
|
20
|
+
<img src="https://img.shields.io/badge/license-Apache 2.0-blue.svg" alt="Mobile MCP is released under the Apache-2.0 License" />
|
|
21
21
|
</a>
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
<a href="https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22mobile-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40mobilenext%2Fmobile-mcp%40latest%22%5D%7D">
|
|
23
|
+
<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code" />
|
|
24
|
+
</a>
|
|
25
|
+
</h4>
|
|
24
26
|
|
|
25
27
|
<h4 align="center">
|
|
26
|
-
<a href="http://mobilenexthq.com/join-slack">
|
|
28
|
+
<a href="http://mobilenexthq.com/join-slack">
|
|
27
29
|
<img src="https://img.shields.io/badge/join-Slack-blueviolet?logo=slack&style=flat" alt="Slack community channel" />
|
|
28
|
-
</a>
|
|
29
|
-
</
|
|
30
|
+
</a>
|
|
31
|
+
</h4>
|
|
30
32
|
|
|
31
33
|
https://github.com/user-attachments/assets/c4e89c4f-cc71-4424-8184-bdbc8c638fa1
|
|
32
34
|
|
|
33
35
|
<p align="center">
|
|
34
36
|
<a href="https://github.com/mobile-next/">
|
|
35
|
-
<img alt="mobile-mcp" src="https://raw.githubusercontent.com/mobile-next/mobile-next-assets/refs/heads/main/mobile-mcp-banner.png" width="600"
|
|
37
|
+
<img alt="mobile-mcp" src="https://raw.githubusercontent.com/mobile-next/mobile-next-assets/refs/heads/main/mobile-mcp-banner.png" width="600" />
|
|
36
38
|
</a>
|
|
37
39
|
</p>
|
|
38
40
|
|
|
@@ -49,7 +51,7 @@ Check out our detailed roadmap to see upcoming features, improvements, and miles
|
|
|
49
51
|
How we help to scale mobile automation:
|
|
50
52
|
|
|
51
53
|
- 📲 Native app automation (iOS and Android) for testing or data-entry scenarios.
|
|
52
|
-
- 📝 Scripted flows and form interactions without manually controlling simulators/emulators or
|
|
54
|
+
- 📝 Scripted flows and form interactions without manually controlling simulators/emulators or real devices (iPhone, Samsung, Google Pixel etc)
|
|
53
55
|
- 🧭 Automating multi-step user journeys driven by an LLM
|
|
54
56
|
- 👆 General-purpose mobile application interaction for agent-based frameworks
|
|
55
57
|
- 🤖 Enables agent-to-agent communication for mobile automation usecases, data extraction
|
|
@@ -178,18 +180,18 @@ What you will need to connect MCP with your agent and mobile devices:
|
|
|
178
180
|
- [node.js](https://nodejs.org/en/download/) v22+
|
|
179
181
|
- [MCP](https://modelcontextprotocol.io/introduction) supported foundational models or agents, like [Claude MCP](https://modelcontextprotocol.io/quickstart/server), [OpenAI Agent SDK](https://openai.github.io/openai-agents-python/mcp/), [Copilot Studio](https://www.microsoft.com/en-us/microsoft-copilot/blog/copilot-studio/introducing-model-context-protocol-mcp-in-copilot-studio-simplified-integration-with-ai-apps-and-agents/)
|
|
180
182
|
|
|
181
|
-
### Simulators, Emulators, and
|
|
183
|
+
### Simulators, Emulators, and Real Devices
|
|
182
184
|
|
|
183
185
|
When launched, Mobile MCP can connect to:
|
|
184
186
|
- iOS Simulators on macOS/Linux
|
|
185
187
|
- Android Emulators on Linux/Windows/macOS
|
|
186
|
-
-
|
|
188
|
+
- iOS or Android real devices (requires proper platform tools and drivers)
|
|
187
189
|
|
|
188
190
|
Make sure you have your mobile platform SDKs (Xcode, Android SDK) installed and configured properly before running Mobile Next Mobile MCP.
|
|
189
191
|
|
|
190
192
|
### Running in "headless" mode on Simulators/Emulators
|
|
191
193
|
|
|
192
|
-
When you do not have a
|
|
194
|
+
When you do not have a real device connected to your machine, you can run Mobile MCP with an emulator or simulator in the background.
|
|
193
195
|
|
|
194
196
|
For example, on Android:
|
|
195
197
|
1. Start an emulator (avdmanager / emulator command).
|
package/lib/android.js
CHANGED
|
@@ -39,14 +39,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.AndroidDeviceManager = exports.AndroidRobot = void 0;
|
|
40
40
|
const node_path_1 = __importDefault(require("node:path"));
|
|
41
41
|
const node_child_process_1 = require("node:child_process");
|
|
42
|
+
const node_fs_1 = require("node:fs");
|
|
42
43
|
const xml = __importStar(require("fast-xml-parser"));
|
|
43
44
|
const robot_1 = require("./robot");
|
|
44
45
|
const getAdbPath = () => {
|
|
45
|
-
let executable = "adb";
|
|
46
46
|
if (process.env.ANDROID_HOME) {
|
|
47
|
-
|
|
47
|
+
return node_path_1.default.join(process.env.ANDROID_HOME, "platform-tools", "adb");
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
const defaultAndroidSdk = node_path_1.default.join(process.env.HOME || "", "Library", "Android", "sdk", "platform-tools", "adb");
|
|
50
|
+
if ((0, node_fs_1.existsSync)(defaultAndroidSdk)) {
|
|
51
|
+
return defaultAndroidSdk;
|
|
52
|
+
}
|
|
53
|
+
return "adb";
|
|
50
54
|
};
|
|
51
55
|
const BUTTON_MAP = {
|
|
52
56
|
"BACK": "KEYCODE_BACK",
|
|
@@ -275,6 +279,10 @@ class AndroidRobot {
|
|
|
275
279
|
isAscii(text) {
|
|
276
280
|
return /^[\x00-\x7F]*$/.test(text);
|
|
277
281
|
}
|
|
282
|
+
escapeShellText(text) {
|
|
283
|
+
// escape all shell special characters that could be used for injection
|
|
284
|
+
return text.replace(/[\\'"` \t\n\r|&;()<>{}[\]$*?]/g, "\\$&");
|
|
285
|
+
}
|
|
278
286
|
async isDeviceKitInstalled() {
|
|
279
287
|
const packages = await this.listPackages();
|
|
280
288
|
return packages.includes("com.mobilenext.devicekit");
|
|
@@ -288,7 +296,7 @@ class AndroidRobot {
|
|
|
288
296
|
if (this.isAscii(text)) {
|
|
289
297
|
// adb shell input only supports ascii characters. and
|
|
290
298
|
// some of the keys have to be escaped.
|
|
291
|
-
const _text =
|
|
299
|
+
const _text = this.escapeShellText(text);
|
|
292
300
|
this.adb("shell", "input", "text", _text);
|
|
293
301
|
}
|
|
294
302
|
else if (await this.isDeviceKitInstalled()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mobilenext/mobile-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "Mobile MCP",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc && chmod +x lib/index.js",
|
|
15
15
|
"lint": "eslint .",
|
|
16
|
+
"fixlint": "eslint . --fix",
|
|
16
17
|
"test": "nyc mocha --require ts-node/register test/*.ts",
|
|
17
18
|
"watch": "tsc --watch",
|
|
18
19
|
"clean": "rm -rf lib",
|