mobile-debug-mcp 0.30.1 → 0.31.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.
Files changed (60) hide show
  1. package/README.md +50 -5
  2. package/dist/interact/index.js +546 -133
  3. package/dist/manage/ios.js +1 -1
  4. package/dist/server/tool-definitions.js +13 -9
  5. package/dist/server/tool-handlers.js +4 -4
  6. package/dist/server-core.js +1 -1
  7. package/dist/system/index.js +485 -48
  8. package/dist/system/ios.js +15 -7
  9. package/dist/utils/android/utils.js +4 -4
  10. package/dist/utils/cli/idb/check-idb.js +10 -3
  11. package/dist/utils/cli/idb/idb-helper.js +47 -13
  12. package/dist/utils/ios/utils.js +5 -9
  13. package/docs/CHANGELOG.md +6 -0
  14. package/docs/ROADMAP.md +88 -212
  15. package/docs/specs/baseline-spec-v0.md +1 -1
  16. package/docs/specs-deltas/015-adjustable-control-support.md +541 -0
  17. package/docs/specs-deltas/016-environment-tools.md +533 -0
  18. package/docs/tools/TOOLS.md +2 -0
  19. package/docs/tools/manage.md +4 -2
  20. package/docs/tools/system.md +9 -2
  21. package/package.json +1 -1
  22. package/skills/spec-review/SKILL.md +52 -0
  23. package/skills/spec-review/references/spec-review-checklist.md +13 -0
  24. package/skills/spec-review/references/spec-review-template.md +28 -0
  25. package/src/interact/index.ts +581 -138
  26. package/src/manage/ios.ts +1 -1
  27. package/src/server/tool-definitions.ts +13 -9
  28. package/src/server/tool-handlers.ts +4 -4
  29. package/src/server-core.ts +1 -1
  30. package/src/system/index.ts +572 -50
  31. package/src/system/ios.ts +14 -7
  32. package/src/types.ts +2 -0
  33. package/src/utils/android/utils.ts +3 -3
  34. package/src/utils/cli/idb/check-idb.ts +11 -2
  35. package/src/utils/cli/idb/idb-helper.ts +49 -12
  36. package/src/utils/ios/utils.ts +4 -8
  37. package/test/unit/interact/adjust_control.test.ts +586 -33
  38. package/test/unit/interact/tap_element.test.ts +1 -1
  39. package/test/unit/server/contract.test.ts +4 -0
  40. package/test/unit/system/get_system_status.test.ts +3 -0
  41. package/test/unit/system/system_status.test.ts +40 -0
  42. package/test/unit/utils/idb_health.test.ts +74 -0
  43. package/skills/rfc-review/SKILL.md +0 -52
  44. package/skills/rfc-review/references/rfc-review-checklist.md +0 -12
  45. package/skills/rfc-review/references/rfc-review-template.md +0 -28
  46. /package/docs/{rfcs → specs-deltas}/001-state-verification.md +0 -0
  47. /package/docs/{rfcs → specs-deltas}/002-richer-element-identity +0 -0
  48. /package/docs/{rfcs → specs-deltas}/003-wait-and-synchronization-reliability.md +0 -0
  49. /package/docs/{rfcs → specs-deltas}/004-action-verification-routing.md +0 -0
  50. /package/docs/{rfcs → specs-deltas}/005-unified-action-execution-and-verification-model.md +0 -0
  51. /package/docs/{rfcs → specs-deltas}/006-runtime-action-instrumentation-and-binding-layer.md +0 -0
  52. /package/docs/{rfcs → specs-deltas}/007-actionability-resolution-and-executable-target-selection.md +0 -0
  53. /package/docs/{rfcs → specs-deltas}/008-adjustable-control-support-and-semantic-value-manipulation.md +0 -0
  54. /package/docs/{rfcs → specs-deltas}/009-semantic-control-modeling-for-custom-and-composite-controls.md +0 -0
  55. /package/docs/{rfcs → specs-deltas}/010-verification-stabilization-and-temporal-convergence.md +0 -0
  56. /package/docs/{rfcs → specs-deltas}/011-recovery-and-replanning-for-failed-or-ambiguous-interaction-flows.md +0 -0
  57. /package/docs/{rfcs → specs-deltas}/011.1-recovery-contract-types-and-runtime-wiring-spec.md +0 -0
  58. /package/docs/{rfcs → specs-deltas}/012-action-trace-and-xecution-observability.md +0 -0
  59. /package/docs/{rfcs → specs-deltas}/013-wait-and-synchronization-reliability.md +0 -0
  60. /package/docs/{rfcs → specs-deltas}/014-actionability-resolution.md +0 -0
