mcp-android-emulator 1.4.0 → 2.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,97 @@
1
+ # Changelog
2
+
3
+ ## 2.0.0 — 2026-04-19
4
+
5
+ ### Security (breaking)
6
+
7
+ - **Eliminated command injection across the MCP tool surface.** Issue #1
8
+ reported an injection vector in `launch_app`; the underlying anti-pattern
9
+ affected every tool that interpolated LLM-controlled input into a template
10
+ string passed to `child_process.exec`. This release rebuilds the ADB
11
+ execution layer from scratch and validates every LLM input before it
12
+ reaches the device shell.
13
+
14
+ ### Changed
15
+
16
+ - New module `src/adb/runner.ts` — wraps `child_process.execFile` (not `exec`),
17
+ so arguments are never re-parsed by `/bin/sh` on the host regardless of
18
+ their contents.
19
+ - New module `src/adb/validators.ts` — strict zod validation for every
20
+ LLM-controlled input: Android package names (regex), APK paths, resource-ids,
21
+ typeable text (shell-metachar deny-list), search filters, coordinates,
22
+ and durations.
23
+ - `list_packages` and `get_logs` no longer use shell pipes. Filtering is
24
+ applied in JavaScript after collecting the full output from `adb shell`.
25
+ - `type_text` and `set_text` reject shell metacharacters
26
+ (`; & | \` $ ( ) < > \\ " '` and control chars). **Unicode is
27
+ supported** via internal URL-encoding (`niño` → `ni%C3%B1o`), which
28
+ Android's `input text` decodes natively. This avoids the known NPE
29
+ crash when `input text` receives raw UTF-8 bytes.
30
+ - `set_clipboard` now transfers the text with `adb push` (binary transfer,
31
+ no shell involvement). Full Unicode support including emoji and CJK.
32
+ - Dependencies are now pinned to exact versions (`npm audit` → 0
33
+ vulnerabilities).
34
+ - Version bumped to **2.0.0** — some inputs previously accepted are now
35
+ rejected by the stricter validation. Consumers relying on shell
36
+ metacharacters in text must update their calls.
37
+
38
+ ### Added
39
+
40
+ - `test/validators.test.ts` — covers positive and negative cases for
41
+ every allowlist, including shell-metachar payloads.
42
+ - `test/runner.test.ts` — empirically verifies that `execFile` does not
43
+ reinterpret metacharacters on the host (Linux/macOS; skipped on Windows
44
+ because `execFile` requires `shell:true` to run `.cmd` scripts, which
45
+ defeats the purpose of the test there).
46
+ - `SECURITY.md` — responsible disclosure policy.
47
+
48
+ ### Migration notes
49
+
50
+ - If your automation passed package names or paths with characters outside
51
+ the Android spec (`^[a-zA-Z_][a-zA-Z0-9_]*(\.[a-zA-Z_][a-zA-Z0-9_]*)+$`
52
+ for packages, `.apk` extension and no shell metacharacters for paths),
53
+ those calls will now fail validation. Update them to the canonical form.
54
+ - `type_text` / `set_text`: Unicode (acentos, ñ, emoji, CJK) is fully
55
+ supported. Shell metacharacters (`; & | \` $ ( ) < > \\ " '`) and
56
+ control characters are rejected — if you had them in test inputs, they
57
+ will now return a validation error.
58
+
59
+ ## 1.4.0
60
+
61
+ - **New tools:**
62
+ - `get_clickable_elements` - Get all clickable elements with text, resource-id, class, and coordinates. Useful when `tap_text` fails to find an element.
63
+
64
+ ## 1.3.0
65
+
66
+ - **New tools:**
67
+ - `get_all_text` - Get all visible text elements on screen (useful for debugging)
68
+ - `is_keyboard_visible` - Check if soft keyboard is currently visible
69
+ - `get_focused_input_value` - Get current text value of focused input field
70
+ - **Improvements:**
71
+ - `wait_for_ui_stable` - Now uses UI fingerprint instead of raw XML comparison (more reliable)
72
+ - `get_current_activity` - Multi-method approach for compatibility with different emulators (AVD, Redroid, Genymotion, etc.)
73
+ - `is_keyboard_visible` - Multiple detection methods with fallbacks
74
+
75
+ ## 1.2.3
76
+
77
+ - Updated documentation with comprehensive setup guides
78
+ - Added emulator comparison (AVD, Redroid, Genymotion, Physical)
79
+ - Added cloud/VPS deployment instructions
80
+ - Added troubleshooting section
81
+
82
+ ## 1.2.2
83
+
84
+ - Fixed `set_clipboard` and `get_clipboard` for Redroid/Docker compatibility
85
+ - Uses `/data/local/tmp` as fallback path
86
+
87
+ ## 1.2.0
88
+
89
+ - Added 14 new tools: `get_screen_size`, `is_element_visible`, `get_element_bounds`, `scroll_to_text`, `wait_for_ui_stable`, `wait_for_element_gone`, `multi_tap`, `pinch_zoom`, `tap_safe`, `tap_element`, `set_clipboard`, `get_clipboard`, `rotate_device`, `get_focused_element`, `assert_screen_contains`.
90
+
91
+ ## 1.1.0
92
+
93
+ - Added `double_tap`, `drag`, `set_text`, `select_all`, `clear_input`.
94
+
95
+ ## 1.0.0
96
+
97
+ - Initial release with core functionality.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.