@deriv-com/fe-mcp-servers 0.0.10 → 0.0.11

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.
@@ -0,0 +1,341 @@
1
+ # Maestro AI MCP Server
2
+
3
+ A Model Context Protocol (MCP) server that provides automated Maestro test generation for web applications with best practices, templates, and guidelines baked in.
4
+
5
+ ## 🚀 Installation & Setup
6
+
7
+ ### Step 1: Install the Package
8
+
9
+ ```bash
10
+ npm install -g @deriv-com/fe-mcp-servers
11
+ ```
12
+
13
+ ### Step 2: Get Configuration Path
14
+
15
+ Get the exact path for your MCP configuration:
16
+
17
+ ```bash
18
+ echo "$(npm root -g)/@deriv-com/fe-mcp-servers/dist/maestro-ai/mcp-server.js"
19
+ ```
20
+
21
+ **Important**: Use the **bundled executable path** (without `src/`) for MCP configuration.
22
+
23
+ ### Step 3: Configure MCP Client
24
+
25
+ Add to your MCP client configuration (e.g., in Cursor settings):
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "maestro-ai": {
31
+ "command": "node",
32
+ "args": [
33
+ "/Users/user/.nvm/versions/node/v20.17.0/lib/node_modules/@deriv-com/fe-mcp-servers/dist/maestro-ai/mcp-server.js"
34
+ ]
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ ## 🛠️ Development Structure
41
+
42
+ ### Source Code (Development)
43
+
44
+ ```
45
+ maestro-ai/
46
+ ├── src/
47
+ │ ├── mcp-server.js # Main MCP server implementation
48
+ │ ├── mcp.js # Core Maestro test generation functionality
49
+ │ └── test-mcp.js # Test suite
50
+ └── README.md # This documentation
51
+ ```
52
+
53
+ ### Built Output (Distribution)
54
+
55
+ After building, the package creates:
56
+
57
+ ```
58
+ dist/
59
+ └── maestro-ai/
60
+ ├── mcp-server.js # Bundled executable (all dependencies included)
61
+ └── README.md # Documentation
62
+ ```
63
+
64
+ ## 🔧 Build Process
65
+
66
+ The build process uses esbuild to:
67
+
68
+ 1. Bundle all dependencies into a single file
69
+ 2. Create a standalone executable
70
+ 3. Include proper Node.js shebang for direct execution
71
+ 4. No external dependency resolution needed at runtime
72
+
73
+ ## ⚡ Available Tools
74
+
75
+ ### `maestro_generate_test` Tool
76
+
77
+ Generates comprehensive Maestro test YAML with templates, guidelines, and checklists.
78
+
79
+ **Parameters:**
80
+
81
+ - `feature` (string, required): The feature being tested (e.g., "User Settings")
82
+ - `action` (string, required): The action being tested (e.g., "Reset defaults")
83
+ - `flowType` (string, optional): Type of flow - `auth`, `sidebar`, `form`, `modal`, `navigation`, `extended`
84
+ - `changedElements` (array, optional): List of UI elements that were changed
85
+ - `existingTests` (array, optional): List of existing related test files
86
+
87
+ **Returns:**
88
+
89
+ - Generated YAML template with proper structure
90
+ - Change verification checklist
91
+ - Quality guidelines and suggested filename
92
+
93
+ ### `maestro_cheat_sheet` Tool
94
+
95
+ Returns Maestro commands quick reference including selector strategy, waiting strategy, and file naming conventions.
96
+
97
+ **Parameters:**
98
+
99
+ - None required
100
+
101
+ **Returns:**
102
+
103
+ - Complete command reference table
104
+ - Selector priority order (text → id → index → repeat)
105
+ - Environment variable setup examples
106
+
107
+ ### `maestro_flow_template` Tool
108
+
109
+ Returns a specific Maestro flow template by type.
110
+
111
+ **Parameters:**
112
+
113
+ - `flowType` (string, required): `auth`, `sidebar`, `form`, `modal`, `navigation`, `extended`
114
+ - `name` (string, optional): Custom flow name
115
+ - `baseUrl` (string, optional): Override default URL
116
+ - `waitForElement` (string, optional): Initial element to wait for
117
+ - `baseFlow` (string, optional): For extended type, base flow to extend
118
+
119
+ **Returns:**
120
+
121
+ - Ready-to-use YAML template for the specified flow type
122
+
123
+ ### `maestro_ui_inspection` Tool
124
+
125
+ Returns UI inspection guidelines and checklist for proper element discovery.
126
+
127
+ **Parameters:**
128
+
129
+ - None required
130
+
131
+ **Returns:**
132
+
133
+ - MCP tool usage instructions
134
+ - Source code grep patterns
135
+ - ID vs data-testid distinction guide
136
+
137
+ ### `maestro_pattern` Tool
138
+
139
+ Returns common Maestro patterns with "when to use" guidance.
140
+
141
+ **Parameters:**
142
+
143
+ - `patternType` (string, optional): `login`, `form`, `onboarding`, `slider`, `waitVisible`, `waitNotVisible`, `runFlow`
144
+
145
+ **Returns:**
146
+
147
+ - Pattern YAML code
148
+ - Usage guidance for each pattern
149
+
150
+ ### `maestro_analyze_changes` Tool
151
+
152
+ Automatically analyzes actual git changes in a repository and provides test recommendations.
153
+
154
+ **Parameters:**
155
+
156
+ - `repoPath` (string, required): Path to the git repository
157
+ - `changeType` (string, optional): `all`, `unstaged`, `staged`, `lastCommit`, `branch`
158
+ - `baseBranch` (string, optional): Base branch for comparison (default: "main")
159
+ - `fileFilter` (string, optional): Comma-separated patterns to filter files
160
+
161
+ **Returns:**
162
+
163
+ - List of changed files (unstaged, staged, UI files)
164
+ - Interactive elements detected (onClick, Button, Form, etc.)
165
+ - Suggested flow type and whether to create tests
166
+
167
+ ## 🎯 Usage Examples
168
+
169
+ Once configured in your MCP client, you can use the tools in your conversations:
170
+
171
+ ### Generate Test for New Feature
172
+
173
+ **Input:**
174
+
175
+ ```
176
+ Use maestro_generate_test to create a test for the new Reset button in User Settings
177
+ ```
178
+
179
+ **What happens:**
180
+ The AI will receive a complete YAML template with guidelines for testing the feature.
181
+
182
+ ### Analyze Git Changes Before Testing
183
+
184
+ **Input:**
185
+
186
+ ```
187
+ maestro_analyze_changes(repoPath: "/path/to/project", changeType: "all")
188
+ ```
189
+
190
+ **Expected Output:**
191
+
192
+ ```
193
+ ## 📁 Changed Files Summary
194
+ ### Unstaged Changes: 2 files
195
+ - src/components/Settings/ResetButton.tsx
196
+ - src/components/Settings/Settings.tsx
197
+
198
+ ## 🔍 Analysis
199
+ ### Should Create Test: ✅ Yes
200
+ ### Interactive Elements Found:
201
+ - onClick
202
+ - Button
203
+ ### Suggested Flow Type: form
204
+ ```
205
+
206
+ ### Get Flow Template
207
+
208
+ **Input:**
209
+
210
+ ```
211
+ maestro_flow_template(flowType: "auth", name: "Login - OAuth flow")
212
+ ```
213
+
214
+ **Expected Output:**
215
+
216
+ ```yaml
217
+ appId: web
218
+ name: "Login - OAuth flow"
219
+ url: ${BASE_URL}
220
+
221
+ env:
222
+ BASE_URL: ${MAESTRO_BASE_URL || "https://localhost:8443"}
223
+ USER_EMAIL: ${MAESTRO_USER_EMAIL || "user@example.com"}
224
+ ---
225
+ - launchApp
226
+ - extendedWaitUntil:
227
+ visible: "Log in"
228
+ timeout: 20000
229
+ - tapOn:
230
+ text: "Log in"
231
+ ```
232
+
233
+ ### Common Use Cases
234
+
235
+ 1. **New Feature Testing**: `maestro_generate_test(feature: "Checkout", action: "Submit order")`
236
+ 2. **Git Analysis**: `maestro_analyze_changes(repoPath: ".", changeType: "staged")`
237
+ 3. **Quick Reference**: `maestro_cheat_sheet()`
238
+ 4. **Pattern Lookup**: `maestro_pattern(patternType: "login")`
239
+ 5. **UI Discovery**: `maestro_ui_inspection()`
240
+
241
+ ## Flow Types
242
+
243
+ | Flow Type | Description | Includes Onboarding? |
244
+ | ------------ | ----------------------------- | -------------------- |
245
+ | `auth` | Login, signup, password reset | Yes |
246
+ | `sidebar` | Sidebar panel interactions | No |
247
+ | `form` | Form fill and submit | No |
248
+ | `modal` | Modal/dialog interactions | No |
249
+ | `navigation` | Page-to-page navigation | No |
250
+ | `extended` | Build on existing flow | No |
251
+
252
+ ## Git Change Types
253
+
254
+ | Type | Description | Git Command |
255
+ | ------------ | ------------------------------ | -------------------------------- |
256
+ | `all` | Unstaged + staged (default) | `git diff` + `git diff --staged` |
257
+ | `unstaged` | Only working directory changes | `git diff` |
258
+ | `staged` | Only staged changes | `git diff --staged` |
259
+ | `lastCommit` | Most recent commit | `git diff HEAD~1` |
260
+ | `branch` | Compare to base branch | `git diff {baseBranch}...HEAD` |
261
+
262
+ ## 📊 Examples
263
+
264
+ ### Auth Flow Template
265
+
266
+ ```yaml
267
+ appId: web
268
+ name: "Login - Basic authentication"
269
+ url: ${BASE_URL}
270
+
271
+ env:
272
+ BASE_URL: ${MAESTRO_BASE_URL || "https://localhost:8443"}
273
+ USER_EMAIL: ${MAESTRO_USER_EMAIL || "user@example.com"}
274
+ USER_PASSWORD: ${MAESTRO_USER_PASSWORD || "password"}
275
+ ---
276
+ - launchApp
277
+ - extendedWaitUntil:
278
+ visible: "Log in"
279
+ timeout: 20000
280
+ - tapOn:
281
+ text: "Next"
282
+ repeat: 3
283
+ - tapOn:
284
+ text: "Log in"
285
+ - inputText: ${USER_EMAIL}
286
+ - tapOn:
287
+ text: "Log in"
288
+ - extendedWaitUntil:
289
+ visible: "Dashboard"
290
+ timeout: 30000
291
+ ```
292
+
293
+ ### Form Flow Template
294
+
295
+ ```yaml
296
+ appId: web
297
+ name: "User Settings - Reset defaults"
298
+ url: ${BASE_URL}
299
+
300
+ env:
301
+ BASE_URL: ${MAESTRO_BASE_URL || "https://localhost:8443"}
302
+ ---
303
+ - launchApp
304
+ - extendedWaitUntil:
305
+ visible: "Settings"
306
+ timeout: 20000
307
+ - tapOn:
308
+ text: "Reset to defaults"
309
+ - extendedWaitUntil:
310
+ visible: "Settings reset successfully"
311
+ timeout: 10000
312
+ ```
313
+
314
+ ### Sidebar Flow Template
315
+
316
+ ```yaml
317
+ appId: web
318
+ name: "Positions - Open panel"
319
+ url: ${BASE_URL}
320
+
321
+ env:
322
+ BASE_URL: ${MAESTRO_BASE_URL || "https://localhost:8443"}
323
+ ---
324
+ - launchApp
325
+ - extendedWaitUntil:
326
+ visible: "Portfolio"
327
+ timeout: 20000
328
+ - tapOn:
329
+ id: "dt_sidebar_positions"
330
+ - extendedWaitUntil:
331
+ visible: "Open Positions"
332
+ timeout: 10000
333
+ - assertVisible: "No open positions"
334
+ ```
335
+
336
+ ## 📚 Resources
337
+
338
+ - [Maestro Docs](https://docs.maestro.dev/)
339
+ - [Selectors Reference](https://docs.maestro.dev/api-reference/selectors)
340
+ - [Commands Reference](https://docs.maestro.dev/api-reference/)
341
+ - [Maestro MCP](https://docs.maestro.dev/getting-started/maestro-mcp)