mobile-debug-mcp 0.32.2 → 0.32.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/README.md +5 -1
- package/agent-plugin/LICENSE +201 -0
- package/agent-plugin/README.md +27 -0
- package/agent-plugin/mcp.json +11 -0
- package/agent-plugin/plugin.json +29 -0
- package/agent-plugin/skills/mobile-debug-mcp/SKILL.md +96 -0
- package/dist/observe/android.js +2 -18
- package/dist/server-core.js +1 -1
- package/docs/CHANGELOG.md +5 -2
- package/docs/benchmarks/ui-tree-performance/README.md +4 -3
- package/docs/tools/observe.md +1 -2
- package/package.json +4 -2
- package/scripts/agent-plugin.mjs +38 -0
- package/skills/mcp-builder/SKILL.md +1 -2
- package/skills/mobile-debug-tools-usage/SKILL.md +55 -33
- package/skills/spec-review/SKILL.md +1 -1
- package/skills/test-authoring/SKILL.md +1 -1
- package/src/observe/android.ts +2 -15
- package/src/server-core.ts +1 -1
- package/test/unit/observe/android_tree_acquisition.test.ts +4 -0
- package/test/unit/observe/ios-getlogs.test.ts +3 -3
- package/src/observe/android-tree-bridge.ts +0 -178
- package/test/device/automated/ui-tree-performance/bridge-probe.ts +0 -197
- package/test/fixtures/ui-tree-bridge/AndroidManifest.xml +0 -6
- package/test/fixtures/ui-tree-bridge/build.ts +0 -34
- package/test/fixtures/ui-tree-bridge/src/TreeInstrumentation.java +0 -126
- package/test/unit/observe/android_tree_bridge_cleanup.test.ts +0 -95
package/README.md
CHANGED
|
@@ -121,6 +121,10 @@ If you are unsure whether the environment is configured correctly, run `get_syst
|
|
|
121
121
|
|
|
122
122
|
## Usage
|
|
123
123
|
|
|
124
|
+
For clients that support Agent Plugins, the [agent-plugin](agent-plugin/README.md)
|
|
125
|
+
package installs the MCP server configuration together with the existing usage
|
|
126
|
+
skill. Direct npm/MCP configuration above remains supported.
|
|
127
|
+
|
|
124
128
|
Examples:
|
|
125
129
|
|
|
126
130
|
Crash fixing:
|
|
@@ -138,4 +142,4 @@ Feature building:
|
|
|
138
142
|
|
|
139
143
|
## License
|
|
140
144
|
|
|
141
|
-
|
|
145
|
+
Apache-2.0
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Mobile Debug MCP agent plugin
|
|
2
|
+
|
|
3
|
+
Install this directory as an Agent Plugins package in a client that supports
|
|
4
|
+
both skills and stdio MCP servers. It provides the existing mobile-debug MCP
|
|
5
|
+
usage skill and launches the published `mobile-debug-mcp` npm package. The
|
|
6
|
+
plugin requires Node.js 18 or newer, `npx`, and the platform toolchains needed
|
|
7
|
+
for the devices you want to use. The first launch may need npm registry access.
|
|
8
|
+
The MCP process starts in the client-managed plugin data directory so npm does
|
|
9
|
+
not resolve the source checkout as a local package when installed from this repo.
|
|
10
|
+
|
|
11
|
+
The server is pinned to the published npm version in `mcp.json`. The plugin's
|
|
12
|
+
`plugin.json` version advances independently for guidance-only releases; do not
|
|
13
|
+
change the server pin to an unpublished npm version. The repository's
|
|
14
|
+
`skills/mobile-debug-tools-usage/SKILL.md` is the
|
|
15
|
+
source of the packaged skill; run `npm run sync:agent-plugin` after editing it.
|
|
16
|
+
The packaged directory uses the skill's declared name, `mobile-debug-mcp`, as
|
|
17
|
+
required by Agent Skills. `npm run check:agent-plugin` checks the packaged
|
|
18
|
+
copies and configuration.
|
|
19
|
+
|
|
20
|
+
The usage skill prefers screenshots for routine visual checks and reserves
|
|
21
|
+
hierarchy reads for semantic selection and structured assertions. Assertion
|
|
22
|
+
timeouts must cover a fresh tree read as well as the expected app transition.
|
|
23
|
+
|
|
24
|
+
If you already configured the MCP server directly in your agent client, disable
|
|
25
|
+
that separate registration when enabling this plugin to avoid duplicate tools.
|
|
26
|
+
The direct npm installation remains available without this plugin. See the
|
|
27
|
+
repository README for platform toolchain setup and `get_system_status` guidance.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
|
+
"name": "mobile-debug-tools",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"description": "Mobile app debugging tools and usage guidance for Android and iOS agents.",
|
|
6
|
+
"repository": "https://github.com/clivejefferies/mobile-debug-tools",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"keywords": ["mobile", "android", "ios", "debugging", "mcp"],
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "mobile-debug-tools contributors"
|
|
11
|
+
},
|
|
12
|
+
"extensions": {
|
|
13
|
+
"com.openai": {
|
|
14
|
+
"interface": {
|
|
15
|
+
"displayName": "Mobile Debug Tools",
|
|
16
|
+
"shortDescription": "Inspect and debug Android and iOS apps",
|
|
17
|
+
"longDescription": "Inspect mobile apps, interact with their screens, collect debugging evidence, and verify observed behaviour on Android and iOS devices and emulators. Requires local Node.js and the relevant platform toolchains.",
|
|
18
|
+
"developerName": "mobile-debug-tools contributors",
|
|
19
|
+
"category": "Developer Tools",
|
|
20
|
+
"capabilities": ["Interactive"],
|
|
21
|
+
"defaultPrompt": [
|
|
22
|
+
"Check my mobile debugging environment and connected devices.",
|
|
23
|
+
"Inspect the current screen of my mobile app.",
|
|
24
|
+
"Help me reproduce and diagnose a bug in my mobile app."
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobile-debug-mcp
|
|
3
|
+
description: Use mobile-debug MCP to inspect, interact with, and verify any Android or iOS app on a device or emulator.
|
|
4
|
+
metadata:
|
|
5
|
+
author: mobile-debug-mcp contributors
|
|
6
|
+
version: "1.1"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Mobile-debug MCP usage
|
|
10
|
+
|
|
11
|
+
Use mobile-debug MCP when a task needs evidence from a running Android or iOS app. Identify the device and the state or behaviour to check, then choose the smallest observation or action that can establish it. A successful tool call confirms only what that tool reports; check the resulting app state before claiming an outcome.
|
|
12
|
+
|
|
13
|
+
## Choose the lightest evidence that proves the claim
|
|
14
|
+
|
|
15
|
+
- Prefer a screenshot for routine visual navigation, layout checks, and visible
|
|
16
|
+
outcomes that can be established from the image.
|
|
17
|
+
- Use UI-tree reads and accessibility assertions such as `expect_element_visible`,
|
|
18
|
+
`expect_state`, or `wait_for_ui` when reliable element selection or a structured
|
|
19
|
+
property check is required. An image alone does not establish accessibility
|
|
20
|
+
properties such as enabled state.
|
|
21
|
+
- Use a debug snapshot when an ordinary observation does not explain a failure or multiple kinds of evidence are needed together.
|
|
22
|
+
- Use logs or network activity for claims about errors or requests. Correlate them with the relevant action and time window; they do not establish what the user saw.
|
|
23
|
+
- Use platform shell commands only for device or system operations that the MCP tools cannot expose. Treat shell output as evidence of that operation, not of the app's visible state.
|
|
24
|
+
|
|
25
|
+
Choose one observation that proves the required outcome. Avoid automatically
|
|
26
|
+
reading the UI tree after a screenshot or taking a screenshot after a sufficient
|
|
27
|
+
structured assertion.
|
|
28
|
+
|
|
29
|
+
## Keep Android inspection APK-free
|
|
30
|
+
|
|
31
|
+
Use the standard ADB path for Android inspection. It requires no helper APK.
|
|
32
|
+
The normal hierarchy dump
|
|
33
|
+
can take several seconds; account for this rather than treating it as a fast
|
|
34
|
+
poll. Compressed dumps can omit nodes and should not be assumed faster.
|
|
35
|
+
|
|
36
|
+
## Keep interaction fast
|
|
37
|
+
|
|
38
|
+
Treat each MCP call as a round trip and use the fastest path that still proves
|
|
39
|
+
the behaviour. For an interaction, prefer this sequence:
|
|
40
|
+
|
|
41
|
+
1. Observe the current screen or wait for a uniquely identifiable target if its presence is uncertain.
|
|
42
|
+
2. Perform the requested action using a stable selector or element id when available.
|
|
43
|
+
3. Check the specific resulting state once it has had time to occur.
|
|
44
|
+
|
|
45
|
+
Do not wait before every action when its target and current state are already
|
|
46
|
+
known. Do not poll unchanged screens. Set bounded assertion timeouts that cover
|
|
47
|
+
the expected app transition plus a complete fresh observation and a margin.
|
|
48
|
+
For Android ADB tree reads taking 2–3 seconds, start with a 5-second timeout for
|
|
49
|
+
a simple assertion; allow more when loading or repeated observations are
|
|
50
|
+
required. A 2-second timeout cannot reliably accommodate a 3-second tree read.
|
|
51
|
+
Adjust to measured device latency and supported tool limits. Report an
|
|
52
|
+
observation timeout separately from evidence that a control is absent.
|
|
53
|
+
|
|
54
|
+
Use compact responses for routine actions. If action dispatch is reliable but
|
|
55
|
+
verification is slow or unavailable, dispatch with verification disabled and
|
|
56
|
+
verify at meaningful checkpoints with one focused accessibility assertion or
|
|
57
|
+
screenshot. Do not assume `light` verification is faster: use it only when it
|
|
58
|
+
has returned useful results reliably on the current MCP version and device.
|
|
59
|
+
|
|
60
|
+
Prefer a stable element selector when it is already known and valid. For a
|
|
61
|
+
clearly identifiable visual target, use coordinates from a fresh screenshot
|
|
62
|
+
without requiring a tree read solely to rediscover it. If the target is
|
|
63
|
+
ambiguous or a semantic check is required, resolve it from the hierarchy.
|
|
64
|
+
Reacquire coordinates after scrolling,
|
|
65
|
+
changing orientation, switching screens, or opening a system surface.
|
|
66
|
+
|
|
67
|
+
Element discovery can be the slowest part of a journey. Avoid repeated
|
|
68
|
+
`find_element` calls for the same screen: resolve a control once, use the
|
|
69
|
+
returned selector or coordinates while that screen is unchanged, and verify
|
|
70
|
+
the resulting state before continuing. If a query fails, inspect the current
|
|
71
|
+
screen once before retrying; controls represented only by icons may not have a
|
|
72
|
+
matching visible text label.
|
|
73
|
+
|
|
74
|
+
When the MCP offers a journey or batch action, use it only when its steps can
|
|
75
|
+
express the needed observable checks and it returns enough evidence to report
|
|
76
|
+
the outcome. Measure the whole journey and compare equivalent steps on the same
|
|
77
|
+
device; do not infer a performance improvement from a single fast action.
|
|
78
|
+
|
|
79
|
+
## Match the evidence to the claim
|
|
80
|
+
|
|
81
|
+
For a state change, check the state after the action rather than inferring it
|
|
82
|
+
from successful dispatch. For an asynchronous update, start a fresh observation
|
|
83
|
+
after the relevant event and wait for the expected condition within a bounded
|
|
84
|
+
timeout. If an accessibility tree appears stale or incomplete, use another
|
|
85
|
+
appropriate observation such as a screenshot and report the discrepancy.
|
|
86
|
+
|
|
87
|
+
For behaviour outside the app's foreground screen, inspect the relevant system
|
|
88
|
+
surface or device state. For content that cannot be established visually, such
|
|
89
|
+
as audio output, use a suitable direct check or state that it was not verified.
|
|
90
|
+
|
|
91
|
+
## Report evidence precisely
|
|
92
|
+
|
|
93
|
+
State the device, actions taken, observed result, evidence source, and any
|
|
94
|
+
untested scope. Distinguish an observed outcome from an inference. Do not say
|
|
95
|
+
a feature works solely because the build compiled or an MCP action returned
|
|
96
|
+
success.
|
package/dist/observe/android.js
CHANGED
|
@@ -9,7 +9,6 @@ import { parsePngSize } from "../utils/image.js";
|
|
|
9
9
|
import { deriveSnapshotMetadata } from "./snapshot-metadata.js";
|
|
10
10
|
import { remainingBudget } from '../utils/operation-budget.js';
|
|
11
11
|
import { createObservationMeasurement } from './performance-metrics.js';
|
|
12
|
-
import { androidTreeBridgeEnabled, readAndroidTreeFromBridge } from './android-tree-bridge.js';
|
|
13
12
|
const activeLogStreams = new Map();
|
|
14
13
|
export class AndroidObserve {
|
|
15
14
|
async getDeviceMetadata(appId, deviceId) {
|
|
@@ -47,22 +46,7 @@ export class AndroidObserve {
|
|
|
47
46
|
await measurement.timed('observation_wait_ms', () => delay(Math.min(remainingBudget(300 + (attempts * 100)), 300 + (attempts * 100))));
|
|
48
47
|
}
|
|
49
48
|
remainingBudget();
|
|
50
|
-
|
|
51
|
-
if (androidTreeBridgeEnabled()) {
|
|
52
|
-
try {
|
|
53
|
-
bridgeContent = await measurement.physicalRead(async () => {
|
|
54
|
-
const content = await readAndroidTreeFromBridge(deviceInfo.id);
|
|
55
|
-
if (!content)
|
|
56
|
-
throw new Error('Android UI tree bridge unavailable');
|
|
57
|
-
return content;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
if (error instanceof Error && (error.message === 'ACTION_TIMEOUT' || error.message.startsWith('BRIDGE_CLEANUP_UNCONFIRMED')))
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
xmlContent = bridgeContent ?? await measurement.physicalRead(async () => {
|
|
49
|
+
xmlContent = await measurement.physicalRead(async () => {
|
|
66
50
|
await execAdb(['shell', 'uiautomator', 'dump', '/sdcard/ui.xml'], deviceId);
|
|
67
51
|
const content = await execAdb(['shell', 'cat', '/sdcard/ui.xml'], deviceId);
|
|
68
52
|
if (!content || !content.trim() || content.includes('ERROR:'))
|
|
@@ -72,7 +56,7 @@ export class AndroidObserve {
|
|
|
72
56
|
break;
|
|
73
57
|
}
|
|
74
58
|
catch (e) {
|
|
75
|
-
if (e instanceof Error &&
|
|
59
|
+
if (e instanceof Error && e.message === 'ACTION_TIMEOUT')
|
|
76
60
|
throw e;
|
|
77
61
|
console.error(`Attempt ${attempts} failed: ${e}`);
|
|
78
62
|
}
|
package/dist/server-core.js
CHANGED
|
@@ -6,7 +6,7 @@ import { handleToolCall } from './server/tool-handlers.js';
|
|
|
6
6
|
export { wrapResponse, toolDefinitions, handleToolCall };
|
|
7
7
|
export const serverInfo = {
|
|
8
8
|
name: 'mobile-debug-mcp',
|
|
9
|
-
version: '0.32.
|
|
9
|
+
version: '0.32.4'
|
|
10
10
|
};
|
|
11
11
|
export function createServer() {
|
|
12
12
|
const server = new Server(serverInfo, {
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the **Mobile Debug MCP** project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.32.4]
|
|
6
|
+
- Removed the optional Android UI-tree bridge runtime and its APK build tooling. Android UI-tree reads use `uiautomator dump` through ADB.
|
|
7
|
+
|
|
5
8
|
## [0.32.2]
|
|
6
9
|
- bug fix
|
|
7
10
|
|
|
@@ -26,7 +29,7 @@ All notable changes to the **Mobile Debug MCP** project will be documented in th
|
|
|
26
29
|
## [0.30.0]
|
|
27
30
|
- Folded RFC 013 synchronization semantics into the main spec and aligned the interact docs with the shipped `wait_for_ui_change` behavior.
|
|
28
31
|
- Updated `wait_for_ui_change` to use a 300ms stabilization default and to reset stabilization on new in-place mutations.
|
|
29
|
-
- Validated the in-place UI mutation flow on
|
|
32
|
+
- Validated the in-place UI mutation flow on an Android emulator, including a delayed state-change case.
|
|
30
33
|
|
|
31
34
|
## [0.29.0]
|
|
32
35
|
- Added empty resource handlers and declared the `resources` capability so Codex MCP discovery can complete the handshake against the published npm package.
|
|
@@ -57,7 +60,7 @@ All notable changes to the **Mobile Debug MCP** project will be documented in th
|
|
|
57
60
|
- RFC-003 wait/synchronization contract with `snapshot_revision`, `captured_at_ms`, and `loading_state`
|
|
58
61
|
- Added `wait_for_ui_change` for stable in-place UI mutations
|
|
59
62
|
- Updated `get_ui_tree` and `capture_debug_snapshot` to surface snapshot metadata
|
|
60
|
-
-
|
|
63
|
+
- Validated the new UI-change flow on an Android emulator
|
|
61
64
|
|
|
62
65
|
## [0.25.1]
|
|
63
66
|
- Platform-native element identity metadata for UI targeting
|
|
@@ -50,9 +50,10 @@ The report commit SHAs are available locally as `codex/spec-019-baseline` and
|
|
|
50
50
|
`codex/spec-019-candidate`; create clean, built checkouts of those refs to
|
|
51
51
|
reproduce the paired measurement.
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
`LATENCY_DEVICE_ID=emulator-5554 node --import tsx test/device/automated/ui-tree-performance/bridge-probe.ts`.
|
|
55
|
-
Its `bridge-probe.json` compares ten bridge and legacy reads, checks a network
|
|
53
|
+
The historical `bridge-probe.json` compares ten bridge and legacy reads, checks a network
|
|
56
54
|
update, and checks a timer that changes visually without emitting an
|
|
57
55
|
accessibility event. The timer check catches a stale accessibility cache even
|
|
58
56
|
when every bridge request calls `getRootInActiveWindow()`.
|
|
57
|
+
The bridge APK source, generator, and build/install probe have been removed;
|
|
58
|
+
this report is retained as historical evidence, not a runnable benchmark in
|
|
59
|
+
the current checkout.
|
package/docs/tools/observe.md
CHANGED
|
@@ -92,8 +92,7 @@ Notes:
|
|
|
92
92
|
- Elements may also include platform-native identity hints such as `stable_id`, `role`, `test_tag`, `selector`, and `semantic`.
|
|
93
93
|
- The tree response may include `snapshot_revision`, `captured_at_ms`, and `loading_state` when a reliable signal is available.
|
|
94
94
|
- Prefer `wait_for_ui` for deterministic element resolution in interactive flows.
|
|
95
|
-
- Android
|
|
96
|
-
- If the bridge fails, the server stops it before falling back to `uiautomator dump`. While running, the bridge holds Android's UiAutomation connection, so other `uiautomator dump` clients may fail. Leave the variable unset for the default reader. To reproduce the device probe, set `LATENCY_DEVICE_ID` and run `npx tsx test/device/automated/ui-tree-performance/bridge-probe.ts`.
|
|
95
|
+
- Android reads the accessibility hierarchy with `uiautomator dump` through ADB. No helper APK is installed or required.
|
|
97
96
|
|
|
98
97
|
---
|
|
99
98
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobile-debug-mcp",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.4",
|
|
4
4
|
"description": "MCP server for mobile app debugging (Android + iOS), with focus on security and reliability",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
"test": "npm run test:unit",
|
|
20
20
|
"lint": "eslint src test --quiet",
|
|
21
21
|
"lint:fix": "eslint src test --fix",
|
|
22
|
-
"
|
|
22
|
+
"sync:agent-plugin": "node scripts/agent-plugin.mjs --sync",
|
|
23
|
+
"check:agent-plugin": "node scripts/agent-plugin.mjs --check",
|
|
24
|
+
"verify": "npm run lint && npm run build && npm run test:unit && npm run check:agent-plugin"
|
|
23
25
|
},
|
|
24
26
|
|
|
25
27
|
"engines": {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import { copyFileSync, readFileSync } from 'node:fs'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
|
|
6
|
+
const repositoryRoot = fileURLToPath(new URL('../', import.meta.url))
|
|
7
|
+
const packagedSkill = path.join(repositoryRoot, 'agent-plugin/skills/mobile-debug-mcp/SKILL.md')
|
|
8
|
+
const sourceSkill = path.join(repositoryRoot, 'skills/mobile-debug-tools-usage/SKILL.md')
|
|
9
|
+
const packagedLicense = path.join(repositoryRoot, 'agent-plugin/LICENSE')
|
|
10
|
+
const sourceLicense = path.join(repositoryRoot, 'LICENSE')
|
|
11
|
+
const packageInfo = JSON.parse(readFileSync(path.join(repositoryRoot, 'package.json'), 'utf8'))
|
|
12
|
+
const plugin = JSON.parse(readFileSync(path.join(repositoryRoot, 'agent-plugin/plugin.json'), 'utf8'))
|
|
13
|
+
const mcp = JSON.parse(readFileSync(path.join(repositoryRoot, 'agent-plugin/mcp.json'), 'utf8'))
|
|
14
|
+
|
|
15
|
+
if (process.argv[2] === '--sync') {
|
|
16
|
+
copyFileSync(sourceSkill, packagedSkill)
|
|
17
|
+
copyFileSync(sourceLicense, packagedLicense)
|
|
18
|
+
}
|
|
19
|
+
else if (process.argv[2] !== '--check') throw new Error('Use --sync or --check')
|
|
20
|
+
|
|
21
|
+
assert.equal(plugin.$schema, 'https://agent-plugins.org/schemas/1.0.0/plugin.schema.json')
|
|
22
|
+
assert.equal(plugin.name, 'mobile-debug-tools')
|
|
23
|
+
assert.match(plugin.version, /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/, 'plugin releases use an independent semantic version')
|
|
24
|
+
assert.equal(mcp.$schema, 'https://agent-plugins.org/schemas/1.0.0/mcp.schema.json')
|
|
25
|
+
const servers = Object.entries(mcp.mcpServers)
|
|
26
|
+
assert.equal(servers.length, 1, 'the plugin should expose only this MCP server')
|
|
27
|
+
const [serverName, server] = servers[0]
|
|
28
|
+
assert.equal(serverName, packageInfo.name)
|
|
29
|
+
assert.equal(server.type, 'stdio')
|
|
30
|
+
assert.equal(server.command, 'npx')
|
|
31
|
+
assert.deepEqual(server.args, ['--yes', `${packageInfo.name}@${packageInfo.version}`, 'server'])
|
|
32
|
+
assert.equal(server.cwd, '${PLUGIN_DATA}', 'npx must run outside the same-named source checkout')
|
|
33
|
+
assert.deepEqual(readFileSync(packagedSkill), readFileSync(sourceSkill), 'packaged usage skill must match its source')
|
|
34
|
+
assert.deepEqual(readFileSync(packagedLicense), readFileSync(sourceLicense), 'packaged license must match its source')
|
|
35
|
+
const skillName = readFileSync(packagedSkill, 'utf8').match(/^---\r?\nname: ([a-z0-9-]+)\r?\n/)?.[1]
|
|
36
|
+
assert.equal(skillName, path.basename(path.dirname(packagedSkill)), 'packaged skill directory must match its frontmatter name')
|
|
37
|
+
|
|
38
|
+
console.log('Agent plugin package is in sync')
|