@@ -0,0 +1,533 @@
1
+
2
+
3
+ # Specification 016 — Environment Auto-Configuration and Toolchain Discovery
4
+
5
+ ## Purpose
6
+
7
+ Enable the Mobile Debug MCP to automatically discover, validate, and configure its required platform toolchains, reducing manual setup while maintaining deterministic behaviour.
8
+
9
+ The MCP should work out of the box on a standard development machine whenever the required tooling is installed, with manual configuration becoming an optional override rather than a prerequisite.
10
+
11
+ ---
12
+
13
+ # Goals
14
+
15
+ - Eliminate manual executable path configuration for standard installations.
16
+ - Automatically discover Android and iOS toolchains.
17
+ - Validate the runtime environment before execution.
18
+ - Expose structured diagnostics for missing or invalid dependencies.
19
+ - Support partial platform availability.
20
+ - Preserve deterministic behaviour across supported operating systems.
21
+
22
+ ---
23
+
24
+ # Non-Goals
25
+
26
+ This specification does not:
27
+
28
+ - Install Android Studio, Xcode, SDKs, or platform tooling.
29
+ - Modify operating system configuration.
30
+ - Automatically accept security prompts or permissions.
31
+ - Download missing dependencies.
32
+ - Replace platform package managers.
33
+
34
+ ---
35
+
36
+ # Supported Host Matrix
37
+
38
+ | Host OS | Android discovery | iOS discovery | Expected behaviour |
39
+ |---|---:|---:|---|
40
+ | macOS | Supported | Supported | Discover and validate Android and iOS toolchains independently. |
41
+ | Linux | Supported | Unsupported | Discover and validate Android tooling. Report iOS as unsupported without failing Android readiness. |
42
+ | Windows | Supported | Unsupported | Discover and validate Android tooling. Report iOS as unsupported without failing Android readiness. |
43
+
44
+ Unsupported hosts shall return `HOST_OS_UNSUPPORTED` for all platform discovery requests.
45
+
46
+ iOS discovery shall only run on macOS. On Linux and Windows, iOS status shall be reported as:
47
+
48
+ ```json
49
+ {
50
+ "platform": "ios",
51
+ "status": "unsupported",
52
+ "failure": {
53
+ "code": "PLATFORM_UNAVAILABLE",
54
+ "tool": null,
55
+ "message": "iOS tooling is only supported on macOS."
56
+ }
57
+ }
58
+ ```
59
+
60
+ # Scope
61
+
62
+ ## Android
63
+
64
+ - Android SDK
65
+ - adb
66
+ - emulator
67
+ - Java runtime where required by Gradle-backed operations
68
+ - Gradle installation where required by Gradle-backed operations
69
+
70
+ ## iOS
71
+
72
+ - Xcode
73
+ - xcrun
74
+ - simctl
75
+ - idb
76
+ - idb_companion
77
+ - LLDB
78
+
79
+ ## Shared
80
+
81
+ - Host operating system support
82
+ - Platform availability
83
+ - Executable versions
84
+ - Connected devices
85
+ - Running emulators/simulators
86
+ - Capability readiness
87
+
88
+ ---
89
+
90
+ # Runtime Behaviour
91
+
92
+ Toolchain discovery and validation shall be available through `get_system_status`.
93
+
94
+ Startup validation shall remain opt-in for compatibility with the current runtime.
95
+
96
+ When `MOBILE_DEBUG_MCP_STARTUP_HEALTHCHECK=1`, the server shall:
97
+
98
+ 1. Discover available toolchains.
99
+ 2. Validate required executables.
100
+ 3. Determine supported capabilities.
101
+ 4. Publish platform readiness to startup diagnostics.
102
+ 5. Continue operating whenever at least one platform is usable.
103
+
104
+ When `MOBILE_DEBUG_MCP_STARTUP_HEALTHCHECK` is unset or not equal to `1`, the server shall not perform eager validation during startup. Discovery shall instead run when `get_system_status` or a platform-dependent tool first requires it.
105
+
106
+ The server shall not fail simply because one platform is unavailable.
107
+
108
+ `get_system_status` is the authoritative public surface for environment readiness. This specification extends that existing tool rather than introducing a replacement tool.
109
+
110
+ ---
111
+
112
+ # Discovery Priority
113
+
114
+ Every executable and toolchain root shall be resolved using the following deterministic order.
115
+
116
+ 1. Explicit tool-specific environment variable.
117
+ 2. Explicit toolchain-root environment variable.
118
+ 3. Operating system `PATH`.
119
+ 4. Known platform installation locations.
120
+ 5. Tool-specific discovery command.
121
+ 6. Structured setup failure.
122
+
123
+ The following overrides shall remain first-class and take precedence over all automatic discovery:
124
+
125
+ | Concern | Supported override |
126
+ |---|---|
127
+ | adb executable | `ADB_PATH` |
128
+ | Android SDK root | `ANDROID_SDK_ROOT`, then `ANDROID_HOME` |
129
+ | xcrun executable | `XCRUN_PATH` |
130
+ | idb client executable | `MCP_IDB_PATH`, then `IDB_PATH` |
131
+ | idb companion executable | `IDB_COMPANION_PATH` |
132
+ | Java home for Gradle-backed operations | `GRADLE_JAVA_HOME`, then `JAVA_HOME` |
133
+ | Gradle home | `GRADLE_HOME` |
134
+
135
+ If multiple supported overrides are present for the same concern, the order shown in the table shall determine precedence.
136
+
137
+ An explicitly configured path that does not exist, is not executable, or fails validation shall not silently fall back to automatic discovery. It shall return a structured failure so configuration errors remain visible and deterministic.
138
+
139
+ # Tool Version Policy
140
+
141
+ Version validation shall be deterministic and tool-specific.
142
+
143
+ | Tool | Minimum supported version | Version command | Parsing rule | Unsupported when |
144
+ |---|---|---|---|---|
145
+ | adb | 1.0.41 | `adb version` | Parse the first semantic version following `Android Debug Bridge version`. | Missing, unparsable, or lower than 1.0.41. |
146
+ | xcrun | Host Xcode version | `xcodebuild -version` via resolved Xcode toolchain | Parse `Xcode <major>.<minor>[.<patch>]`. | Xcode is missing, unparsable, or older than Xcode 15.0. |
147
+ | simctl | Host Xcode version | `xcrun simctl help` and resolved Xcode version | Treat successful execution as compatible with the validated Xcode version. | Command fails under a supported Xcode installation. |
148
+ | idb | 1.1.7 | `idb --version` | Parse the first semantic version in stdout or stderr. | Missing, unparsable, or lower than 1.1.7. |
149
+ | idb_companion | 1.1.7 | `idb_companion --version` | Parse the first semantic version in stdout or stderr. | Missing, unparsable, lower than 1.1.7, or incompatible with the selected `idb` major/minor version. |
150
+ | LLDB | Host Xcode version | `xcrun lldb --version` | Parse the first numeric version token and record the raw string. | Command fails under a supported Xcode installation. |
151
+ | Java | 17 | `java -version` | Parse the Java feature version, including legacy and modern formats. | Missing, unparsable, or feature version lower than 17. |
152
+ | Gradle | 8.0 | `gradle --version` or project wrapper `./gradlew --version` | Parse `Gradle <major>.<minor>[.<patch>]`. | Missing when required, unparsable, or lower than 8.0. |
153
+
154
+ The implementation may raise minimum versions in a later specification revision, but shall not silently change them without updating this table and the associated tests.
155
+
156
+ When a version string cannot be parsed, the tool shall return `TOOL_VERSION_UNSUPPORTED` with the raw version output included in diagnostics.
157
+
158
+ ---
159
+
160
+ # Capability Detection
161
+
162
+ Discovery shall determine available capabilities rather than simply locating executables.
163
+
164
+ Capabilities shall be reported per platform.
165
+
166
+ Android capabilities may include:
167
+
168
+ - `device_discovery`
169
+ - `install_app`
170
+ - `launch_app`
171
+ - `ui_interaction`
172
+ - `screenshot`
173
+ - `log_capture`
174
+ - `debug`
175
+
176
+ iOS capabilities may include:
177
+
178
+ - `device_discovery`
179
+ - `install_app`
180
+ - `launch_app`
181
+ - `ui_interaction`
182
+ - `screenshot`
183
+ - `log_capture`
184
+ - `debug`
185
+
186
+ Agents shall not need to know which underlying provider implements a capability.
187
+
188
+ # Provider Selection
189
+
190
+ Multiple providers may satisfy the same capability.
191
+
192
+ The MCP shall select the highest-priority available provider for each capability.
193
+
194
+ Initial provider mapping:
195
+
196
+ | Platform | Capability | Provider priority |
197
+ |---|---|---|
198
+ | Android | device discovery | adb |
199
+ | Android | install app | adb |
200
+ | Android | launch app | adb |
201
+ | Android | UI interaction | adb-backed runtime |
202
+ | Android | screenshot | adb |
203
+ | Android | debug | JDWP |
204
+ | iOS | device discovery | idb, then simctl |
205
+ | iOS | install app | idb, then simctl where supported |
206
+ | iOS | launch app | idb, then simctl |
207
+ | iOS | UI interaction | idb |
208
+ | iOS | screenshot | idb, then simctl |
209
+ | iOS | debug | LLDB |
210
+
211
+ Provider selection shall be deterministic and included in `get_system_status` output.
212
+
213
+ A platform may be partially ready when only a subset of capabilities has an available provider.
214
+
215
+ ---
216
+
217
+ # Environment Validation
218
+
219
+ Validation shall confirm:
220
+
221
+ - executable exists
222
+ - executable is runnable
223
+ - version is supported
224
+ - required companion processes or binaries are available
225
+ - host platform prerequisites are satisfied
226
+ - connected devices are discoverable
227
+ - emulator/simulator state is readable
228
+
229
+ A missing booted device shall not make the platform toolchain unavailable when device discovery itself is functional. It shall instead affect device-dependent capabilities.
230
+
231
+ Examples:
232
+
233
+ - `xcrun` and `simctl` available with no booted simulator: iOS toolchain ready, device-dependent capabilities unavailable until a simulator is booted or device is connected.
234
+ - `adb` available with no connected device: Android toolchain ready, device-dependent capabilities unavailable until a device or emulator is connected.
235
+
236
+ # Diagnostic Contract
237
+
238
+ All discovery and validation failures shall use the following shape:
239
+
240
+ ```json
241
+ {
242
+ "code": "TOOL_NOT_FOUND",
243
+ "platform": "ios",
244
+ "tool": "idb",
245
+ "message": "idb could not be resolved.",
246
+ "searchedLocations": [
247
+ "MCP_IDB_PATH",
248
+ "IDB_PATH",
249
+ "PATH",
250
+ "/opt/homebrew/bin/idb",
251
+ "/usr/local/bin/idb"
252
+ ],
253
+ "selectedProvider": null,
254
+ "rawVersion": null,
255
+ "remediation": [
256
+ "Install fb-idb using pipx.",
257
+ "Set MCP_IDB_PATH to the idb executable if it is installed in a non-standard location."
258
+ ]
259
+ }
260
+ ```
261
+
262
+ Required fields:
263
+
264
+ - `code`
265
+ - `platform`
266
+ - `tool`
267
+ - `message`
268
+ - `searchedLocations`
269
+ - `selectedProvider`
270
+ - `rawVersion`
271
+ - `remediation`
272
+
273
+ Fields may be `null` when not applicable, but shall not be omitted.
274
+
275
+ Raw shell errors may be recorded internally for diagnostics, but shall not be exposed directly as the public failure contract.
276
+
277
+ ---
278
+
279
+ # Partial Availability
280
+
281
+ Platform readiness shall be reported independently.
282
+
283
+ | Android state | iOS state | Expected result |
284
+ |---|---|---|
285
+ | ready | unavailable | Android capabilities remain usable. iOS-dependent tools fail with `PLATFORM_UNAVAILABLE`. |
286
+ | unavailable | ready | iOS capabilities remain usable. Android-dependent tools fail with `PLATFORM_UNAVAILABLE`. |
287
+ | partially_ready | ready | Available Android capabilities remain usable; unavailable Android capabilities fail with `NO_SUPPORTED_PROVIDER` or `DEVICE_NOT_FOUND` as appropriate. |
288
+ | ready | partially_ready | Available iOS capabilities remain usable; unavailable iOS capabilities fail with `NO_SUPPORTED_PROVIDER` or `DEVICE_NOT_FOUND` as appropriate. |
289
+ | unavailable | unavailable | Server remains available for non-platform MCP tools, while all platform-dependent tools fail deterministically. |
290
+
291
+ A platform status shall be one of:
292
+
293
+ - `ready`
294
+ - `partially_ready`
295
+ - `unavailable`
296
+ - `unsupported`
297
+
298
+ # Runtime Introspection
299
+
300
+ `get_system_status` shall expose the environment summary using this minimum structure:
301
+
302
+ This change is additive and backwards compatible.
303
+
304
+ The existing flat `get_system_status` fields shall remain present and retain their current meanings for the duration of this specification. The new nested `host`, `android`, and `ios` objects shall be added alongside those legacy fields.
305
+
306
+ The implementation shall not remove, rename, or repurpose any existing flat field as part of Specification 016.
307
+
308
+ Where a legacy flat field and a new nested field represent the same value, both shall be populated from the same internal source of truth to prevent divergence.
309
+
310
+ ```json
311
+ {
312
+ "host": {
313
+ "os": "macos",
314
+ "supported": true
315
+ },
316
+ "android": {
317
+ "status": "ready",
318
+ "tools": {},
319
+ "providers": {},
320
+ "capabilities": {},
321
+ "devices": [],
322
+ "failures": []
323
+ },
324
+ "ios": {
325
+ "status": "partially_ready",
326
+ "tools": {},
327
+ "providers": {},
328
+ "capabilities": {},
329
+ "devices": [],
330
+ "failures": []
331
+ }
332
+ }
333
+ ```
334
+
335
+ For an unsupported host operating system, `get_system_status` shall return the following minimum shape while preserving all legacy flat fields:
336
+
337
+ ```json
338
+ {
339
+ "host": {
340
+ "os": "freebsd",
341
+ "supported": false
342
+ },
343
+ "android": {
344
+ "status": "unsupported",
345
+ "tools": {},
346
+ "providers": {},
347
+ "capabilities": {},
348
+ "devices": [],
349
+ "failures": [
350
+ {
351
+ "code": "HOST_OS_UNSUPPORTED",
352
+ "platform": "android",
353
+ "tool": null,
354
+ "message": "Host operating system 'freebsd' is not supported.",
355
+ "searchedLocations": [],
356
+ "selectedProvider": null,
357
+ "rawVersion": null,
358
+ "remediation": [
359
+ "Run Mobile Debug MCP on macOS, Linux, or Windows."
360
+ ]
361
+ }
362
+ ]
363
+ },
364
+ "ios": {
365
+ "status": "unsupported",
366
+ "tools": {},
367
+ "providers": {},
368
+ "capabilities": {},
369
+ "devices": [],
370
+ "failures": [
371
+ {
372
+ "code": "HOST_OS_UNSUPPORTED",
373
+ "platform": "ios",
374
+ "tool": null,
375
+ "message": "Host operating system 'freebsd' is not supported.",
376
+ "searchedLocations": [],
377
+ "selectedProvider": null,
378
+ "rawVersion": null,
379
+ "remediation": [
380
+ "Run Mobile Debug MCP on macOS, Linux, or Windows."
381
+ ]
382
+ }
383
+ ]
384
+ }
385
+ }
386
+ ```
387
+
388
+ Each resolved tool entry shall include:
389
+
390
+ - resolved path
391
+ - discovery source
392
+ - parsed version
393
+ - raw version output
394
+ - validation status
395
+
396
+ Each capability entry shall include:
397
+
398
+ - availability
399
+ - selected provider
400
+ - blocking failure, if unavailable
401
+
402
+ ---
403
+
404
+ # Compatibility
405
+
406
+ This specification extends the existing `get_system_status` surface additively.
407
+
408
+ It does not introduce a replacement status tool, and it does not make a breaking response-shape change.
409
+
410
+ All existing flat fields remain supported and unchanged. The new nested `host`, `android`, and `ios` fields are added alongside them.
411
+
412
+ Removal of the legacy flat fields requires a separate deprecation specification and shall not occur as part of Specification 016.
413
+
414
+ The following existing configuration inputs remain supported:
415
+
416
+ - `ADB_PATH`
417
+ - `ANDROID_SDK_ROOT`
418
+ - `ANDROID_HOME`
419
+ - `XCRUN_PATH`
420
+ - `MCP_IDB_PATH`
421
+ - `IDB_PATH`
422
+ - `IDB_COMPANION_PATH`
423
+ - `GRADLE_JAVA_HOME`
424
+ - `JAVA_HOME`
425
+ - `GRADLE_HOME`
426
+ - `MOBILE_DEBUG_MCP_STARTUP_HEALTHCHECK`
427
+
428
+ Environment variables become optional overrides rather than mandatory configuration, except where the user intentionally supplies one. An invalid explicit override shall fail validation and shall not be ignored.
429
+
430
+ ---
431
+
432
+ # Failure Modes
433
+
434
+ The implementation shall return deterministic setup failures including:
435
+
436
+ - `HOST_OS_UNSUPPORTED`
437
+ - `TOOL_NOT_FOUND`
438
+ - `TOOL_NOT_EXECUTABLE`
439
+ - `TOOL_VERSION_UNSUPPORTED`
440
+ - `PLATFORM_UNAVAILABLE`
441
+ - `DEVICE_NOT_FOUND`
442
+ - `NO_SUPPORTED_PROVIDER`
443
+ - `TOOL_VALIDATION_FAILED`
444
+
445
+ Failure selection rules:
446
+
447
+ - Unsupported host operating system: `HOST_OS_UNSUPPORTED`.
448
+ - Explicit path missing or not executable: `TOOL_NOT_EXECUTABLE`.
449
+ - Tool cannot be resolved from any allowed source: `TOOL_NOT_FOUND`.
450
+ - Version is below minimum or unparsable: `TOOL_VERSION_UNSUPPORTED`.
451
+ - Host supports the platform but required foundational tooling is absent: `PLATFORM_UNAVAILABLE`.
452
+ - Toolchain is valid but no device or simulator is available for a device-dependent operation: `DEVICE_NOT_FOUND`.
453
+ - Platform is available but no provider can satisfy a requested capability: `NO_SUPPORTED_PROVIDER`.
454
+ - Tool exists but its validation command fails for another reason: `TOOL_VALIDATION_FAILED`.
455
+
456
+ ---
457
+
458
+ # Acceptance Criteria
459
+
460
+ The implementation is complete when all of the following are true.
461
+
462
+ ## Host Support
463
+
464
+ - Android discovery works on macOS, Linux, and Windows.
465
+ - iOS discovery works on macOS only.
466
+ - iOS is reported as `unsupported` on Linux and Windows without affecting Android readiness.
467
+
468
+ ## Discovery and Overrides
469
+
470
+ - A default installation requires no executable path configuration when supported tools are installed in standard locations.
471
+ - Every override listed in this specification is honoured using the documented precedence.
472
+ - Invalid explicit overrides fail deterministically and do not silently fall back.
473
+
474
+ ## Validation
475
+
476
+ - Every supported tool is version-checked using the command and parsing rule defined in this specification.
477
+ - Unsupported or unparsable versions return `TOOL_VERSION_UNSUPPORTED` with `rawVersion` populated.
478
+ - Missing devices affect device-dependent capabilities without incorrectly marking the whole toolchain unavailable.
479
+
480
+ ## Status Surface
481
+
482
+ - `get_system_status` returns host, platform, tool, provider, capability, device, and failure information using the specified structure.
483
+ - Existing flat `get_system_status` fields remain present, unchanged, and populated from the same internal source of truth as the new nested fields.
484
+ - Unsupported host operating systems return `HOST_OS_UNSUPPORTED` for both platform objects using the exact diagnostic contract defined in this specification.
485
+ - Provider selection is visible and deterministic.
486
+ - Partial platform availability is represented using `ready`, `partially_ready`, `unavailable`, or `unsupported`.
487
+
488
+ ## Concrete Pass/Fail Cases
489
+
490
+ 1. `ADB_PATH` points to a non-existent file:
491
+ - Android reports `TOOL_NOT_EXECUTABLE`.
492
+ - Automatic adb discovery does not run.
493
+
494
+ 2. `adb` is found on `PATH` but `adb version` returns an unsupported or unparsable version:
495
+ - Android reports `TOOL_VERSION_UNSUPPORTED`.
496
+ - `rawVersion` contains the command output.
497
+
498
+ 3. `xcrun` and `simctl` are valid but no simulator is booted:
499
+ - iOS toolchain status is `partially_ready` or `ready` according to available non-device capabilities.
500
+ - Device-dependent operations return `DEVICE_NOT_FOUND`.
501
+
502
+ 4. Android is ready and iOS foundational tooling is absent on macOS:
503
+ - Android tools continue to function.
504
+ - iOS tools return `PLATFORM_UNAVAILABLE`.
505
+
506
+ 5. iOS is ready and Android foundational tooling is absent:
507
+ - iOS tools continue to function.
508
+ - Android tools return `PLATFORM_UNAVAILABLE`.
509
+
510
+ 6. `MOBILE_DEBUG_MCP_STARTUP_HEALTHCHECK` is unset:
511
+ - Server startup does not eagerly validate toolchains.
512
+ - `get_system_status` performs discovery and returns readiness.
513
+
514
+ 7. `MOBILE_DEBUG_MCP_STARTUP_HEALTHCHECK=1`:
515
+ - Startup diagnostics run using the same discovery and validation contract as `get_system_status`.
516
+
517
+ ## Backwards Compatibility
518
+
519
+ - Existing valid environment-variable configurations continue to work.
520
+ - Existing `get_system_status` consumers remain supported, with new fields added in a backwards-compatible manner where possible.
521
+
522
+ ---
523
+
524
+ # Future Work
525
+
526
+ Potential future enhancements include:
527
+
528
+ - Interactive `doctor` command built on the same diagnostic contract.
529
+ - Automatic emulator and simulator startup.
530
+ - Toolchain health monitoring.
531
+ - Self-healing actions such as restarting adb, reconnecting devices, or refreshing simulator state.
532
+ - Installation guidance and package manager integration.
533
+ - Configurable version policies for enterprise environments.
@@ -17,4 +17,6 @@ For interactive flows, the intended deterministic pattern is:
17
17
  - **expect_\*** tools are for final outcome verification
