mobile-debug-mcp 0.12.2 → 0.12.4

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/docs/TOOLS.md DELETED
@@ -1,272 +0,0 @@
1
- # Tools
2
-
3
- This document contains detailed definitions for each MCP tool implemented by Mobile Debug MCP. These were extracted from the README to keep the top-level README concise.
4
-
5
- Each tool returns a JSON metadata block and, where applicable, additional content blocks (e.g., image data or raw logs). Where an example previously used `jsonc` fences with inline comments, the examples below use `json` fences and external explanatory notes to avoid highlighting issues.
6
-
7
- ---
8
-
9
- ## list_devices
10
- Enumerate connected Android devices and iOS simulators.
11
-
12
- Input (optional):
13
- ```json
14
- { "platform": "android" | "ios" }
15
- ```
16
-
17
- Response:
18
- ```json
19
- { "devices": [ { "id": "emulator-5554", "platform": "android", "osVersion": "11", "model": "sdk_gphone64_arm64", "simulator": true, "appInstalled": false } ] }
20
- ```
21
-
22
- Notes:
23
- - Use `list_devices` to inspect connected targets and their metadata. When multiple devices are attached, pass `deviceId` to other tools to target a specific device.
24
-
25
- ---
26
-
27
- ## install_app
28
- Install an app onto a connected device or simulator (APK for Android, .app/.ipa for iOS).
29
-
30
- Input:
31
- ```json
32
- {
33
- "platform": "android" | "ios",
34
- "appPath": "/path/to/app.apk_or_app.app_or_ipa",
35
- "deviceId": "emulator-5554"
36
- }
37
- ```
38
-
39
- Response:
40
- ```json
41
- {
42
- "device": { /* device info */ },
43
- "installed": true,
44
- "output": "Platform-specific installer output (adb/simctl/idb)",
45
- "error": "Optional error message if installation failed"
46
- }
47
- ```
48
-
49
- Notes:
50
- - Android: the tool attempts to locate and install the APK. If `appPath` points at a project directory, the tool will attempt to run the Gradle wrapper (`./gradlew assembleDebug`) and locate the built APK under `build/outputs/apk/`.
51
- - The installer respects `ADB_PATH` (preferred) falling back to `adb` on PATH. To avoid PATH discovery issues, set `ADB_PATH` to the full adb binary path.
52
- - The default ADB command timeout was increased to 120s to handle larger streamed installs. Configure via `MCP_ADB_TIMEOUT` or `ADB_TIMEOUT` env vars.
53
- - iOS: prefers `xcrun simctl install` for simulators and falls back to `idb install` for devices when available.
54
-
55
- ---
56
-
57
- ## start_app
58
- Launch a mobile app.
59
-
60
- Input:
61
- ```json
62
- {
63
- "platform": "android" | "ios",
64
- "appId": "com.example.app",
65
- "deviceId": "emulator-5554"
66
- }
67
- ```
68
-
69
- Response:
70
- ```json
71
- {
72
- "device": { /* device info */ },
73
- "appStarted": true,
74
- "launchTimeMs": 123
75
- }
76
- ```
77
-
78
- Notes:
79
- - Android: uses `adb shell monkey -p <package> -c android.intent.category.LAUNCHER 1` to trigger a launch.
80
- - iOS: uses `xcrun simctl launch` for simulators or `idb` for devices when available.
81
-
82
- ---
83
-
84
- ## get_logs
85
- Fetch recent logs from the app or device.
86
-
87
- Input:
88
- ```json
89
- {
90
- "platform": "android" | "ios",
91
- "appId": "com.example.app",
92
- "deviceId": "emulator-5554",
93
- "lines": 200
94
- }
95
- ```
96
-
97
- Response:
98
- - The tool returns two content blocks for Android: a JSON metadata block and a plain text log output block. The JSON metadata includes parsed results (counts, crash summaries) and the raw log is provided for inspection.
99
-
100
- Notes:
101
- - Android log parsing is heuristic and includes basic crash detection (searching for "FATAL EXCEPTION" and exception names).
102
- - Use `lines` to control how many log lines are returned from `adb logcat`.
103
-
104
- ---
105
-
106
- ## capture_screenshot
107
- Capture a screenshot of the current device screen.
108
-
109
- Input:
110
- ```json
111
- {
112
- "platform": "android" | "ios",
113
- "deviceId": "emulator-5554"
114
- }
115
- ```
116
-
117
- Response:
118
- - JSON metadata block with resolution and device info, followed by an image/png block containing base64-encoded PNG bytes.
119
-
120
- Notes:
121
- - Android: uses `adb exec-out screencap -p` and returns PNG bytes.
122
- - iOS: uses `xcrun simctl io booted screenshot` or `idb` capture when available.
123
-
124
- ---
125
-
126
- ## terminate_app
127
- Terminate a running app.
128
-
129
- Input:
130
- ```json
131
- {
132
- "platform": "android" | "ios",
133
- "appId": "com.example.app",
134
- "deviceId": "emulator-5554"
135
- }
136
- ```
137
-
138
- Response:
139
- ```json
140
- { "device": { /* device info */ }, "appTerminated": true }
141
- ```
142
-
143
- Notes:
144
- - Android: uses `adb shell am force-stop <package>`.
145
-
146
- ---
147
-
148
- ## restart_app
149
- Restart an app (terminate then launch).
150
-
151
- Input/Response: combination of terminate + start as above. Response includes launch timing metadata.
152
-
153
- ---
154
-
155
- ## reset_app_data
156
- Clear app storage (reset to fresh install state).
157
-
158
- Input:
159
- ```json
160
- {
161
- "platform": "android" | "ios",
162
- "appId": "com.example.app",
163
- "deviceId": "emulator-5554"
164
- }
165
- ```
166
-
167
- Response:
168
- ```json
169
- { "device": { /* device info */ }, "dataCleared": true }
170
- ```
171
-
172
- Notes:
173
- - Android: uses `adb shell pm clear <package>` and returns whether the operation succeeded.
174
-
175
- ---
176
-
177
- ## start_log_stream / read_log_stream / stop_log_stream
178
- Start a live log stream (background) for an Android app and poll the accumulated entries.
179
-
180
- - start_log_stream starts a background `adb logcat` filtered by the app PID and writes parsed NDJSON to a per-session file. Returns immediately with session details.
181
- - read_log_stream retrieves recent parsed entries and includes crash detection metadata.
182
- - stop_log_stream terminates the background process and closes the stream.
183
-
184
- Input (start_log_stream):
185
- ```json
186
- { "packageName": "com.example.app", "level": "error" | "warn" | "info" | "debug", "sessionId": "optional-session-id" }
187
- ```
188
-
189
- Response (read_log_stream):
190
- ```json
191
- { "entries": [ /* parsed entries */ ], "crash_summary": { "crash_detected": true/false, "exception": "..." } }
192
- ```
193
-
194
- Notes:
195
- - The `since` parameter for read_log_stream accepts ISO timestamps or epoch ms. Use it for incremental polling.
196
- - Crash detection is heuristic-based and intended as a quick signal for agents.
197
-
198
- ---
199
-
200
- ## get_ui_tree
201
- Get the current UI hierarchy from the device.
202
-
203
- Input:
204
- ```json
205
- { "platform": "android" | "ios", "deviceId": "emulator-5554" }
206
- ```
207
-
208
- Response:
209
- - Structured JSON containing screen metadata and an array of UI elements with properties: text, contentDescription, type, resourceId, clickable, enabled, visible, bounds, center, depth, parentId, children.
210
-
211
- Notes:
212
- - Android: uses `uiautomator dump` or `adb exec-out uiautomator` fallback methods. Times out on slow responses; use provided timeouts.
213
- - iOS: uses `idb` or accessibility APIs when available.
214
-
215
- ---
216
-
217
- ## get_current_screen
218
- Get the currently visible activity on Android.
219
-
220
- Input:
221
- ```json
222
- { "deviceId": "emulator-5554" }
223
- ```
224
-
225
- Response:
226
- ```json
227
- { "device": { /* device info */ }, "package": "com.example.app", "activity": "com.example.app.LoginActivity", "shortActivity": "LoginActivity" }
228
- ```
229
-
230
- Notes:
231
- - Uses `dumpsys activity activities` and robust parsing to support multiple Android versions.
232
-
233
- ---
234
-
235
- ## wait_for_element
236
- Wait until a UI element with matching text appears on screen or timeout is reached.
237
-
238
- Input:
239
- ```json
240
- { "platform": "android" | "ios", "text": "Home", "timeout": 5000, "deviceId": "emulator-5554" }
241
- ```
242
-
243
- Response:
244
- ```json
245
- { "device": { /* device info */ }, "found": true/false, "element": { /* element */ } }
246
- ```
247
-
248
- Notes:
249
- - Polls get_ui_tree until timeout or element found. Returns an `error` field if system failures occur.
250
-
251
- ---
252
-
253
- ## tap / swipe / type_text / press_back
254
-
255
- - tap: `adb shell input tap x y` (Android) or `idb` events for iOS.
256
- - swipe: `adb shell input swipe x1 y1 x2 y2 duration`.
257
- - type_text: `adb shell input text` (spaces encoded as %s) — may fail for special characters.
258
- - press_back: `adb shell input keyevent 4`.
259
-
260
- Inputs and responses follow the device+success pattern used across other tools.
261
-
262
- ---
263
-
264
- ## Notes on environment and timeout behavior
265
-
266
- - The tools prefer explicit env vars: `ADB_PATH` and `XCRUN_PATH` to locate platform binaries. If unset, tools fall back to PATH lookup.
267
- - For Android builds, the install tool auto-detects a suitable Java 17 installation (Android Studio JBR or system JDK 17). Any JAVA_HOME overrides are scoped to the spawned Gradle process.
268
- - Default ADB timeout is now 120s for long operations; override via `MCP_ADB_TIMEOUT` or `ADB_TIMEOUT`.
269
-
270
- ---
271
-
272
- If you need the tools split into per-tool markdown files (e.g., docs/tools/install.md), say so and I will split them.