mcp-maestro-mobile-ai 1.1.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 +114 -0
- package/CONTRIBUTING.md +417 -0
- package/LICENSE +22 -0
- package/README.md +719 -0
- package/ROADMAP.md +239 -0
- package/docs/ENTERPRISE_READINESS.md +545 -0
- package/docs/MCP_SETUP.md +180 -0
- package/docs/PRIVACY.md +198 -0
- package/docs/REACT_NATIVE_AUTOMATION_GUIDELINES.md +584 -0
- package/docs/SECURITY.md +573 -0
- package/package.json +69 -0
- package/prompts/example-login-tests.txt +9 -0
- package/prompts/example-youtube-tests.txt +8 -0
- package/src/mcp-server/index.js +625 -0
- package/src/mcp-server/tools/contextTools.js +194 -0
- package/src/mcp-server/tools/promptTools.js +191 -0
- package/src/mcp-server/tools/runTools.js +357 -0
- package/src/mcp-server/tools/utilityTools.js +721 -0
- package/src/mcp-server/tools/validateTools.js +220 -0
- package/src/mcp-server/utils/appContext.js +295 -0
- package/src/mcp-server/utils/logger.js +52 -0
- package/src/mcp-server/utils/maestro.js +508 -0
- package/templates/mcp-config-claude-desktop.json +15 -0
- package/templates/mcp-config-cursor.json +15 -0
- package/templates/mcp-config-vscode.json +13 -0
package/README.md
ADDED
|
@@ -0,0 +1,719 @@
|
|
|
1
|
+
# MCP Maestro Mobile AI
|
|
2
|
+
|
|
3
|
+
## AI-Assisted Mobile Automation using Model Context Protocol
|
|
4
|
+
|
|
5
|
+
An MCP (Model Context Protocol) server that enables AI assistants like **Claude**, **Copilot**, and other LLMs to run mobile automation tests using **Maestro**. Features **app context training** for improved test generation accuracy.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/mcp-maestro-mobile-ai)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 📚 Documentation
|
|
13
|
+
|
|
14
|
+
| Document | Description |
|
|
15
|
+
|----------|-------------|
|
|
16
|
+
| [Enterprise Readiness](./docs/ENTERPRISE_READINESS.md) | Architecture, security model, compliance |
|
|
17
|
+
| [Security Model](./docs/SECURITY.md) | Execution boundaries, threat model, best practices |
|
|
18
|
+
| [Privacy Policy](./docs/PRIVACY.md) | Data handling, no telemetry statement |
|
|
19
|
+
| [Changelog](./CHANGELOG.md) | Version history, release notes |
|
|
20
|
+
| [Roadmap](./ROADMAP.md) | Future plans, feature timeline |
|
|
21
|
+
| [Contributing](./CONTRIBUTING.md) | How to contribute |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 🎯 What This Does
|
|
26
|
+
|
|
27
|
+
**Testers write simple prompts → AI generates and runs tests automatically**
|
|
28
|
+
|
|
29
|
+
```txt
|
|
30
|
+
# prompts/my-tests.txt
|
|
31
|
+
Test that user can login with valid credentials
|
|
32
|
+
Test that search shows results for "TechGuru"
|
|
33
|
+
Test that user can logout successfully
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
You: "Run tests from prompts/my-tests.txt"
|
|
38
|
+
|
|
39
|
+
AI: Reading prompts... Found 3 tests.
|
|
40
|
+
[1/3] Generating login test... ✅ PASSED
|
|
41
|
+
[2/3] Generating search test... ✅ PASSED
|
|
42
|
+
[3/3] Generating logout test... ❌ FAILED
|
|
43
|
+
|
|
44
|
+
Results: 2 passed, 1 failed
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🚀 Installation Options
|
|
50
|
+
|
|
51
|
+
### Prerequisites (Required for all methods)
|
|
52
|
+
|
|
53
|
+
- **Node.js 18+**
|
|
54
|
+
- **Java 17+** (for Maestro)
|
|
55
|
+
- **Maestro CLI** installed ([Installation Guide](https://maestro.mobile.dev/getting-started/installing-maestro))
|
|
56
|
+
- **Android Emulator** or physical device connected via USB
|
|
57
|
+
- **Cursor**, **Claude Desktop**, or **VS Code with GitHub Copilot**
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### 📦 Option 1: NPX (Zero Install - Recommended)
|
|
62
|
+
|
|
63
|
+
Run directly without installing:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx mcp-maestro-mobile-ai
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Then configure your AI client (see [MCP Configuration](#️-mcp-configuration) below).
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### 📦 Option 2: Global Install via NPM
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Install globally
|
|
77
|
+
npm install -g mcp-maestro-mobile-ai
|
|
78
|
+
|
|
79
|
+
# Run the server
|
|
80
|
+
maestro-mcp
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### 📦 Option 3: Clone from GitHub
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 1. Clone the repository
|
|
89
|
+
git clone https://github.com/krunal-mahera/mcp-maestro-mobile-ai.git
|
|
90
|
+
cd mcp-maestro-mobile-ai
|
|
91
|
+
|
|
92
|
+
# 2. Install dependencies
|
|
93
|
+
npm install
|
|
94
|
+
|
|
95
|
+
# 3. Run the server
|
|
96
|
+
npm start
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## ⚙️ MCP Configuration
|
|
102
|
+
|
|
103
|
+
Configure your AI client to use the Maestro MCP server.
|
|
104
|
+
|
|
105
|
+
### 🔧 Cursor Setup
|
|
106
|
+
|
|
107
|
+
#### Step 1: Locate Config File
|
|
108
|
+
|
|
109
|
+
| OS | Config File Location |
|
|
110
|
+
| ----------- | -------------------------------- |
|
|
111
|
+
| **Windows** | `%USERPROFILE%\.cursor\mcp.json` |
|
|
112
|
+
| **macOS** | `~/.cursor/mcp.json` |
|
|
113
|
+
| **Linux** | `~/.cursor/mcp.json` |
|
|
114
|
+
|
|
115
|
+
#### Step 2: Add Configuration
|
|
116
|
+
|
|
117
|
+
**If installed via NPM (global):**
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"mcpServers": {
|
|
122
|
+
"maestro": {
|
|
123
|
+
"command": "maestro-mcp",
|
|
124
|
+
"env": {
|
|
125
|
+
"APP_ID": "com.your.app.package"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**If using NPX (no install):**
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"maestro": {
|
|
138
|
+
"command": "npx",
|
|
139
|
+
"args": ["mcp-maestro-mobile-ai"],
|
|
140
|
+
"env": {
|
|
141
|
+
"APP_ID": "com.your.app.package"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**If cloned from GitHub:**
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"mcpServers": {
|
|
153
|
+
"maestro": {
|
|
154
|
+
"command": "node",
|
|
155
|
+
"args": ["/path/to/mcp-maestro-mobile-ai/src/mcp-server/index.js"],
|
|
156
|
+
"env": {
|
|
157
|
+
"APP_ID": "com.your.app.package"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Step 3: Restart Cursor
|
|
165
|
+
|
|
166
|
+
Close and reopen Cursor completely for the changes to take effect.
|
|
167
|
+
|
|
168
|
+
#### Step 4: Verify
|
|
169
|
+
|
|
170
|
+
In Cursor's AI chat, type:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
List the available MCP tools for maestro
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### 🔧 Claude Desktop Setup
|
|
179
|
+
|
|
180
|
+
Edit `~/.claude/claude_desktop_config.json` (macOS/Linux) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
181
|
+
|
|
182
|
+
```json
|
|
183
|
+
{
|
|
184
|
+
"mcpServers": {
|
|
185
|
+
"maestro": {
|
|
186
|
+
"command": "npx",
|
|
187
|
+
"args": ["mcp-maestro-mobile-ai"],
|
|
188
|
+
"env": {
|
|
189
|
+
"APP_ID": "com.your.app.package"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### 🔧 VS Code with GitHub Copilot
|
|
199
|
+
|
|
200
|
+
Add to VS Code settings (Ctrl+Shift+P → "Preferences: Open User Settings (JSON)"):
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"github.copilot.chat.mcpServers": {
|
|
205
|
+
"maestro": {
|
|
206
|
+
"command": "npx",
|
|
207
|
+
"args": ["mcp-maestro-mobile-ai"],
|
|
208
|
+
"env": {
|
|
209
|
+
"APP_ID": "com.your.app.package"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
> 📝 **Note:** GitHub Copilot MCP support may vary by version.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## ✅ Verify Your Setup
|
|
221
|
+
|
|
222
|
+
### Test 1: Check Configuration
|
|
223
|
+
|
|
224
|
+
Ask the AI:
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
Get the maestro app configuration
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Expected response:
|
|
231
|
+
|
|
232
|
+
```json
|
|
233
|
+
{
|
|
234
|
+
"success": true,
|
|
235
|
+
"config": {
|
|
236
|
+
"appId": "com.google.android.youtube",
|
|
237
|
+
"platform": "android"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Test 2: List Prompt Files
|
|
243
|
+
|
|
244
|
+
Ask the AI:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
List available prompt files in the maestro server
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Test 3: Run a Simple Test
|
|
251
|
+
|
|
252
|
+
Make sure your Android emulator is running, then ask:
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
Run a test: Open YouTube and search for TechGuru
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 📝 Usage Guide
|
|
261
|
+
|
|
262
|
+
### For Testers - Creating Test Prompts
|
|
263
|
+
|
|
264
|
+
1. **Create a prompt file** in the `prompts/` folder:
|
|
265
|
+
|
|
266
|
+
```txt
|
|
267
|
+
# prompts/my-app-tests.txt
|
|
268
|
+
|
|
269
|
+
# Login Tests
|
|
270
|
+
Test that user can login with valid email and password
|
|
271
|
+
Test that login fails with incorrect password
|
|
272
|
+
Test that forgot password link works
|
|
273
|
+
|
|
274
|
+
# Dashboard Tests
|
|
275
|
+
Test that dashboard shows user name after login
|
|
276
|
+
Test that notifications icon is visible
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
2. **Ask the AI to run**:
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
Run tests from prompts/my-app-tests.txt
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
3. **AI handles everything**:
|
|
286
|
+
- ✅ Reads prompts
|
|
287
|
+
- ✅ Generates Maestro YAML
|
|
288
|
+
- ✅ Validates YAML
|
|
289
|
+
- ✅ Runs tests on emulator
|
|
290
|
+
- ✅ Reports results
|
|
291
|
+
|
|
292
|
+
### 🧠 App Context Training (NEW!)
|
|
293
|
+
|
|
294
|
+
The AI might not know your app's exact UI elements. **Train it** by registering your app's elements for much better test generation:
|
|
295
|
+
|
|
296
|
+
**Step 1: Register UI Elements**
|
|
297
|
+
|
|
298
|
+
Tell the AI:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
Register these elements for app "com.myapp":
|
|
302
|
+
{
|
|
303
|
+
"usernameInput": {
|
|
304
|
+
"testId": "login-username-input",
|
|
305
|
+
"accessibilityLabel": "Username",
|
|
306
|
+
"type": "textfield"
|
|
307
|
+
},
|
|
308
|
+
"passwordInput": {
|
|
309
|
+
"testId": "login-password-input",
|
|
310
|
+
"accessibilityLabel": "Password",
|
|
311
|
+
"type": "textfield"
|
|
312
|
+
},
|
|
313
|
+
"loginButton": {
|
|
314
|
+
"testId": "login-submit-btn",
|
|
315
|
+
"text": "Sign In",
|
|
316
|
+
"type": "button"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Step 2: Register Screens (Optional)**
|
|
322
|
+
|
|
323
|
+
```
|
|
324
|
+
Register screen "LoginScreen" for app "com.myapp" with:
|
|
325
|
+
- description: "Main login screen with email and password"
|
|
326
|
+
- elements: ["usernameInput", "passwordInput", "loginButton"]
|
|
327
|
+
- actions: ["login", "forgotPassword", "signUp"]
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Step 3: Save Successful Flows**
|
|
331
|
+
|
|
332
|
+
After a test passes, save it as a pattern:
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
Save this successful flow for "com.myapp" as "login-flow"
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
The AI will use this pattern for similar tests in the future!
|
|
339
|
+
|
|
340
|
+
**Step 4: Get Context Before Tests**
|
|
341
|
+
|
|
342
|
+
Always get context before generating tests:
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
Get AI context for app "com.myapp", then run a login test
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
This gives the AI all the element names and patterns it needs.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
### Tips for Writing Good Prompts
|
|
353
|
+
|
|
354
|
+
✅ **Good prompts:**
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
Test that user can login with valid email "test@example.com" and password "Test123"
|
|
358
|
+
Test that search results show products matching "shoes"
|
|
359
|
+
Test that error message appears when password is less than 6 characters
|
|
360
|
+
Test that user can navigate from home screen to settings
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
❌ **Bad prompts:**
|
|
364
|
+
|
|
365
|
+
```
|
|
366
|
+
Test login (too vague)
|
|
367
|
+
Click button (not a test case)
|
|
368
|
+
Check the app (unclear expectation)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## 🔧 Available MCP Tools (14 Tools)
|
|
374
|
+
|
|
375
|
+
### Prompt Tools
|
|
376
|
+
|
|
377
|
+
| Tool | Description |
|
|
378
|
+
| ------------------- | -------------------------------------- |
|
|
379
|
+
| `read_prompt_file` | Read test prompts from a .txt/.md file |
|
|
380
|
+
| `list_prompt_files` | List available prompt files |
|
|
381
|
+
|
|
382
|
+
### Device Management Tools
|
|
383
|
+
|
|
384
|
+
| Tool | Description |
|
|
385
|
+
| --------------- | --------------------------------------------- |
|
|
386
|
+
| `list_devices` | List all connected Android devices/emulators |
|
|
387
|
+
| `select_device` | Select a specific device for test execution |
|
|
388
|
+
| `clear_device` | Clear device selection (use first available) |
|
|
389
|
+
| `check_device` | Check if Android emulator/device is connected |
|
|
390
|
+
| `check_app` | Verify app is installed on device |
|
|
391
|
+
|
|
392
|
+
### Test Execution Tools
|
|
393
|
+
|
|
394
|
+
| Tool | Description |
|
|
395
|
+
| ----------------------- | ------------------------------------------- |
|
|
396
|
+
| `validate_maestro_yaml` | Validate Maestro YAML syntax |
|
|
397
|
+
| `run_test` | Run a single test (with auto-retry support) |
|
|
398
|
+
| `run_test_suite` | Run multiple tests in sequence |
|
|
399
|
+
|
|
400
|
+
### Configuration & Utility Tools
|
|
401
|
+
|
|
402
|
+
| Tool | Description |
|
|
403
|
+
| ------------------ | ---------------------------------- |
|
|
404
|
+
| `get_app_config` | Get app configuration and settings |
|
|
405
|
+
| `get_test_results` | Get results from last run |
|
|
406
|
+
| `take_screenshot` | Capture device screen |
|
|
407
|
+
| `cleanup_results` | Clean up old test results |
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## 📁 Project Structure
|
|
412
|
+
|
|
413
|
+
```
|
|
414
|
+
maestro-mcp-server/
|
|
415
|
+
├── prompts/ # ⭐ TESTERS CREATE FILES HERE
|
|
416
|
+
│ ├── example-login-tests.txt
|
|
417
|
+
│ └── example-youtube-tests.txt
|
|
418
|
+
│
|
|
419
|
+
├── src/mcp-server/ # MCP Server (don't modify)
|
|
420
|
+
│ ├── index.js
|
|
421
|
+
│ ├── tools/
|
|
422
|
+
│ └── utils/
|
|
423
|
+
│
|
|
424
|
+
├── output/ # Test outputs
|
|
425
|
+
│ ├── logs/
|
|
426
|
+
│ ├── screenshots/
|
|
427
|
+
│ └── results/
|
|
428
|
+
│
|
|
429
|
+
├── config/
|
|
430
|
+
│ └── maestro.config.yaml
|
|
431
|
+
│
|
|
432
|
+
├── docs/
|
|
433
|
+
│ ├── MCP_SETUP.md
|
|
434
|
+
│ └── REACT_NATIVE_AUTOMATION_GUIDELINES.md
|
|
435
|
+
│
|
|
436
|
+
├── mcp-config-cursor.json # Ready-to-use Cursor config
|
|
437
|
+
├── mcp-config-vscode.json # Ready-to-use VS Code config
|
|
438
|
+
├── env.example
|
|
439
|
+
├── package.json
|
|
440
|
+
└── README.md
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## ⚙️ Environment Configuration
|
|
446
|
+
|
|
447
|
+
### Required Variables
|
|
448
|
+
|
|
449
|
+
| Variable | Description | Example |
|
|
450
|
+
| -------- | --------------------------- | ---------------------------- |
|
|
451
|
+
| `APP_ID` | Package name of app to test | `com.google.android.youtube` |
|
|
452
|
+
|
|
453
|
+
### Test Execution Settings
|
|
454
|
+
|
|
455
|
+
| Variable | Description | Default |
|
|
456
|
+
| ---------------------- | --------------------------------------- | ------- |
|
|
457
|
+
| `DEFAULT_WAIT_TIMEOUT` | Default wait timeout in ms | `10000` |
|
|
458
|
+
| `DEFAULT_RETRIES` | Auto-retry count for failed tests | `1` |
|
|
459
|
+
| `MAX_RESULTS` | Max result files to keep (auto-cleanup) | `50` |
|
|
460
|
+
|
|
461
|
+
### Optional Variables
|
|
462
|
+
|
|
463
|
+
| Variable | Description | Default |
|
|
464
|
+
| --------------- | ------------------- | ---------------- |
|
|
465
|
+
| `ANDROID_HOME` | Path to Android SDK | Auto-detected |
|
|
466
|
+
| `EMULATOR_NAME` | Preferred emulator | Default emulator |
|
|
467
|
+
| `PLATFORM` | Target platform | `android` |
|
|
468
|
+
| `LOG_LEVEL` | Logging level | `info` |
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## ✨ New Features (v2.1.0)
|
|
473
|
+
|
|
474
|
+
### 🔌 Device Check
|
|
475
|
+
|
|
476
|
+
Before running tests, verify your device is connected:
|
|
477
|
+
|
|
478
|
+
```
|
|
479
|
+
Check if my device is connected
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### 📱 App Check
|
|
483
|
+
|
|
484
|
+
Verify the app is installed before testing:
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
Check if YouTube app is installed
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### 🔄 Auto-Retry
|
|
491
|
+
|
|
492
|
+
Failed tests are automatically retried based on `DEFAULT_RETRIES` setting:
|
|
493
|
+
|
|
494
|
+
- Set `DEFAULT_RETRIES=2` to retry failed tests twice
|
|
495
|
+
- Reduces flaky test failures
|
|
496
|
+
|
|
497
|
+
### 🧹 Result Cleanup
|
|
498
|
+
|
|
499
|
+
Old results are automatically cleaned up:
|
|
500
|
+
|
|
501
|
+
- Keeps last 50 results by default (configurable via `MAX_RESULTS`)
|
|
502
|
+
- Use `cleanup_results` tool for manual cleanup
|
|
503
|
+
|
|
504
|
+
### 💬 Improved Error Messages
|
|
505
|
+
|
|
506
|
+
Errors now include:
|
|
507
|
+
|
|
508
|
+
- Clear descriptions of what went wrong
|
|
509
|
+
- Hints for how to fix the issue
|
|
510
|
+
- Automatic screenshots on failure
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## 🔍 Troubleshooting
|
|
515
|
+
|
|
516
|
+
### "Tools not appearing in Cursor/VS Code"
|
|
517
|
+
|
|
518
|
+
1. Verify the path in your MCP config is correct
|
|
519
|
+
2. Restart your editor completely
|
|
520
|
+
3. Check `output/logs/mcp-server.log` for errors
|
|
521
|
+
|
|
522
|
+
### "APP_ID not configured"
|
|
523
|
+
|
|
524
|
+
Set `APP_ID` in either:
|
|
525
|
+
|
|
526
|
+
- The MCP config's `env` section, OR
|
|
527
|
+
- A `.env` file in the project root
|
|
528
|
+
|
|
529
|
+
### "No emulator connected"
|
|
530
|
+
|
|
531
|
+
1. Start Android emulator from Android Studio
|
|
532
|
+
2. Verify with: `adb devices`
|
|
533
|
+
|
|
534
|
+
### "Element not found" during test
|
|
535
|
+
|
|
536
|
+
The AI-generated selector might not match. Ask the AI to:
|
|
537
|
+
|
|
538
|
+
- Use different selectors (text-based instead of ID-based)
|
|
539
|
+
- Add more wait time with `extendedWaitUntil`
|
|
540
|
+
- Use `maestro studio` to inspect elements
|
|
541
|
+
|
|
542
|
+
### "Java version error"
|
|
543
|
+
|
|
544
|
+
Maestro requires Java 17+. Check with:
|
|
545
|
+
|
|
546
|
+
```bash
|
|
547
|
+
java -version
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
## 🧪 Example Session
|
|
553
|
+
|
|
554
|
+
```
|
|
555
|
+
You: List the prompt files
|
|
556
|
+
|
|
557
|
+
AI: 📂 Found 2 prompt files:
|
|
558
|
+
- example-login-tests.txt (5 prompts)
|
|
559
|
+
- example-youtube-tests.txt (4 prompts)
|
|
560
|
+
|
|
561
|
+
You: Run tests from prompts/example-youtube-tests.txt
|
|
562
|
+
|
|
563
|
+
AI: 📂 Reading prompts...
|
|
564
|
+
Found 4 test prompts.
|
|
565
|
+
|
|
566
|
+
[1/4] "Test that user can open YouTube and search for TechGuru"
|
|
567
|
+
🔧 Generating Maestro YAML...
|
|
568
|
+
✓ Validating YAML...
|
|
569
|
+
🚀 Running test...
|
|
570
|
+
✅ PASSED (3.2s)
|
|
571
|
+
|
|
572
|
+
[2/4] "Test that user can play the first video"
|
|
573
|
+
🔧 Generating Maestro YAML...
|
|
574
|
+
✓ Validating YAML...
|
|
575
|
+
🚀 Running test...
|
|
576
|
+
✅ PASSED (5.1s)
|
|
577
|
+
|
|
578
|
+
[3/4] "Test that user can pause and resume"
|
|
579
|
+
🔧 Generating Maestro YAML...
|
|
580
|
+
✓ Validating YAML...
|
|
581
|
+
🚀 Running test...
|
|
582
|
+
✅ PASSED (4.3s)
|
|
583
|
+
|
|
584
|
+
[4/4] "Test that user can subscribe"
|
|
585
|
+
🔧 Generating Maestro YAML...
|
|
586
|
+
✓ Validating YAML...
|
|
587
|
+
🚀 Running test...
|
|
588
|
+
❌ FAILED (2.1s)
|
|
589
|
+
📸 Screenshot saved
|
|
590
|
+
|
|
591
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
592
|
+
📊 Results: 3 passed, 1 failed
|
|
593
|
+
📄 Report: output/results/latest.json
|
|
594
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
595
|
+
|
|
596
|
+
You: What failed in test 4?
|
|
597
|
+
|
|
598
|
+
AI: Test 4 failed because the "Subscribe" button was not found.
|
|
599
|
+
The screenshot shows the video is still loading.
|
|
600
|
+
|
|
601
|
+
Would you like me to retry with more wait time?
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## 📚 Additional Resources
|
|
607
|
+
|
|
608
|
+
- [Maestro Documentation](https://maestro.mobile.dev/)
|
|
609
|
+
- [Model Context Protocol](https://modelcontextprotocol.io/)
|
|
610
|
+
- [React Native Automation Guidelines](./docs/REACT_NATIVE_AUTOMATION_GUIDELINES.md)
|
|
611
|
+
- [MCP Setup Guide](./docs/MCP_SETUP.md)
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
## 🤝 For Other Projects
|
|
616
|
+
|
|
617
|
+
To use this MCP server with a different app:
|
|
618
|
+
|
|
619
|
+
1. Update `APP_ID` in your MCP config or `.env` file
|
|
620
|
+
2. Create new prompt files in `prompts/` folder specific to your app
|
|
621
|
+
3. The AI will generate tests based on your app's UI
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
## 📦 Publishing to NPM (For Maintainers)
|
|
626
|
+
|
|
627
|
+
To publish this package to npm:
|
|
628
|
+
|
|
629
|
+
### 1. Update Package Name
|
|
630
|
+
|
|
631
|
+
Edit `package.json` and set your own npm scope:
|
|
632
|
+
|
|
633
|
+
```json
|
|
634
|
+
{
|
|
635
|
+
"name": "@your-org/maestro-mcp",
|
|
636
|
+
"version": "1.0.0"
|
|
637
|
+
}
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
### 2. Login to NPM
|
|
641
|
+
|
|
642
|
+
```bash
|
|
643
|
+
npm login
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### 3. Publish
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
# First time (create new package)
|
|
650
|
+
npm publish --access public
|
|
651
|
+
|
|
652
|
+
# Updates
|
|
653
|
+
npm version patch # or minor, major
|
|
654
|
+
npm publish
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
### 4. Users Can Then Install Via
|
|
658
|
+
|
|
659
|
+
```bash
|
|
660
|
+
# Global install
|
|
661
|
+
npm install -g @your-org/maestro-mcp
|
|
662
|
+
|
|
663
|
+
# Or run directly
|
|
664
|
+
npx @your-org/maestro-mcp
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
## 🌟 GitHub Repository Setup
|
|
670
|
+
|
|
671
|
+
### Recommended Repository Structure
|
|
672
|
+
|
|
673
|
+
```
|
|
674
|
+
your-org/maestro-mcp
|
|
675
|
+
├── .github/
|
|
676
|
+
│ ├── workflows/
|
|
677
|
+
│ │ ├── publish.yml # Auto-publish to npm on release
|
|
678
|
+
│ │ └── test.yml # CI tests
|
|
679
|
+
│ └── ISSUE_TEMPLATE/
|
|
680
|
+
├── src/
|
|
681
|
+
├── prompts/
|
|
682
|
+
├── README.md
|
|
683
|
+
├── LICENSE
|
|
684
|
+
└── package.json
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### GitHub Actions: Auto-Publish to NPM
|
|
688
|
+
|
|
689
|
+
Create `.github/workflows/publish.yml`:
|
|
690
|
+
|
|
691
|
+
```yaml
|
|
692
|
+
name: Publish to NPM
|
|
693
|
+
|
|
694
|
+
on:
|
|
695
|
+
release:
|
|
696
|
+
types: [created]
|
|
697
|
+
|
|
698
|
+
jobs:
|
|
699
|
+
publish:
|
|
700
|
+
runs-on: ubuntu-latest
|
|
701
|
+
steps:
|
|
702
|
+
- uses: actions/checkout@v4
|
|
703
|
+
- uses: actions/setup-node@v4
|
|
704
|
+
with:
|
|
705
|
+
node-version: "20"
|
|
706
|
+
registry-url: "https://registry.npmjs.org"
|
|
707
|
+
- run: npm ci
|
|
708
|
+
- run: npm publish --access public
|
|
709
|
+
env:
|
|
710
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
Then add `NPM_TOKEN` secret in your GitHub repository settings.
|
|
714
|
+
|
|
715
|
+
---
|
|
716
|
+
|
|
717
|
+
## 📜 License
|
|
718
|
+
|
|
719
|
+
MIT License
|