18
18
  - observation tools are supporting context, not primary success signals
19
19
 
20
+ For environment-sensitive work, call `get_system_status` first so the client can rely on automatic discovery when it is available and fall back to explicit tool paths only when needed.
21
+
20
22
  Use the linked documents below for per-tool inputs, outputs, and usage guidance.
@@ -51,6 +51,8 @@ Notes:
51
51
  - Requires `platform`, `projectType`, and `projectPath`.
52
52
  - Android builds prefer the project `gradlew` when present.
53
53
  - iOS builds honor environment-based Xcode destination and derived-data settings where configured.
54
+ - Android setup typically needs `ADB_PATH` or `ANDROID_SDK_ROOT`/`ANDROID_HOME`, plus `GRADLE_JAVA_HOME` or `JAVA_HOME` for Gradle-backed builds.
55
+ - iOS setup typically needs `XCRUN_PATH` and `MCP_IDB_PATH` or `IDB_PATH` when `idb` is not on `PATH`.
54
56
 
55
57
  ---
56
58
 
@@ -102,8 +104,8 @@ Response:
102
104
  ```
103
105
 
104
106
  Notes:
105
- - Android: prefers `ADB_PATH` if set, otherwise falls back to `adb` on PATH.
106
- - iOS: uses `xcrun simctl install` for simulators and `idb` where available for devices.
107
+ - Android: prefers `ADB_PATH` if set, otherwise falls back to `adb` on `PATH`, and will also use `ANDROID_SDK_ROOT`/`ANDROID_HOME` when present.
108
+ - iOS: uses `xcrun simctl install` for simulators and `idb` where available for devices; point `MCP_IDB_PATH` or `IDB_PATH` at a non-standard `idb` binary.
107
109
 
108
110
  ---
109
111
 
@@ -49,13 +49,15 @@ Response (example):
49
49
  }
50
50
  ```
