mcp-maestro-mobile-ai 1.3.0 → 1.4.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 +244 -143
- package/ROADMAP.md +21 -8
- package/package.json +6 -3
- package/src/mcp-server/index.js +1059 -816
- package/src/mcp-server/schemas/toolSchemas.js +636 -0
- package/src/mcp-server/utils/maestro.js +265 -29
- package/src/mcp-server/utils/security.js +1200 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,143 +1,244 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [Unreleased]
|
|
9
|
-
|
|
10
|
-
### Planned
|
|
11
|
-
|
|
12
|
-
- JUnit XML report generation
|
|
13
|
-
- CI headless mode
|
|
14
|
-
- iOS support
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- **
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- `
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- `
|
|
63
|
-
- `
|
|
64
|
-
- `
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
-
|
|
76
|
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
- Pre-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Planned
|
|
11
|
+
|
|
12
|
+
- JUnit XML report generation
|
|
13
|
+
- CI headless mode (`--ci` flag)
|
|
14
|
+
- iOS support
|
|
15
|
+
- TypeScript migration
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## [1.4.0] - 2025-01-07
|
|
20
|
+
|
|
21
|
+
### Security
|
|
22
|
+
|
|
23
|
+
- **Safe Mode (v1.1.0 Roadmap)**: Enterprise-grade security boundaries now implemented
|
|
24
|
+
|
|
25
|
+
- Safe Mode enabled by default (`SAFE_MODE=true`)
|
|
26
|
+
- Blocks potentially destructive operations (install/uninstall apps, clear data)
|
|
27
|
+
- Set `SAFE_MODE=false` to enable full mode (use with caution)
|
|
28
|
+
|
|
29
|
+
- **Command Allowlists**: Strict validation of all CLI commands
|
|
30
|
+
|
|
31
|
+
- Maestro commands restricted to: `test`, `validate`, `screenshot`, `--version`, `hierarchy`
|
|
32
|
+
- ADB commands categorized into Safe Mode and Full Mode allowlists
|
|
33
|
+
- 40+ dangerous ADB commands permanently blocked (rm, root, reboot, settings, etc.)
|
|
34
|
+
|
|
35
|
+
- **Blocked Pattern Detection**: Prevents injection attacks
|
|
36
|
+
|
|
37
|
+
- Shell injection: `; & | && ||`
|
|
38
|
+
- Command substitution: `` `cmd` ``, `$(cmd)`
|
|
39
|
+
- Path traversal: `../`
|
|
40
|
+
- Environment variable expansion: `${VAR}`, `$HOME`
|
|
41
|
+
- Null byte injection: `\x00`, `%00`
|
|
42
|
+
- Script injection: `<script>`, `javascript:`
|
|
43
|
+
|
|
44
|
+
- **Input Validation with Zod**: All 30 MCP tools now have strict input validation
|
|
45
|
+
|
|
46
|
+
- App ID format validation (`com.example.app`)
|
|
47
|
+
- Device ID format validation
|
|
48
|
+
- File path security (no traversal)
|
|
49
|
+
- YAML content security checks
|
|
50
|
+
- String length limits and type checking
|
|
51
|
+
|
|
52
|
+
- **Security Audit Logging**: Comprehensive event logging for compliance
|
|
53
|
+
- `TOOL_EXECUTION_START/SUCCESS/ERROR` events
|
|
54
|
+
- `TOOL_VALIDATION_FAILED` for rejected inputs
|
|
55
|
+
- `TOOL_SECURITY_ERROR` for security violations
|
|
56
|
+
- `SERVER_STARTED` with security config summary
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
|
|
60
|
+
- **New Security Module**: `src/mcp-server/utils/security.js`
|
|
61
|
+
|
|
62
|
+
- `SecurityError` class with error codes
|
|
63
|
+
- `isSafeModeEnabled()`, `getSecurityMode()`, `getSecurityConfig()`
|
|
64
|
+
- `validateAppId()`, `validateDeviceId()`, `sanitizeInput()`
|
|
65
|
+
- `isMaestroCommandAllowed()`, `isAdbCommandAllowed()`
|
|
66
|
+
- `containsBlockedPattern()`, `assertNoBlockedPatterns()`
|
|
67
|
+
- `checkYamlSecurity()` for YAML content validation
|
|
68
|
+
- `logSecurityEvent()` for audit trail
|
|
69
|
+
|
|
70
|
+
- **Zod Schema Validation**: `src/mcp-server/schemas/toolSchemas.js`
|
|
71
|
+
|
|
72
|
+
- Individual schemas for all 30 MCP tools
|
|
73
|
+
- Reusable schema components (`safeFilePath`, `appIdSchema`, etc.)
|
|
74
|
+
- `validateToolInput()` utility function
|
|
75
|
+
- `toolSchemas` registry for easy lookup
|
|
76
|
+
|
|
77
|
+
- **Validation Middleware**: Integrated into main request handler
|
|
78
|
+
- All tool inputs validated before execution
|
|
79
|
+
- Clear error messages with field-level details
|
|
80
|
+
- Security error handling with proper response format
|
|
81
|
+
|
|
82
|
+
### Changed
|
|
83
|
+
|
|
84
|
+
- **Server Version**: Updated to v1.4.0
|
|
85
|
+
- **Startup Logging**: Now displays security configuration summary
|
|
86
|
+
- **Error Responses**: Enhanced with validation details and security codes
|
|
87
|
+
- **Command Execution**: All Maestro/ADB commands validated against allowlists
|
|
88
|
+
|
|
89
|
+
### Environment Variables
|
|
90
|
+
|
|
91
|
+
- `SAFE_MODE` - Enable/disable Safe Mode (default: `true`)
|
|
92
|
+
- `LOG_SECURITY_EVENTS` - Enable security event logging (default: `true`)
|
|
93
|
+
- `MAESTRO_DEVICE` - Pre-select a specific device for testing
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## [1.3.1] - 2025-01-06
|
|
98
|
+
|
|
99
|
+
### Fixed
|
|
100
|
+
|
|
101
|
+
- **MCP Schema Fix**: Fixed `generate_report` tool array parameter missing `items` definition
|
|
102
|
+
- This was causing "tool parameters array type must have items" validation error
|
|
103
|
+
- Now properly defines the structure of test result objects
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## [1.2.0] - 2025-01-06
|
|
108
|
+
|
|
109
|
+
### Added
|
|
110
|
+
|
|
111
|
+
- **YAML Generation Instructions System**: Ensures consistent YAML generation across different environments
|
|
112
|
+
- `get_yaml_instructions` - AI MUST call this before generating YAML (provides exact rules)
|
|
113
|
+
- `validate_yaml_structure` - Validates YAML for common issues (like missing tapOn before inputText)
|
|
114
|
+
- `get_test_pattern` - Get standard patterns for login, search, navigation, form tests
|
|
115
|
+
- **Critical Fix**: Input text pattern now enforced - prevents password going to username field issue
|
|
116
|
+
- Standard test patterns for common scenarios (login, search, navigation, form)
|
|
117
|
+
|
|
118
|
+
### Fixed
|
|
119
|
+
|
|
120
|
+
- YAML generation inconsistency between different environments
|
|
121
|
+
- Text input going to wrong fields due to missing tapOn commands
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## [1.1.1] - 2025-01-06
|
|
126
|
+
|
|
127
|
+
### Fixed
|
|
128
|
+
|
|
129
|
+
- Version bump for npm publish
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## [1.1.0] - 2025-01-06
|
|
134
|
+
|
|
135
|
+
### Changed
|
|
136
|
+
|
|
137
|
+
- **Package Renamed**: Changed from `@krunal.mahera/maestro-mcp` to `mcp-maestro-mobile-ai` for easier configuration
|
|
138
|
+
- **YAML Storage**: Temp YAML files now stored in hidden system directory (`~/.maestro-mcp/`) instead of project folder
|
|
139
|
+
- Test results and screenshots now stored in `~/.maestro-mcp/output/`
|
|
140
|
+
|
|
141
|
+
### Added
|
|
142
|
+
|
|
143
|
+
- **Automatic Prerequisites Check**:
|
|
144
|
+
- Runs automatically after `npm install`
|
|
145
|
+
- Checks for Node.js 18+, Java 17+, Maestro CLI, Android SDK
|
|
146
|
+
- Shows clear error messages with installation hints
|
|
147
|
+
- Manual check available via `npm run check`
|
|
148
|
+
- **Runtime Validation**: Server validates prerequisites on startup and exits gracefully if critical deps missing
|
|
149
|
+
- **App Context Training System**: New tools to teach the AI about your app's UI
|
|
150
|
+
- `register_elements` - Register testIDs, accessibilityLabels for app elements
|
|
151
|
+
- `register_screen` - Define screen structures and available actions
|
|
152
|
+
- `save_successful_flow` - Save working test patterns for AI reference
|
|
153
|
+
- `get_saved_flows` - Retrieve saved flow patterns
|
|
154
|
+
- `delete_flow` - Remove saved patterns
|
|
155
|
+
- `get_ai_context` - Get formatted context for AI (call before generating tests!)
|
|
156
|
+
- `get_full_context` - Get complete raw context data
|
|
157
|
+
- `clear_app_context` - Clear all context for an app
|
|
158
|
+
- `list_app_contexts` - List all apps with saved context
|
|
159
|
+
|
|
160
|
+
### Improved
|
|
161
|
+
|
|
162
|
+
- AI test generation accuracy when context is provided
|
|
163
|
+
- Cleaner project directory (no temp files visible)
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## [1.0.0] - 2025-01-05
|
|
168
|
+
|
|
169
|
+
### Added
|
|
170
|
+
|
|
171
|
+
- Initial public release on npm as `mcp-maestro-mobile-ai`
|
|
172
|
+
- MCP server implementation with stdio transport
|
|
173
|
+
- 14 MCP tools for mobile test automation:
|
|
174
|
+
- `read_prompt_file` - Read test prompts from files
|
|
175
|
+
- `list_prompt_files` - List available prompt files
|
|
176
|
+
- `list_devices` - List connected Android devices
|
|
177
|
+
- `select_device` - Select specific device for testing
|
|
178
|
+
- `clear_device` - Clear device selection
|
|
179
|
+
- `check_device` - Verify device connection
|
|
180
|
+
- `check_app` - Verify app installation
|
|
181
|
+
- `get_app_config` - Get server configuration
|
|
182
|
+
- `validate_maestro_yaml` - Validate YAML syntax
|
|
183
|
+
- `run_test` - Execute single test
|
|
184
|
+
- `run_test_suite` - Execute multiple tests
|
|
185
|
+
- `get_test_results` - Retrieve test results
|
|
186
|
+
- `take_screenshot` - Capture device screen
|
|
187
|
+
- `cleanup_results` - Clean up old results
|
|
188
|
+
- Automatic retry mechanism for failed tests
|
|
189
|
+
- Pre-flight checks (device, app) before test execution
|
|
190
|
+
- Screenshot capture on test failure
|
|
191
|
+
- Auto-cleanup of old results based on `MAX_RESULTS`
|
|
192
|
+
- Improved error messages with hints
|
|
193
|
+
- Support for physical devices via USB
|
|
194
|
+
- Device selection for multi-device environments
|
|
195
|
+
- Winston-based logging
|
|
196
|
+
- Environment variable configuration
|
|
197
|
+
- Example prompt files
|
|
198
|
+
|
|
199
|
+
### Documentation
|
|
200
|
+
|
|
201
|
+
- Comprehensive README with setup guides
|
|
202
|
+
- MCP client configuration examples (Cursor, VS Code, Claude Desktop)
|
|
203
|
+
- Template configuration files
|
|
204
|
+
- React Native automation guidelines
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## [0.1.0] - 2025-01-01
|
|
209
|
+
|
|
210
|
+
### Added
|
|
211
|
+
|
|
212
|
+
- Initial proof of concept
|
|
213
|
+
- Basic Maestro CLI integration
|
|
214
|
+
- Simple test execution
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Release Notes Format
|
|
219
|
+
|
|
220
|
+
### Version Numbering
|
|
221
|
+
|
|
222
|
+
- **MAJOR** (X.0.0): Breaking API changes
|
|
223
|
+
- **MINOR** (0.X.0): New features, backward compatible
|
|
224
|
+
- **PATCH** (0.0.X): Bug fixes, backward compatible
|
|
225
|
+
|
|
226
|
+
### Change Categories
|
|
227
|
+
|
|
228
|
+
- **Added**: New features
|
|
229
|
+
- **Changed**: Changes in existing functionality
|
|
230
|
+
- **Deprecated**: Features to be removed in future
|
|
231
|
+
- **Removed**: Removed features
|
|
232
|
+
- **Fixed**: Bug fixes
|
|
233
|
+
- **Security**: Security-related changes
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
[Unreleased]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/compare/v1.4.0...HEAD
|
|
238
|
+
[1.4.0]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v1.4.0
|
|
239
|
+
[1.3.1]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v1.3.1
|
|
240
|
+
[1.2.0]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v1.2.0
|
|
241
|
+
[1.1.1]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v1.1.1
|
|
242
|
+
[1.1.0]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v1.1.0
|
|
243
|
+
[1.0.0]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v1.0.0
|
|
244
|
+
[0.1.0]: https://github.com/krunal-mahera/mcp-maestro-mobile-ai/releases/tag/v0.1.0
|
package/ROADMAP.md
CHANGED
|
@@ -37,16 +37,18 @@ Transform how teams approach mobile testing by enabling:
|
|
|
37
37
|
|
|
38
38
|
**Theme**: Enterprise Trust & Automation
|
|
39
39
|
|
|
40
|
-
### v1.
|
|
40
|
+
### v1.4.0 - Security Boundaries ✅ RELEASED
|
|
41
41
|
|
|
42
42
|
| Feature | Priority | Status |
|
|
43
43
|
|---------|----------|--------|
|
|
44
|
-
| Safe Mode (default ON) | 🔴 Critical |
|
|
45
|
-
| Command allowlist | 🔴 Critical |
|
|
46
|
-
| Blocked operations list | 🔴 Critical |
|
|
47
|
-
| Input validation (Zod schemas) | 🟠 High |
|
|
44
|
+
| Safe Mode (default ON) | 🔴 Critical | ✅ Done |
|
|
45
|
+
| Command allowlist | 🔴 Critical | ✅ Done |
|
|
46
|
+
| Blocked operations list | 🔴 Critical | ✅ Done |
|
|
47
|
+
| Input validation (Zod schemas) | 🟠 High | ✅ Done |
|
|
48
|
+
| Security audit logging | 🟠 High | ✅ Done |
|
|
49
|
+
| Pattern detection (injection prevention) | 🟠 High | ✅ Done |
|
|
48
50
|
|
|
49
|
-
### v1.
|
|
51
|
+
### v1.5.0 - CI/CD Mode
|
|
50
52
|
|
|
51
53
|
| Feature | Priority | Status |
|
|
52
54
|
|---------|----------|--------|
|
|
@@ -55,11 +57,11 @@ Transform how teams approach mobile testing by enabling:
|
|
|
55
57
|
| `--prompt-file` direct execution | 🟠 High | 🔲 Planned |
|
|
56
58
|
| JUnit XML output | 🟠 High | 🔲 Planned |
|
|
57
59
|
|
|
58
|
-
### v1.
|
|
60
|
+
### v1.6.0 - Audit & Observability
|
|
59
61
|
|
|
60
62
|
| Feature | Priority | Status |
|
|
61
63
|
|---------|----------|--------|
|
|
62
|
-
| Enhanced audit trail | 🟠 High |
|
|
64
|
+
| Enhanced audit trail | 🟠 High | ⚠️ Partial (security events) |
|
|
63
65
|
| YAML preservation | 🟠 High | 🔲 Planned |
|
|
64
66
|
| Structured logging (JSON) | 🟡 Medium | 🔲 Planned |
|
|
65
67
|
| Health check tool | 🟡 Medium | 🔲 Planned |
|
|
@@ -212,6 +214,17 @@ Transform how teams approach mobile testing by enabling:
|
|
|
212
214
|
|
|
213
215
|
## Completed Milestones
|
|
214
216
|
|
|
217
|
+
### ✅ v1.4.0 - Security Boundaries (January 2025)
|
|
218
|
+
|
|
219
|
+
- [x] Safe Mode (default ON) - blocks destructive operations
|
|
220
|
+
- [x] Command allowlists for Maestro and ADB
|
|
221
|
+
- [x] 40+ blocked dangerous commands
|
|
222
|
+
- [x] Pattern detection (shell injection, path traversal, etc.)
|
|
223
|
+
- [x] Input validation with Zod schemas for all 30 tools
|
|
224
|
+
- [x] Security audit logging
|
|
225
|
+
- [x] SecurityError class with error codes
|
|
226
|
+
- [x] Validation middleware in request handler
|
|
227
|
+
|
|
215
228
|
### ✅ v1.0.0 - Foundation (January 2025)
|
|
216
229
|
|
|
217
230
|
- [x] MCP server implementation
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-maestro-mobile-ai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "MCP Server for AI-Assisted Mobile Automation using Maestro - Run mobile tests with natural language prompts",
|
|
5
|
+
"description": "MCP Server for AI-Assisted Mobile Automation using Maestro - Run mobile tests with natural language prompts. Features enterprise-grade security with Safe Mode and input validation.",
|
|
6
6
|
"main": "src/mcp-server/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
@@ -51,7 +51,10 @@
|
|
|
51
51
|
"cursor",
|
|
52
52
|
"testing",
|
|
53
53
|
"automation",
|
|
54
|
-
"ai"
|
|
54
|
+
"ai",
|
|
55
|
+
"security",
|
|
56
|
+
"validation",
|
|
57
|
+
"zod"
|
|
55
58
|
],
|
|
56
59
|
"author": "Krunal Mahera <krunal.mahera@gmail.com>",
|
|
57
60
|
"license": "MIT",
|