mobai-mcp 1.5.0 → 2.1.0
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 +70 -106
- package/dist/index.d.ts +3 -3
- package/dist/index.js +198 -1515
- package/dist/resources.d.ts +7 -0
- package/dist/resources.js +509 -0
- package/package.json +1 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -3,24 +3,27 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/mobai-mcp)
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
5
|
|
|
6
|
-
MCP (Model Context Protocol) server for [MobAI](https://mobai.run)
|
|
6
|
+
MCP (Model Context Protocol) server for [MobAI](https://mobai.run) — AI-powered mobile device automation. Lets AI assistants (Claude Code, Cursor, Windsurf, Cline, and other MCP-compatible tools) control Android and iOS devices, emulators, and simulators via a single DSL-first interface.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## How it works
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- **DSL Batch Execution**: Execute multiple automation steps efficiently
|
|
14
|
-
- **AI Agent**: Run autonomous agents to complete complex tasks
|
|
15
|
-
- **Screenshot Capture**: Capture and save device screenshots
|
|
10
|
+
All device interaction is batched through one primary tool: **`execute_dsl`**. Instead of exposing dozens of fine-grained tools (tap, swipe, type…), the server accepts a JSON script describing a sequence of actions with predicates, assertions, waits, and conditional branches. This keeps round-trips low and encodes retry/failure strategies server-side.
|
|
11
|
+
|
|
12
|
+
A small set of companion tools handles device discovery, screenshots, app management, and running `.mob` test files.
|
|
16
13
|
|
|
17
14
|
## Prerequisites
|
|
18
15
|
|
|
19
16
|
- Node.js 18+
|
|
20
|
-
- [MobAI desktop app](https://mobai.run) running locally (
|
|
21
|
-
-
|
|
17
|
+
- [MobAI desktop app](https://mobai.run) running locally (HTTP API on `127.0.0.1:8686`)
|
|
18
|
+
- A connected Android or iOS device, emulator, or simulator
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
### Claude Code
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
```bash
|
|
25
|
+
claude mcp add mobai -- npx -y mobai-mcp
|
|
26
|
+
```
|
|
24
27
|
|
|
25
28
|
### Cursor
|
|
26
29
|
|
|
@@ -39,7 +42,7 @@ Add to `.cursor/mcp.json`:
|
|
|
39
42
|
|
|
40
43
|
### Claude Desktop
|
|
41
44
|
|
|
42
|
-
Add to
|
|
45
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS):
|
|
43
46
|
|
|
44
47
|
```json
|
|
45
48
|
{
|
|
@@ -52,146 +55,107 @@ Add to Claude Desktop config (`~/Library/Application Support/Claude/claude_deskt
|
|
|
52
55
|
}
|
|
53
56
|
```
|
|
54
57
|
|
|
55
|
-
### Windsurf
|
|
58
|
+
### Windsurf / Cline / other MCP clients
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
The server speaks stdio — use your client's generic MCP configuration:
|
|
58
61
|
|
|
59
62
|
```json
|
|
60
63
|
{
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
"command": "npx",
|
|
64
|
-
"args": ["-y", "mobai-mcp"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["-y", "mobai-mcp"]
|
|
67
66
|
}
|
|
68
67
|
```
|
|
69
68
|
|
|
70
|
-
|
|
69
|
+
## Tools
|
|
71
70
|
|
|
72
|
-
|
|
71
|
+
### Device management
|
|
73
72
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
| Tool | Description |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `list_devices` | List all connected Android and iOS devices |
|
|
76
|
+
| `get_device` | Get details about a specific device |
|
|
77
|
+
| `start_bridge` | Start the automation bridge on a device (required before interaction) |
|
|
78
|
+
| `stop_bridge` | Stop the automation bridge |
|
|
80
79
|
|
|
81
|
-
|
|
80
|
+
### Screenshots
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- `stop_bridge` - Stop automation bridge
|
|
82
|
+
| Tool | Description |
|
|
83
|
+
|---|---|
|
|
84
|
+
| `get_screenshot` | Fast, low-quality screenshot for LLM visual analysis (may be downscaled; response includes scale factor) |
|
|
85
|
+
| `save_screenshot` | Full-quality PNG to disk for reporting, debugging, or sharing |
|
|
88
86
|
|
|
89
|
-
###
|
|
90
|
-
- `get_screenshot` - Capture device screenshot
|
|
91
|
-
- `get_ui_tree` - Get accessibility tree (supports text_regex and bounds filtering)
|
|
92
|
-
- `tap` - Tap element by index or coordinates
|
|
93
|
-
- `type_text` - Type text
|
|
94
|
-
- `swipe` - Perform swipe gesture
|
|
95
|
-
- `go_home` - Navigate to home screen
|
|
96
|
-
- `launch_app` - Launch app by bundle ID
|
|
97
|
-
- `list_apps` - List installed apps
|
|
87
|
+
### Apps
|
|
98
88
|
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
| Tool | Description |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `list_apps` | List installed apps on the device |
|
|
92
|
+
| `install_app` | Install an `.apk` or `.ipa` from a local file path |
|
|
93
|
+
| `uninstall_app` | Uninstall an app by bundle ID / package name |
|
|
94
|
+
| `debug_app` | Launch an app in debug mode and write stdout/stderr to a log file |
|
|
101
95
|
|
|
102
|
-
###
|
|
103
|
-
- `run_agent` - Run autonomous agent for complex tasks
|
|
96
|
+
### Automation
|
|
104
97
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `web_get_dom` - Get DOM tree
|
|
109
|
-
- `web_click` - Click element by CSS selector
|
|
110
|
-
- `web_type` - Type into element by CSS selector
|
|
111
|
-
- `web_execute_js` - Execute JavaScript
|
|
98
|
+
| Tool | Description |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `execute_dsl` | **Primary tool.** Execute a batch of DSL steps: tap, type, swipe, observe, assertions, web automation, metrics, screen recording, and more. |
|
|
112
101
|
|
|
113
|
-
###
|
|
114
|
-
- `http_request` - Make raw HTTP request to MobAI API
|
|
102
|
+
### Test management
|
|
115
103
|
|
|
116
|
-
|
|
104
|
+
Tests are `.mob` files on disk inside project directories. You read, write, and edit them directly using your assistant's filesystem tools — MobAI watches for changes and updates the UI live. MCP is only needed to discover projects and run tests.
|
|
117
105
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
106
|
+
| Tool | Description |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `test_get_active` | Get the active test project directory and its `.mob` cases |
|
|
109
|
+
| `test_list_projects` | List all known test project directories with their `.mob` cases |
|
|
110
|
+
| `test_run` | Run a `.mob` test case on a device (`project_dir` + `case_path` + `device_id`) |
|
|
122
111
|
|
|
123
|
-
##
|
|
112
|
+
## Resources
|
|
124
113
|
|
|
125
|
-
|
|
114
|
+
Read these **before** attempting any device interaction — they describe the DSL schema, action set, predicates, failure strategies, and `.mob` syntax.
|
|
126
115
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
| URI | Purpose |
|
|
117
|
+
|---|---|
|
|
118
|
+
| `mobai://reference/device-automation` | How to control devices — guide, all DSL actions, predicates, and failure strategies |
|
|
119
|
+
| `mobai://reference/testing` | Testing workflow, rules, error fixes, and `.mob` script syntax |
|
|
131
120
|
|
|
132
|
-
|
|
121
|
+
## Example
|
|
133
122
|
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
Open the iOS Settings app, navigate to Wi-Fi, and verify the toggle exists:
|
|
124
|
+
|
|
125
|
+
```json
|
|
136
126
|
{
|
|
137
127
|
"version": "0.2",
|
|
138
128
|
"steps": [
|
|
139
129
|
{"action": "open_app", "bundle_id": "com.apple.Preferences"},
|
|
140
|
-
{"action": "
|
|
141
|
-
{"action": "
|
|
142
|
-
{"action": "
|
|
130
|
+
{"action": "wait_for", "predicate": {"text": "Settings"}, "timeout_ms": 3000},
|
|
131
|
+
{"action": "tap", "predicate": {"text_contains": "Wi-Fi"}},
|
|
132
|
+
{"action": "wait_for", "predicate": {"type": "switch"}, "timeout_ms": 3000},
|
|
133
|
+
{"action": "assert_exists", "predicate": {"type": "switch"}},
|
|
134
|
+
{"action": "observe", "include": ["ui_tree"]}
|
|
143
135
|
]
|
|
144
136
|
}
|
|
145
137
|
```
|
|
146
138
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
```
|
|
150
|
-
Use run_agent with device_id and task: "Open Settings and enable WiFi"
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Comparison with Claude Code Plugin
|
|
154
|
-
|
|
155
|
-
| Feature | Claude Code Plugin | MCP Server |
|
|
156
|
-
|---------|-------------------|------------|
|
|
157
|
-
| Platform | Claude Code only | Any MCP client |
|
|
158
|
-
| Tools | http_request (generic) | Named tools + http_request |
|
|
159
|
-
| Resources | Skills (markdown) | MCP resources |
|
|
160
|
-
| Setup | Plugin install | npx |
|
|
161
|
-
|
|
162
|
-
The MCP server provides the same functionality as the Claude Code plugin but works with any MCP-compatible AI tool.
|
|
139
|
+
Pass this as the `commands` argument (a JSON string) to `execute_dsl` along with a `device_id` from `list_devices`.
|
|
163
140
|
|
|
164
141
|
## Troubleshooting
|
|
165
142
|
|
|
166
|
-
|
|
167
|
-
- Ensure MobAI desktop app is running
|
|
168
|
-
- Check that API is available at http://127.0.0.1:8686
|
|
143
|
+
**"Connection refused"** — Make sure the MobAI desktop app is running and the API is reachable at `http://127.0.0.1:8686`.
|
|
169
144
|
|
|
170
|
-
|
|
171
|
-
- Use `start_bridge` tool first before automation
|
|
172
|
-
- iOS bridge may take up to 60 seconds to start
|
|
145
|
+
**"Bridge not running"** — Call `start_bridge` first. The iOS bridge can take up to a minute to come up.
|
|
173
146
|
|
|
174
|
-
|
|
175
|
-
- Screenshots are saved to `/tmp/mobai/screenshots/`
|
|
176
|
-
- Use your AI tool's file reading capability to view them
|
|
147
|
+
**Screenshots not visible** — `get_screenshot` saves to `/tmp/mobai/screenshots/` by default and returns the file path. Use your assistant's file-reading capability to view them. DSL `observe` screenshots are extracted from the response and saved to the same directory.
|
|
177
148
|
|
|
178
149
|
## Development
|
|
179
150
|
|
|
180
151
|
```bash
|
|
181
|
-
# Clone the repository
|
|
182
152
|
git clone https://github.com/MobAI-App/mobai-mcp.git
|
|
183
153
|
cd mobai-mcp
|
|
184
|
-
|
|
185
|
-
# Install dependencies
|
|
186
154
|
npm install
|
|
187
|
-
|
|
188
|
-
# Build
|
|
189
155
|
npm run build
|
|
190
|
-
|
|
191
|
-
# Run locally
|
|
192
156
|
node dist/index.js
|
|
193
157
|
```
|
|
194
158
|
|
|
195
159
|
## License
|
|
196
160
|
|
|
197
|
-
Apache 2.0
|
|
161
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* MobAI MCP Server
|
|
3
|
+
* MobAI MCP Server (stdio)
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Mirrors the Go HTTP-based MCP server as a stdio transport.
|
|
6
|
+
* Proxies tool calls to the MobAI HTTP API at 127.0.0.1:8686.
|
|
7
7
|
*/
|
|
8
8
|
export {};
|