51
51
 
52
+ The response is additive: the existing flat fields remain available, and the nested `host`, `android`, and `ios` objects are added alongside them.
53
+
52
54
  Checks performed (fast, best-effort):
53
55
  - ADB availability and version (adb --version)
54
56
  - Connected Android devices (adb devices -l), counts and state summary (device/unauthorized/offline)
55
57
  - Log access probe (adb logcat -d -t 1)
56
- - Android environment variables (ANDROID_SDK_ROOT / ANDROID_HOME / PATH contains adb)
58
+ - Android environment variables and discovery order (`ADB_PATH`, then `ANDROID_SDK_ROOT`/`ANDROID_HOME`, then `PATH`)
57
59
  - Optional: app installation check if MCP_TARGET_PACKAGE/MCP_TARGET_APP_ID is set (pm path)
58
- - Basic iOS checks (xcrun --version and simctl list devices booted)
60
+ - Basic iOS checks (`XCRUN_PATH`, `MCP_IDB_PATH`/`IDB_PATH`, and `simctl` booted-device discovery)
59
61
 
60
62
  Behavior notes:
61
63
  - Always returns structured JSON and never throws; any failures are surfaced in the `issues` array.
@@ -68,3 +70,8 @@ Usage guidance:
68
70
  - Call before build/install flows to avoid wasted build attempts on misconfigured systems.
69
71
  - Call early in a session when device or toolchain availability is uncertain.
70
72
  - If `success: false`, attempt recovery steps or report issues to the user.
73
+
74
+ Recommended setup patterns:
75
+ - Default: let the server discover tools automatically from standard locations and call `get_system_status` first to confirm what is available.
76
+ - Android: set `ADB_PATH` only if you want to override the discovered `adb` binary, or set `ANDROID_SDK_ROOT`/`ANDROID_HOME` when discovery needs help finding `platform-tools/adb`.
77
+ - iOS: set `XCRUN_PATH` only if Xcode tools are not on `PATH`, and set `MCP_IDB_PATH` or `IDB_PATH` only when `idb` lives outside the default search paths.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobile-debug-mcp",
3
- "version": "0.30.1",
3
+ "version": "0.31.0",
4
4
  "description": "MCP server for mobile app debugging (Android + iOS), with focus on security and reliability",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,52 @@
1
+ # Spec Review skill
2
+
3
+ name: spec-review
4
+ version: 0.1.1
5
+ summary: Reusable workflow for reviewing specs in this repository with a consistent readiness rubric and output template.
6
+
7
+ # Purpose
8
+ Help an agent review a specification for clarity, implementation readiness, and execution readiness against the current codebase. Use a common template so reviews stay consistent across documents and reviewers.
9
+
10
+ # Activation conditions
11
+ Activate when an agent needs to:
12
+ - review a new or revised spec
13
+ - assess whether a spec is implementation-ready or execution-ready
14
+ - identify whether feedback is a spec issue or an implementation issue
15
+ - compare a spec against the current `src/` contract surface and docs
16
+
17
+ # Surface area (actions)
18
+ - locate-spec
19
+ - compare-against-code
20
+ - assess-contract-completeness
21
+ - classify-gaps
22
+ - produce-review
23
+
24
+ # Core guidance
25
+ 1. Read the spec first, then compare it against the relevant code, docs, and tests.
26
+ 2. Separate **spec gaps** from **implementation gaps**.
27
+ 3. Check for: problem clarity, scope boundaries, explicit contracts, acceptance criteria, non-goals, and consistency with existing behavior.
28
+ 4. Prefer precise feedback that names the missing contract, unclear rule, or inconsistent behavior.
29
+ 5. Use the shared review template in `references/spec-review-template.md` for the final output.
30
+ 6. If the spec is not ready, say exactly what must be clarified before implementation can start.
31
+ 7. Classify each blocker as either a **spec gap** or an **implementation contract gap** and stop at that boundary.
32
+
33
+ # Inputs & outputs
34
+ - review-spec(input: { specPath, relatedPaths?, focusAreas? }) -> { verdict, risks, specGaps, implementationGaps, recommendations }
35
+ - compare-against-code(input: { specPath, codePaths[] }) -> { matches, mismatches, notes }
36
+ - produce-review(input: { specPath, findings[] }) -> { summary, verdict, checklist, nextStep }
37
+
38
+ # Failure handling
39
+ - If the spec file is missing, stop and report the missing path explicitly.
40
+ - If the spec is ambiguous, classify each concern as either "spec" or "implementation" instead of blending them.
41
+ - If the review cannot be grounded in the current repo, state that the spec is not reviewable yet.
42
+
43
+ # Progressive disclosure
44
+ - Keep this file short.
45
+ - Load the reference template only when writing the final review.
46
+
47
+ # References
48
+ - `references/spec-review-template.md` — standard review format and verdict rubric
49
+ - `references/spec-review-checklist.md` — questions to apply while reviewing a spec
50
+
51
+ # License
52
+ Same as repository (MIT).
@@ -0,0 +1,13 @@
1
+ # Spec Review Checklist
2
+
3
+ Ask these questions while reviewing a spec for implementation and execution readiness:
4
+
5
+ 1. Is the problem statement specific and grounded in current failures?
6
+ 2. Are non-goals explicit?
7
+ 3. Are contracts concrete enough to implement?
8
+ 4. Are acceptance criteria testable?
9
+ 5. Are execution rules fully defined (no reliance on implicit runtime assumptions)?
10
+ 6. Does the spec define the source of truth for new fields, states, or behaviors?
11
+ 7. Does it match existing code paths and public tool surfaces?
12
+ 8. Can each open concern be classified as a spec issue, execution gap, or implementation issue?
13
+ 9. Is the spec ready to execute and implement without further interpretation?
@@ -0,0 +1,28 @@
1
+ # Spec Review Template
2
+
3
+ Use this structure for every spec review:
4
+
5
+ ## Verdict
6
+ - Ready / Needs clarification / Needs implementation contract / Needs execution contract / Not ready
7
+
8
+ ## Summary
9
+ - One short paragraph on the spec's current quality.
10
+
11
+ ## What is good
12
+ - List the strongest parts of the spec.
13
+
14
+ ## Issues
15
+ For each issue, include:
16
+ - **Type:** spec / implementation / implementation contract / execution / doc
17
+ - **Severity:** low / medium / high
18
+ - **Why it matters:** one sentence
19
+ - **Fix:** exact change needed
20
+
21
+ ## Missing contract or execution surfaces
22
+ - List any API shapes, response fields, state transitions, invariants, or runtime execution rules that are still undefined.
23
+
24
+ ## Codebase alignment
25
+ - Note whether the spec matches current `src/`, docs, and tests.
26
+
27
+ ## Next step
28
+ - State the smallest next action needed to move the spec forward toward implementation readiness.