@desplega.ai/qa-use 2.0.1
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/LICENSE +21 -0
- package/README.md +1003 -0
- package/bin/qa-use.js +7 -0
- package/dist/lib/api/index.d.ts +296 -0
- package/dist/lib/api/index.d.ts.map +1 -0
- package/dist/lib/api/index.js +564 -0
- package/dist/lib/api/index.js.map +1 -0
- package/dist/lib/api/sse.d.ts +33 -0
- package/dist/lib/api/sse.d.ts.map +1 -0
- package/dist/lib/api/sse.js +97 -0
- package/dist/lib/api/sse.js.map +1 -0
- package/dist/lib/browser/index.d.ts +28 -0
- package/dist/lib/browser/index.d.ts.map +1 -0
- package/dist/lib/browser/index.js +145 -0
- package/dist/lib/browser/index.js.map +1 -0
- package/dist/lib/env/index.d.ts +41 -0
- package/dist/lib/env/index.d.ts.map +1 -0
- package/dist/lib/env/index.js +125 -0
- package/dist/lib/env/index.js.map +1 -0
- package/dist/lib/tunnel/index.d.ts +38 -0
- package/dist/lib/tunnel/index.d.ts.map +1 -0
- package/dist/lib/tunnel/index.js +154 -0
- package/dist/lib/tunnel/index.js.map +1 -0
- package/dist/package.json +100 -0
- package/dist/src/cli/commands/info.d.ts +6 -0
- package/dist/src/cli/commands/info.d.ts.map +1 -0
- package/dist/src/cli/commands/info.js +32 -0
- package/dist/src/cli/commands/info.js.map +1 -0
- package/dist/src/cli/commands/mcp.d.ts +6 -0
- package/dist/src/cli/commands/mcp.d.ts.map +1 -0
- package/dist/src/cli/commands/mcp.js +45 -0
- package/dist/src/cli/commands/mcp.js.map +1 -0
- package/dist/src/cli/commands/setup.d.ts +6 -0
- package/dist/src/cli/commands/setup.d.ts.map +1 -0
- package/dist/src/cli/commands/setup.js +59 -0
- package/dist/src/cli/commands/setup.js.map +1 -0
- package/dist/src/cli/commands/test/index.d.ts +6 -0
- package/dist/src/cli/commands/test/index.d.ts.map +1 -0
- package/dist/src/cli/commands/test/index.js +15 -0
- package/dist/src/cli/commands/test/index.js.map +1 -0
- package/dist/src/cli/commands/test/init.d.ts +6 -0
- package/dist/src/cli/commands/test/init.d.ts.map +1 -0
- package/dist/src/cli/commands/test/init.js +64 -0
- package/dist/src/cli/commands/test/init.js.map +1 -0
- package/dist/src/cli/commands/test/list.d.ts +6 -0
- package/dist/src/cli/commands/test/list.d.ts.map +1 -0
- package/dist/src/cli/commands/test/list.js +70 -0
- package/dist/src/cli/commands/test/list.js.map +1 -0
- package/dist/src/cli/commands/test/run.d.ts +6 -0
- package/dist/src/cli/commands/test/run.d.ts.map +1 -0
- package/dist/src/cli/commands/test/run.js +95 -0
- package/dist/src/cli/commands/test/run.js.map +1 -0
- package/dist/src/cli/commands/test/validate.d.ts +6 -0
- package/dist/src/cli/commands/test/validate.d.ts.map +1 -0
- package/dist/src/cli/commands/test/validate.js +70 -0
- package/dist/src/cli/commands/test/validate.js.map +1 -0
- package/dist/src/cli/index.d.ts +6 -0
- package/dist/src/cli/index.d.ts.map +1 -0
- package/dist/src/cli/index.js +21 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/lib/config.d.ts +36 -0
- package/dist/src/cli/lib/config.d.ts.map +1 -0
- package/dist/src/cli/lib/config.js +89 -0
- package/dist/src/cli/lib/config.js.map +1 -0
- package/dist/src/cli/lib/loader.d.ts +49 -0
- package/dist/src/cli/lib/loader.d.ts.map +1 -0
- package/dist/src/cli/lib/loader.js +122 -0
- package/dist/src/cli/lib/loader.js.map +1 -0
- package/dist/src/cli/lib/output.d.ts +53 -0
- package/dist/src/cli/lib/output.d.ts.map +1 -0
- package/dist/src/cli/lib/output.js +133 -0
- package/dist/src/cli/lib/output.js.map +1 -0
- package/dist/src/cli/lib/runner.d.ts +23 -0
- package/dist/src/cli/lib/runner.d.ts.map +1 -0
- package/dist/src/cli/lib/runner.js +40 -0
- package/dist/src/cli/lib/runner.js.map +1 -0
- package/dist/src/http-server.d.ts +14 -0
- package/dist/src/http-server.d.ts.map +1 -0
- package/dist/src/http-server.js +145 -0
- package/dist/src/http-server.js.map +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/server.d.ts +58 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +2376 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tunnel-mode.d.ts +13 -0
- package/dist/src/tunnel-mode.d.ts.map +1 -0
- package/dist/src/tunnel-mode.js +159 -0
- package/dist/src/tunnel-mode.js.map +1 -0
- package/dist/src/types/test-definition.d.ts +320 -0
- package/dist/src/types/test-definition.d.ts.map +1 -0
- package/dist/src/types/test-definition.js +11 -0
- package/dist/src/types/test-definition.js.map +1 -0
- package/dist/src/types.d.ts +209 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +34 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.d.ts.map +1 -0
- package/dist/src/utils/package.js +36 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/summary.d.ts +45 -0
- package/dist/src/utils/summary.d.ts.map +1 -0
- package/dist/src/utils/summary.js +198 -0
- package/dist/src/utils/summary.js.map +1 -0
- package/lib/api/index.ts +977 -0
- package/lib/api/sse.ts +112 -0
- package/lib/browser/index.ts +181 -0
- package/lib/env/index.ts +156 -0
- package/lib/tunnel/index.test.ts +344 -0
- package/lib/tunnel/index.ts +197 -0
- package/lib/tunnel/integration.test.ts +98 -0
- package/package.json +100 -0
- package/server.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,1003 @@
|
|
|
1
|
+
# QA-Use MCP Server
|
|
2
|
+
|
|
3
|
+
An MCP (Model Context Protocol) server that provides comprehensive browser automation and QA testing capabilities. This server integrates with desplega.ai to offer automated testing, session monitoring, batch test execution, and intelligent test guidance using AAA (Arrange-Act-Assert) framework templates.
|
|
4
|
+
|
|
5
|
+
**Modes:**
|
|
6
|
+
- 📟 **stdio** - Standard MCP transport for local integrations (default)
|
|
7
|
+
- 🌐 **HTTP/SSE** - StreamableHTTP transport for remote access and web integrations
|
|
8
|
+
- 🔄 **tunnel** - Persistent WebSocket tunnel for backend-initiated tasks
|
|
9
|
+
|
|
10
|
+
[](https://www.youtube.com/watch?v=ts3XsYneiO4)
|
|
11
|
+
|
|
12
|
+
> **Learn more:** Check out our comprehensive [MCP integration guide](https://www.desplega.ai/how-to/mcp) for detailed setup instructions and advanced usage patterns.
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Run with stdio transport (for MCP clients)
|
|
18
|
+
npx @desplega.ai/qa-use mcp
|
|
19
|
+
|
|
20
|
+
# Run with HTTP transport (for web/remote access)
|
|
21
|
+
npx @desplega.ai/qa-use mcp --http --port 3000
|
|
22
|
+
|
|
23
|
+
# Run persistent tunnel (for backend-initiated tasks)
|
|
24
|
+
npx @desplega.ai/qa-use mcp tunnel
|
|
25
|
+
|
|
26
|
+
# Run automated tests (new in v2.0!)
|
|
27
|
+
npx @desplega.ai/qa-use test run
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
> **Migrating from v1.x?** The package has been renamed from `@desplega.ai/qa-use-mcp` to `@desplega.ai/qa-use`. MCP server commands now use the `mcp` subcommand (e.g., `qa-use mcp` instead of `qa-use-mcp`). Update your MCP client configurations to add `"mcp"` to the args array.
|
|
31
|
+
|
|
32
|
+
> **For AI Assistants:** See [CLAUDE.md](./CLAUDE.md) for a concise onboarding guide with quick commands, architecture overview, and key concepts.
|
|
33
|
+
|
|
34
|
+
> **Package Manager:** This project uses **bun** as the package manager. Bun provides fast installs, a built-in test runner, and native TypeScript support.
|
|
35
|
+
|
|
36
|
+
## Table of Contents
|
|
37
|
+
|
|
38
|
+
- [MCP Client Configuration (stdio mode)](#mcp-client-configuration-stdio-mode)
|
|
39
|
+
- [HTTP Transport Mode (SSE)](#http-transport-mode-sse)
|
|
40
|
+
- [Tunnel Mode](#tunnel-mode)
|
|
41
|
+
- [Features](#features)
|
|
42
|
+
- [Installation](#installation)
|
|
43
|
+
- [Development](#development)
|
|
44
|
+
- [Available Tools](#available-tools)
|
|
45
|
+
|
|
46
|
+
## MCP Client Configuration (stdio mode)
|
|
47
|
+
|
|
48
|
+
The server requires a desplega.ai API key - you can get one by using the `register_user` tool or by signing up at [desplega.ai](https://desplega.ai).
|
|
49
|
+
|
|
50
|
+
**Standard configuration for most MCP clients:**
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"mcpServers": {
|
|
55
|
+
"desplega-qa": {
|
|
56
|
+
"command": "npx",
|
|
57
|
+
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
58
|
+
"env": {
|
|
59
|
+
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> **Optional:** Add `"QA_USE_REGION": "us"` to the `env` section to use the US region for faster tunnel connections from North America. If not set, defaults to automatic region selection.
|
|
67
|
+
|
|
68
|
+
<details>
|
|
69
|
+
<summary>Claude Code</summary>
|
|
70
|
+
Use the Claude Code CLI to add the QA-Use MCP server (<a href="https://docs.anthropic.com/en/docs/claude-code/mcp">guide</a>):
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
claude mcp add desplega-qa -- npx @desplega.ai/qa-use@latest mcp --env QA_USE_API_KEY=your-desplega-ai-api-key
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For US region (optional):
|
|
77
|
+
```bash
|
|
78
|
+
claude mcp add desplega-qa -- npx @desplega.ai/qa-use@latest mcp --env QA_USE_API_KEY=your-desplega-ai-api-key --env QA_USE_REGION=us
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Or add without environment variables and configure them later through the interactive setup:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
claude mcp add desplega-qa -- npx @desplega.ai/qa-use@latest mcp
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
</details>
|
|
88
|
+
|
|
89
|
+
<details>
|
|
90
|
+
<summary>Claude Desktop</summary>
|
|
91
|
+
Add to your <code>claude_desktop_config.json</code>:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"desplega-qa": {
|
|
97
|
+
"command": "npx",
|
|
98
|
+
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
99
|
+
"env": {
|
|
100
|
+
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
</details>
|
|
108
|
+
|
|
109
|
+
<details>
|
|
110
|
+
<summary>Cline</summary>
|
|
111
|
+
Follow <a href="https://docs.cline.bot/mcp/configuring-mcp-servers">https://docs.cline.bot/mcp/configuring-mcp-servers</a> and use the config provided above.
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
<details>
|
|
115
|
+
<summary>Codex</summary>
|
|
116
|
+
Follow the <a href="https://github.com/openai/codex/blob/main/docs/advanced.md#model-context-protocol-mcp">configure MCP guide</a>
|
|
117
|
+
using the standard config from above. You can also install the QA-Use MCP server using the Codex CLI:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
codex mcp add desplega-qa -- npx @desplega.ai/qa-use@latest mcp
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
</details>
|
|
124
|
+
|
|
125
|
+
<details>
|
|
126
|
+
<summary>Copilot / VS Code</summary>
|
|
127
|
+
Follow the MCP install <a href="https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server">guide</a>,
|
|
128
|
+
with the standard config from above. You can also install the QA-Use MCP server using the VS Code CLI:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
code --add-mcp '{"name":"desplega-qa","command":"npx","args":["-y","@desplega.ai/qa-use@latest","mcp"],"env":{"QA_USE_API_KEY":"your-desplega-ai-api-key"}}'
|
|
132
|
+
```
|
|
133
|
+
</details>
|
|
134
|
+
|
|
135
|
+
<details>
|
|
136
|
+
<summary>Cursor</summary>
|
|
137
|
+
|
|
138
|
+
**Or install manually:**
|
|
139
|
+
|
|
140
|
+
Go to `Cursor Settings` -> `MCP` -> `New MCP Server`. Use the config provided above.
|
|
141
|
+
|
|
142
|
+
</details>
|
|
143
|
+
|
|
144
|
+
<details>
|
|
145
|
+
<summary>Continue</summary>
|
|
146
|
+
Add to your Continue <code>config.json</code>:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"mcpServers": {
|
|
151
|
+
"desplega-qa": {
|
|
152
|
+
"command": "npx",
|
|
153
|
+
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
154
|
+
"env": {
|
|
155
|
+
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
</details>
|
|
163
|
+
|
|
164
|
+
<details>
|
|
165
|
+
<summary>Gemini CLI</summary>
|
|
166
|
+
Install the QA-Use MCP server using the Gemini CLI.
|
|
167
|
+
|
|
168
|
+
**Project wide:**
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
gemini mcp add desplega-qa npx @desplega.ai/qa-use@latest mcp
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**Globally:**
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
gemini mcp add -s user desplega-qa npx @desplega.ai/qa-use@latest mcp
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Alternatively, follow the <a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md#how-to-set-up-your-mcp-server">MCP guide</a> and use the standard config from above.
|
|
181
|
+
|
|
182
|
+
</details>
|
|
183
|
+
|
|
184
|
+
<details>
|
|
185
|
+
<summary>Gemini Code Assist</summary>
|
|
186
|
+
Follow the <a href="https://cloud.google.com/gemini/docs/codeassist/use-agentic-chat-pair-programmer#configure-mcp-servers">configure MCP guide</a>
|
|
187
|
+
using the standard config from above.
|
|
188
|
+
</details>
|
|
189
|
+
|
|
190
|
+
<details>
|
|
191
|
+
<summary>JetBrains AI Assistant & Junie</summary>
|
|
192
|
+
|
|
193
|
+
Go to `Settings | Tools | AI Assistant | Model Context Protocol (MCP)` -> `Add`. Use the config provided above.
|
|
194
|
+
The same way @desplega.ai/qa-use can be configured for JetBrains Junie in `Settings | Tools | Junie | MCP Settings` -> `Add`. Use the config provided above.
|
|
195
|
+
|
|
196
|
+
</details>
|
|
197
|
+
|
|
198
|
+
<details>
|
|
199
|
+
<summary>Zed</summary>
|
|
200
|
+
Add to your Zed settings:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"mcpServers": {
|
|
205
|
+
"desplega-qa": {
|
|
206
|
+
"command": "npx",
|
|
207
|
+
"args": ["-y", "@desplega.ai/qa-use@latest", "mcp"],
|
|
208
|
+
"env": {
|
|
209
|
+
"QA_USE_API_KEY": "your-desplega-ai-api-key"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
</details>
|
|
217
|
+
|
|
218
|
+
### Your first prompt
|
|
219
|
+
|
|
220
|
+
Enter the following prompt in your MCP Client to check if everything is working:
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
Initialize QA server and test the login form at https://app.example.com
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Your MCP client should initialize the server, set up browser automation, and start testing the specified form.
|
|
227
|
+
|
|
228
|
+
> [!NOTE]
|
|
229
|
+
> The MCP server will start browser and tunnel resources automatically when needed. First-time setup requires running `init_qa_server` with `interactive=true` or providing your desplega.ai API key.
|
|
230
|
+
|
|
231
|
+
## Features
|
|
232
|
+
|
|
233
|
+
- **Browser Management**: Launch and control Playwright browser instances with headless/headed modes
|
|
234
|
+
- **Tunneling**: Create public tunnels for browser WebSocket endpoints using localtunnel
|
|
235
|
+
- **API Integration**: Full integration with desplega.ai API for comprehensive QA testing workflows
|
|
236
|
+
- **Session Management**: Create, monitor, and control multiple QA testing sessions with real-time status
|
|
237
|
+
- Smart session lifecycle management with automatic cleanup
|
|
238
|
+
- Up to 10 concurrent browser sessions with clear error handling
|
|
239
|
+
- 30-minute default TTL with automatic deadline refresh on interaction
|
|
240
|
+
- Background cleanup task for expired sessions
|
|
241
|
+
- **Progress Monitoring**: Real-time progress notifications with MCP timeout protection (25s max per call)
|
|
242
|
+
- **Batch Test Execution**: Run multiple automated tests simultaneously with dependency management
|
|
243
|
+
- **Interactive Elicitation**: Intelligent prompts when remote sessions need user input to continue
|
|
244
|
+
- **Test Discovery**: Search and list automated tests with pagination and filtering
|
|
245
|
+
- **Test Run Analytics**: View test execution history with performance metrics and flakiness scores
|
|
246
|
+
- **AAA Framework Templates**: Pre-built prompts for login, forms, e-commerce, navigation, and comprehensive testing scenarios
|
|
247
|
+
- **User Registration**: Built-in user registration system for new desplega.ai accounts
|
|
248
|
+
- **Comprehensive Documentation**: Built-in MCP resources with guides, workflows, and best practices
|
|
249
|
+
|
|
250
|
+
## HTTP Transport Mode (SSE)
|
|
251
|
+
|
|
252
|
+
In addition to the standard MCP stdio transport, QA-Use can run with StreamableHTTP transport using Server-Sent Events (SSE). This mode implements the official [MCP Streamable HTTP specification](https://spec.modelcontextprotocol.io/specification/basic/transports/#http-with-sse) and is useful for web-based integrations, remote access, or when you need HTTP-based MCP connectivity.
|
|
253
|
+
|
|
254
|
+
### When to Use Each Mode
|
|
255
|
+
|
|
256
|
+
| Feature | stdio (default) | HTTP/SSE | Tunnel |
|
|
257
|
+
|---------|----------------|----------|---------|
|
|
258
|
+
| **Use Case** | Local MCP clients (Claude Desktop, Cline, etc.) | Web apps, remote access, API integrations | Backend-initiated tasks, CI/CD |
|
|
259
|
+
| **Setup** | Configured in MCP client settings | Start server, connect via HTTP | Single command, auto-registers |
|
|
260
|
+
| **Authentication** | Via environment variables | Bearer token on each request | Via environment variables |
|
|
261
|
+
| **Network** | Local process only | Can be exposed remotely | Tunneled to backend |
|
|
262
|
+
| **Protocol** | Native MCP stdio | MCP over HTTP with SSE | WebSocket via localtunnel |
|
|
263
|
+
| **Browser** | On-demand | On-demand | Persistent with heartbeat |
|
|
264
|
+
| **Best For** | Desktop IDE integrations | Microservices, web dashboards, custom clients | Backend-controlled testing, CI/CD pipelines |
|
|
265
|
+
|
|
266
|
+
### Starting the HTTP Server
|
|
267
|
+
|
|
268
|
+
Run the server with the `mcp --http` or `mcp --api` flags:
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Default port (3000)
|
|
272
|
+
npx @desplega.ai/qa-use mcp --http
|
|
273
|
+
|
|
274
|
+
# Custom port
|
|
275
|
+
npx @desplega.ai/qa-use mcp --http --port 8080
|
|
276
|
+
|
|
277
|
+
# Show help
|
|
278
|
+
npx @desplega.ai/qa-use mcp --help
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Authentication
|
|
282
|
+
|
|
283
|
+
All MCP endpoints (except `/health`) require authentication via Bearer token with a valid desplega.ai API key:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Establish SSE connection
|
|
287
|
+
curl -N -H "Authorization: Bearer YOUR_API_KEY" \
|
|
288
|
+
http://localhost:3000/mcp
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Get your API key by:
|
|
292
|
+
- Using the `register_user` tool
|
|
293
|
+
- Signing up at [desplega.ai](https://desplega.ai)
|
|
294
|
+
|
|
295
|
+
### MCP Endpoints
|
|
296
|
+
|
|
297
|
+
This server implements the [MCP Streamable HTTP transport specification](https://spec.modelcontextprotocol.io/specification/basic/transports/#http-with-sse):
|
|
298
|
+
|
|
299
|
+
#### Health Check
|
|
300
|
+
```bash
|
|
301
|
+
GET /health
|
|
302
|
+
# No authentication required
|
|
303
|
+
# Returns server status and version
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
#### MCP Protocol Endpoint
|
|
307
|
+
```bash
|
|
308
|
+
# Establish SSE connection for receiving messages
|
|
309
|
+
GET /mcp
|
|
310
|
+
Headers: Authorization: Bearer YOUR_API_KEY
|
|
311
|
+
|
|
312
|
+
# Send JSON-RPC messages to the server
|
|
313
|
+
POST /mcp
|
|
314
|
+
Headers:
|
|
315
|
+
Authorization: Bearer YOUR_API_KEY
|
|
316
|
+
Content-Type: application/json
|
|
317
|
+
Body: JSON-RPC 2.0 message
|
|
318
|
+
|
|
319
|
+
# Close session
|
|
320
|
+
DELETE /mcp
|
|
321
|
+
Headers:
|
|
322
|
+
Authorization: Bearer YOUR_API_KEY
|
|
323
|
+
MCP-Session-ID: <session-id>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Example Usage
|
|
327
|
+
|
|
328
|
+
#### Initialize MCP Connection
|
|
329
|
+
```bash
|
|
330
|
+
# Start SSE stream in one terminal
|
|
331
|
+
curl -N -H "Authorization: Bearer YOUR_API_KEY" \
|
|
332
|
+
http://localhost:3000/mcp
|
|
333
|
+
|
|
334
|
+
# In another terminal, send initialize message
|
|
335
|
+
curl -X POST http://localhost:3000/mcp \
|
|
336
|
+
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
337
|
+
-H "Content-Type: application/json" \
|
|
338
|
+
-d '{
|
|
339
|
+
"jsonrpc": "2.0",
|
|
340
|
+
"id": 1,
|
|
341
|
+
"method": "initialize",
|
|
342
|
+
"params": {
|
|
343
|
+
"protocolVersion": "2024-11-05",
|
|
344
|
+
"capabilities": {},
|
|
345
|
+
"clientInfo": {
|
|
346
|
+
"name": "test-client",
|
|
347
|
+
"version": "1.0.0"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}'
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
#### Call MCP Tools
|
|
354
|
+
```bash
|
|
355
|
+
# List available tools
|
|
356
|
+
curl -X POST http://localhost:3000/mcp \
|
|
357
|
+
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
358
|
+
-H "Content-Type: application/json" \
|
|
359
|
+
-d '{
|
|
360
|
+
"jsonrpc": "2.0",
|
|
361
|
+
"id": 2,
|
|
362
|
+
"method": "tools/list",
|
|
363
|
+
"params": {}
|
|
364
|
+
}'
|
|
365
|
+
|
|
366
|
+
# Start automated test session
|
|
367
|
+
curl -X POST http://localhost:3000/mcp \
|
|
368
|
+
-H "Authorization: Bearer YOUR_API_KEY" \
|
|
369
|
+
-H "Content-Type: application/json" \
|
|
370
|
+
-d '{
|
|
371
|
+
"jsonrpc": "2.0",
|
|
372
|
+
"id": 3,
|
|
373
|
+
"method": "tools/call",
|
|
374
|
+
"params": {
|
|
375
|
+
"name": "start_automated_session",
|
|
376
|
+
"arguments": {
|
|
377
|
+
"task": "Test login functionality"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}'
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### MCP Client Support
|
|
384
|
+
|
|
385
|
+
Any MCP client that supports the StreamableHTTP transport can connect to this server. You'll need to:
|
|
386
|
+
|
|
387
|
+
1. Configure the client with the HTTP endpoint: `http://localhost:3000/mcp`
|
|
388
|
+
2. Add authentication header: `Authorization: Bearer YOUR_API_KEY`
|
|
389
|
+
3. The client will automatically handle SSE streams and JSON-RPC messaging
|
|
390
|
+
|
|
391
|
+
> **Note:** Most current MCP clients (Claude Desktop, Cline, etc.) use stdio transport by default. The HTTP mode is primarily for:
|
|
392
|
+
> - Custom integrations and web applications
|
|
393
|
+
> - Remote server deployments
|
|
394
|
+
> - Microservices architectures
|
|
395
|
+
> - API gateways and proxies
|
|
396
|
+
|
|
397
|
+
### Security Considerations
|
|
398
|
+
|
|
399
|
+
When running in HTTP mode:
|
|
400
|
+
|
|
401
|
+
- ✅ **Always use HTTPS** in production (consider using a reverse proxy like nginx)
|
|
402
|
+
- ✅ **Protect your API key** - it provides full access to your desplega.ai account
|
|
403
|
+
- ✅ **Use firewall rules** to restrict access to trusted IP addresses
|
|
404
|
+
- ✅ **Consider rate limiting** for public-facing deployments
|
|
405
|
+
- ✅ **Monitor access logs** for suspicious activity
|
|
406
|
+
|
|
407
|
+
Example nginx configuration for HTTPS:
|
|
408
|
+
|
|
409
|
+
```nginx
|
|
410
|
+
server {
|
|
411
|
+
listen 443 ssl;
|
|
412
|
+
server_name qa-mcp.example.com;
|
|
413
|
+
|
|
414
|
+
ssl_certificate /path/to/cert.pem;
|
|
415
|
+
ssl_certificate_key /path/to/key.pem;
|
|
416
|
+
|
|
417
|
+
location / {
|
|
418
|
+
proxy_pass http://localhost:3000;
|
|
419
|
+
proxy_http_version 1.1;
|
|
420
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
421
|
+
proxy_set_header Connection 'upgrade';
|
|
422
|
+
proxy_set_header Host $host;
|
|
423
|
+
proxy_cache_bypass $http_upgrade;
|
|
424
|
+
|
|
425
|
+
# Required for SSE
|
|
426
|
+
proxy_buffering off;
|
|
427
|
+
proxy_read_timeout 24h;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Docker Deployment
|
|
433
|
+
|
|
434
|
+
The HTTP mode is perfect for containerized deployments. Example Dockerfile:
|
|
435
|
+
|
|
436
|
+
```dockerfile
|
|
437
|
+
FROM node:18-slim
|
|
438
|
+
|
|
439
|
+
# Install dependencies for Playwright
|
|
440
|
+
RUN apt-get update && apt-get install -y \
|
|
441
|
+
libnss3 libatk-bridge2.0-0 libdrm2 libxkbcommon0 \
|
|
442
|
+
libgbm1 libasound2 libxshmfence1 \
|
|
443
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
444
|
+
|
|
445
|
+
# Install qa-use
|
|
446
|
+
RUN npm install -g @desplega.ai/qa-use
|
|
447
|
+
|
|
448
|
+
# Expose port
|
|
449
|
+
EXPOSE 3000
|
|
450
|
+
|
|
451
|
+
# Set API key via environment variable
|
|
452
|
+
ENV QA_USE_API_KEY=your-api-key-here
|
|
453
|
+
|
|
454
|
+
# Start in HTTP mode
|
|
455
|
+
CMD ["qa-use", "mcp", "--http", "--port", "3000"]
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Run the container:
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
docker build -t qa-use .
|
|
462
|
+
docker run -d -p 3000:3000 \
|
|
463
|
+
-e QA_USE_API_KEY=your-api-key \
|
|
464
|
+
qa-use
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Vercel Deployment
|
|
468
|
+
|
|
469
|
+
Deploy to Vercel for serverless hosting:
|
|
470
|
+
|
|
471
|
+
[](https://vercel.com/new/clone?repository-url=https://github.com/desplega-ai/qa-use)
|
|
472
|
+
|
|
473
|
+
**Quick setup:**
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# Install Vercel CLI
|
|
477
|
+
npm i -g vercel
|
|
478
|
+
|
|
479
|
+
# Deploy
|
|
480
|
+
vercel --prod
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
**Vercel Build Settings:**
|
|
484
|
+
- **Build Command**: `bun build`
|
|
485
|
+
- **Output Directory**: `dist`
|
|
486
|
+
- **Install Command**: `bun install`
|
|
487
|
+
|
|
488
|
+
**Environment Variables** (set in Vercel dashboard):
|
|
489
|
+
- `QA_USE_API_KEY` - Your desplega.ai API key
|
|
490
|
+
|
|
491
|
+
⚠️ **Important**: Vercel has execution time limits (60s max on Pro plan) which may affect long-running SSE connections. For production use with long-running sessions, consider:
|
|
492
|
+
- **Railway** - Better for persistent connections
|
|
493
|
+
- **Render** - Supports long-running services
|
|
494
|
+
- **Fly.io** - Full control over processes
|
|
495
|
+
- **Self-hosted VPS** - No limits
|
|
496
|
+
|
|
497
|
+
See [VERCEL_DEPLOYMENT.md](./VERCEL_DEPLOYMENT.md) for detailed deployment guide and limitations.
|
|
498
|
+
|
|
499
|
+
### Unified CLI
|
|
500
|
+
|
|
501
|
+
All MCP modes are accessed via the `mcp` subcommand:
|
|
502
|
+
|
|
503
|
+
```bash
|
|
504
|
+
# Standard MCP mode (stdio) - default
|
|
505
|
+
npx @desplega.ai/qa-use mcp
|
|
506
|
+
|
|
507
|
+
# HTTP transport mode (SSE)
|
|
508
|
+
npx @desplega.ai/qa-use mcp --http
|
|
509
|
+
|
|
510
|
+
# Tunnel mode (persistent WebSocket)
|
|
511
|
+
npx @desplega.ai/qa-use mcp tunnel
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
All modes support the complete MCP tools and functionality. The HTTP mode follows the official MCP Streamable HTTP specification.
|
|
515
|
+
|
|
516
|
+
## Tunnel Mode
|
|
517
|
+
|
|
518
|
+
The tunnel mode creates a persistent WebSocket tunnel that allows the desplega.ai backend to initiate browser automation tasks using your local browser. This is perfect for scenarios where you want the backend to control test execution while using your local environment's browser.
|
|
519
|
+
|
|
520
|
+
### When to Use Tunnel Mode
|
|
521
|
+
|
|
522
|
+
| Scenario | Best Mode |
|
|
523
|
+
|----------|-----------|
|
|
524
|
+
| Backend-initiated tests | **Tunnel** ✅ |
|
|
525
|
+
| CI/CD pipelines with local browsers | **Tunnel** ✅ |
|
|
526
|
+
| Remote test execution on local environment | **Tunnel** ✅ |
|
|
527
|
+
| Interactive MCP client testing | **stdio** |
|
|
528
|
+
| Web dashboard integrations | **HTTP/SSE** |
|
|
529
|
+
|
|
530
|
+
### How It Works
|
|
531
|
+
|
|
532
|
+
1. **Start Tunnel**: Creates a Playwright browser and localtunnel
|
|
533
|
+
2. **Register WebSocket**: Sends the tunneled WebSocket URL to desplega.ai backend
|
|
534
|
+
3. **Heartbeat**: Sends keepalive signals every 5 seconds to maintain the connection
|
|
535
|
+
4. **Backend Control**: Backend can now initiate test sessions using your local browser
|
|
536
|
+
|
|
537
|
+
### Starting Tunnel Mode
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
# Start tunnel with headless browser (default)
|
|
541
|
+
npx @desplega.ai/qa-use mcp tunnel
|
|
542
|
+
|
|
543
|
+
# Start tunnel with visible browser
|
|
544
|
+
npx @desplega.ai/qa-use mcp tunnel --visible
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### Example Output
|
|
548
|
+
|
|
549
|
+
```
|
|
550
|
+
🔧 QA-Use Tunnel Mode
|
|
551
|
+
====================
|
|
552
|
+
Mode: Headless
|
|
553
|
+
|
|
554
|
+
🔑 Validating API key...
|
|
555
|
+
✅ API key valid
|
|
556
|
+
|
|
557
|
+
🌐 Starting browser tunnel...
|
|
558
|
+
✅ Browser started
|
|
559
|
+
✅ Tunnel created
|
|
560
|
+
|
|
561
|
+
📡 WebSocket URL: wss://qa-use-123456.lt.desplega.ai/...
|
|
562
|
+
✅ Registered with backend
|
|
563
|
+
|
|
564
|
+
🔄 Heartbeat active (every 5s)
|
|
565
|
+
Press Ctrl+C to stop
|
|
566
|
+
|
|
567
|
+
[10:30:15] ✓ Heartbeat #1 sent
|
|
568
|
+
[10:30:20] ✓ Heartbeat #2 sent
|
|
569
|
+
[10:30:25] ✓ Heartbeat #3 sent
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
### Environment Variables
|
|
573
|
+
|
|
574
|
+
Set your API key before starting tunnel mode:
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
export QA_USE_API_KEY=your-desplega-ai-api-key
|
|
578
|
+
npx @desplega.ai/qa-use mcp tunnel
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Optionally configure the US region for better tunnel performance from North America:
|
|
582
|
+
|
|
583
|
+
```bash
|
|
584
|
+
export QA_USE_API_KEY=your-desplega-ai-api-key
|
|
585
|
+
export QA_USE_REGION=us
|
|
586
|
+
npx @desplega.ai/qa-use mcp tunnel
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
Alternatively, you can use a config file instead of environment variables. See [Configuration File](#configuration-file) for details.
|
|
590
|
+
|
|
591
|
+
### Options
|
|
592
|
+
|
|
593
|
+
- **`--visible`**: Show browser window instead of headless mode (useful for debugging)
|
|
594
|
+
|
|
595
|
+
### Use Cases
|
|
596
|
+
|
|
597
|
+
#### 1. CI/CD Integration
|
|
598
|
+
Run tunnel mode in your CI/CD pipeline to allow backend-initiated tests:
|
|
599
|
+
|
|
600
|
+
```yaml
|
|
601
|
+
# .github/workflows/qa.yml
|
|
602
|
+
- name: Start QA Tunnel
|
|
603
|
+
run: |
|
|
604
|
+
export QA_USE_API_KEY=${{ secrets.QA_USE_API_KEY }}
|
|
605
|
+
npx @desplega.ai/qa-use mcp tunnel &
|
|
606
|
+
sleep 10 # Wait for tunnel to establish
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
#### 2. Development Testing
|
|
610
|
+
Keep a tunnel running while developing to allow ad-hoc tests from the backend:
|
|
611
|
+
|
|
612
|
+
```bash
|
|
613
|
+
# Terminal 1: Keep tunnel running
|
|
614
|
+
npx @desplega.ai/qa-use mcp tunnel
|
|
615
|
+
|
|
616
|
+
# Terminal 2: Trigger tests from backend via API/dashboard
|
|
617
|
+
# The backend will use your local browser through the tunnel
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
#### 3. Debugging with Visible Browser
|
|
621
|
+
When you need to see what's happening:
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
npx @desplega.ai/qa-use mcp tunnel --visible
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
### Graceful Shutdown
|
|
628
|
+
|
|
629
|
+
Press `Ctrl+C` to stop the tunnel. The server will:
|
|
630
|
+
1. Stop sending heartbeats
|
|
631
|
+
2. Close the tunnel
|
|
632
|
+
3. Shutdown the browser
|
|
633
|
+
4. Clean up resources
|
|
634
|
+
|
|
635
|
+
### Differences from Other Modes
|
|
636
|
+
|
|
637
|
+
| Feature | stdio | HTTP/SSE | **Tunnel** |
|
|
638
|
+
|---------|-------|----------|------------|
|
|
639
|
+
| **Control** | Local MCP client | HTTP requests | Backend-initiated |
|
|
640
|
+
| **Browser** | On-demand | On-demand | **Persistent** |
|
|
641
|
+
| **Heartbeat** | N/A | N/A | **Every 5s** |
|
|
642
|
+
| **Use Case** | Desktop IDEs | Web apps | **Backend tasks** |
|
|
643
|
+
| **Visibility** | Configurable | Configurable | **Headless default** |
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
## Installation
|
|
647
|
+
|
|
648
|
+
Install and run directly with npx:
|
|
649
|
+
|
|
650
|
+
```bash
|
|
651
|
+
# Run MCP server (stdio mode)
|
|
652
|
+
npx @desplega.ai/qa-use mcp
|
|
653
|
+
|
|
654
|
+
# Run automated tests
|
|
655
|
+
npx @desplega.ai/qa-use test run
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
Or install globally:
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
npm install -g @desplega.ai/qa-use
|
|
662
|
+
qa-use mcp # Start MCP server
|
|
663
|
+
qa-use test run # Run automated tests
|
|
664
|
+
qa-use --help # Show all commands
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
## Development
|
|
668
|
+
|
|
669
|
+
Clone the repository and install dependencies:
|
|
670
|
+
|
|
671
|
+
```bash
|
|
672
|
+
git clone <repository-url>
|
|
673
|
+
cd qa-use
|
|
674
|
+
bun install
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Build the project:
|
|
678
|
+
|
|
679
|
+
```bash
|
|
680
|
+
bun build
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
Start the development server:
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
bun dev
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
<!-- AUTO-GENERATED-TOOLS-START -->
|
|
690
|
+
## MCP Tools
|
|
691
|
+
|
|
692
|
+
The server exposes the following MCP tools for browser automation and QA testing:
|
|
693
|
+
|
|
694
|
+
### Setup & Configuration
|
|
695
|
+
|
|
696
|
+
#### `ensure_installed`
|
|
697
|
+
Ensure API key is set, validate authentication, and install Playwright browsers.
|
|
698
|
+
|
|
699
|
+
**Parameters:**
|
|
700
|
+
- `apiKey` (string, optional): API key for desplega.ai (optional if QA_USE_API_KEY env var is set)
|
|
701
|
+
|
|
702
|
+
#### `register_user`
|
|
703
|
+
Register a new user account with desplega.ai and receive an API key.
|
|
704
|
+
|
|
705
|
+
**Parameters:**
|
|
706
|
+
- `email` (string, required): Email address for registration
|
|
707
|
+
|
|
708
|
+
#### `update_configuration`
|
|
709
|
+
Update application configuration settings including base URL, login credentials, and viewport type.
|
|
710
|
+
|
|
711
|
+
**Parameters:**
|
|
712
|
+
- `base_url` (string, optional): Base URL for the application being tested
|
|
713
|
+
- `login_url` (string, optional): Login page URL for the application
|
|
714
|
+
- `login_username` (string, optional): Default username for login testing
|
|
715
|
+
- `login_password` (string, optional): Default password for login testing
|
|
716
|
+
- `vp_type` (string, optional): Viewport configuration type: big_desktop, desktop, mobile, or tablet (default: desktop)
|
|
717
|
+
|
|
718
|
+
#### `get_configuration`
|
|
719
|
+
Get the current application configuration details including base URL, login settings, and viewport.
|
|
720
|
+
|
|
721
|
+
**Parameters:** None
|
|
722
|
+
|
|
723
|
+
### Session Management
|
|
724
|
+
|
|
725
|
+
#### `search_sessions`
|
|
726
|
+
Search and list all sessions (automated tests and development sessions) with pagination and filtering.
|
|
727
|
+
|
|
728
|
+
**Parameters:**
|
|
729
|
+
- `limit` (number, optional): Maximum number of sessions to return (default: 10, min: 1)
|
|
730
|
+
- `offset` (number, optional): Number of sessions to skip (default: 0, min: 0)
|
|
731
|
+
- `query` (string, optional): Search query to filter sessions by task, URL, or status
|
|
732
|
+
|
|
733
|
+
#### `start_automated_session`
|
|
734
|
+
Start an automated E2E test session for QA flows and automated testing. Returns sessionId for monitoring.
|
|
735
|
+
|
|
736
|
+
**Parameters:**
|
|
737
|
+
- `task` (string, required): The testing task or scenario to execute
|
|
738
|
+
- `url` (string, optional): Optional URL to test (overrides app config base_url if provided)
|
|
739
|
+
- `dependencyId` (string, optional): Optional test ID that this session depends on (must be a self test ID created by your app configuration)
|
|
740
|
+
- `headless` (boolean, optional): Run browser in headless mode (default: false for better visibility)
|
|
741
|
+
|
|
742
|
+
#### `start_dev_session`
|
|
743
|
+
Start an interactive development session for debugging and exploration. Session will not auto-pilot and allows manual browser interaction.
|
|
744
|
+
|
|
745
|
+
**Parameters:**
|
|
746
|
+
- `task` (string, required): Description of what you want to explore or debug. Can be a placeholder like "Waiting for user input"
|
|
747
|
+
- `url` (string, optional): Optional URL to start from (overrides app config base_url if provided)
|
|
748
|
+
- `headless` (boolean, optional): Run browser in headless mode (default: false for development visibility)
|
|
749
|
+
|
|
750
|
+
#### `monitor_session`
|
|
751
|
+
Monitor a session status. Keep calling until status is "closed". Will alert if session needs user input, is idle, or pending.
|
|
752
|
+
|
|
753
|
+
**Parameters:**
|
|
754
|
+
- `sessionId` (string, required): The session ID to monitor
|
|
755
|
+
- `wait` (boolean, optional): Wait for session to reach any non-running state with MCP timeout protection (max 25s per call)
|
|
756
|
+
- `timeout` (number, optional): User timeout in seconds for wait mode (default: 60)
|
|
757
|
+
|
|
758
|
+
#### `interact_with_session`
|
|
759
|
+
Interact with a session - respond to questions, pause, or close the session.
|
|
760
|
+
|
|
761
|
+
**Parameters:**
|
|
762
|
+
- `sessionId` (string, required): The session ID to interact with
|
|
763
|
+
- `action` (string, required): Action to perform: respond (answer question), pause (stop session), or close (end session)
|
|
764
|
+
- `message` (string, optional): Your response message (required for "respond" action, optional for others)
|
|
765
|
+
|
|
766
|
+
### Test Management
|
|
767
|
+
|
|
768
|
+
#### `search_automated_tests`
|
|
769
|
+
Search for automated tests by ID or query. If testId provided, returns detailed info for that test. Otherwise searches with optional query/pagination.
|
|
770
|
+
|
|
771
|
+
**Parameters:**
|
|
772
|
+
- `testId` (string, optional): Specific test ID to retrieve detailed information for (if provided, other params ignored)
|
|
773
|
+
- `query` (string, optional): Search query to filter tests by name, description, URL, or task (ignored if testId provided)
|
|
774
|
+
- `limit` (number, optional): Maximum number of tests to return (default: 10, min: 1) (ignored if testId provided)
|
|
775
|
+
- `offset` (number, optional): Number of tests to skip (default: 0, min: 0) (ignored if testId provided)
|
|
776
|
+
- `self_only` (boolean, optional): Filter tests by app configuration. When true, only returns tests created by your application configuration. Default: false to allow running tests from other configs locally.
|
|
777
|
+
|
|
778
|
+
#### `run_automated_tests`
|
|
779
|
+
Execute multiple automated tests simultaneously.
|
|
780
|
+
|
|
781
|
+
**Parameters:**
|
|
782
|
+
- `test_ids` (array, required): Array of test IDs to execute
|
|
783
|
+
- `app_config_id` (string, optional): Optional app config ID to run tests against (uses API key default config if not provided)
|
|
784
|
+
- `ws_url` (string, optional): Optional WebSocket URL override (uses global tunnel URL by default)
|
|
785
|
+
|
|
786
|
+
#### `search_automated_test_runs`
|
|
787
|
+
Search automated test runs with optional filtering by test ID or run ID.
|
|
788
|
+
|
|
789
|
+
**Parameters:**
|
|
790
|
+
- `test_id` (string, optional): Filter test runs by specific test ID
|
|
791
|
+
- `run_id` (string, optional): Filter test runs by specific run ID
|
|
792
|
+
- `limit` (number, optional): Maximum number of test runs to return (default: 10, min: 1)
|
|
793
|
+
- `offset` (number, optional): Number of tests to skip (default: 0, min: 0)
|
|
794
|
+
|
|
795
|
+
<!-- AUTO-GENERATED-TOOLS-END -->
|
|
796
|
+
|
|
797
|
+
### Built-in Documentation
|
|
798
|
+
|
|
799
|
+
The server includes comprehensive MCP resources and prompts:
|
|
800
|
+
|
|
801
|
+
#### MCP Resources
|
|
802
|
+
- **Getting Started Guide**: Complete setup and usage instructions
|
|
803
|
+
- **Testing Workflows**: Common patterns for interactive, batch, and development testing
|
|
804
|
+
- **Tool Reference**: Detailed documentation for all available MCP tools
|
|
805
|
+
|
|
806
|
+
#### MCP Prompts
|
|
807
|
+
- **`aaa_test`**: Generate structured test scenarios using the Arrange-Act-Assert (AAA) framework with customizable parameters
|
|
808
|
+
|
|
809
|
+
## Configuration
|
|
810
|
+
|
|
811
|
+
### Environment Variables
|
|
812
|
+
|
|
813
|
+
Create a `.env` file in your project root or set the following environment variables:
|
|
814
|
+
|
|
815
|
+
```bash
|
|
816
|
+
# Required: Your desplega.ai API key
|
|
817
|
+
QA_USE_API_KEY=your-desplega-ai-api-key
|
|
818
|
+
|
|
819
|
+
# Optional: Region selection for tunnel and API routing
|
|
820
|
+
# Values: "us" | "auto"
|
|
821
|
+
# Default: "auto" (if not set)
|
|
822
|
+
# - "us": Uses lt.us.desplega.ai for localtunnel and routes to US region
|
|
823
|
+
# - "auto": Uses default lt.desplega.ai and automatic region routing
|
|
824
|
+
QA_USE_REGION=us
|
|
825
|
+
|
|
826
|
+
# Optional: Custom API endpoint (default: https://api.desplega.ai)
|
|
827
|
+
QA_USE_API_URL=https://api.desplega.ai
|
|
828
|
+
|
|
829
|
+
# Optional: Custom app URL (default: https://app.desplega.ai)
|
|
830
|
+
QA_USE_APP_URL=https://app.desplega.ai
|
|
831
|
+
|
|
832
|
+
# Optional: Custom tunnel host (overrides QA_USE_REGION setting)
|
|
833
|
+
TUNNEL_HOST=https://lt.desplega.ai
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
#### Regional Configuration
|
|
837
|
+
|
|
838
|
+
The `QA_USE_REGION` variable allows you to route your tunnel and API requests to specific regions:
|
|
839
|
+
|
|
840
|
+
- **Not set** (default): Uses automatic region selection (`lt.desplega.ai`)
|
|
841
|
+
- **`QA_USE_REGION=us`**: Uses US-based tunnel host (`lt.us.desplega.ai`) and routes sessions to the US region. Recommended for users primarily testing from North America.
|
|
842
|
+
- **`QA_USE_REGION=auto`**: Explicitly sets automatic region selection (same as not setting it)
|
|
843
|
+
|
|
844
|
+
Example configuration for US region:
|
|
845
|
+
```bash
|
|
846
|
+
export QA_USE_API_KEY=your-api-key
|
|
847
|
+
export QA_USE_REGION=us
|
|
848
|
+
npx @desplega.ai/qa-use mcp
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
> **Note:** If `QA_USE_REGION` is not set, the system automatically defaults to `"auto"` behavior.
|
|
852
|
+
|
|
853
|
+
### Configuration File
|
|
854
|
+
|
|
855
|
+
As an alternative to environment variables, you can store your configuration in `~/.qa-use.json`:
|
|
856
|
+
|
|
857
|
+
```json
|
|
858
|
+
{
|
|
859
|
+
"env": {
|
|
860
|
+
"QA_USE_API_KEY": "your-api-key-here",
|
|
861
|
+
"QA_USE_API_URL": "https://api.desplega.ai",
|
|
862
|
+
"QA_USE_APP_URL": "https://app.desplega.ai",
|
|
863
|
+
"QA_USE_REGION": "us"
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
**Priority order:**
|
|
869
|
+
1. Environment variables (highest priority)
|
|
870
|
+
2. Config file (`~/.qa-use.json`)
|
|
871
|
+
3. Default values
|
|
872
|
+
|
|
873
|
+
This is useful when you don't want to set environment variables or when using MCP clients that don't support environment configuration.
|
|
874
|
+
|
|
875
|
+
An example config file is available at [`.qa-use.example.json`](.qa-use.example.json) in this repository.
|
|
876
|
+
|
|
877
|
+
## Usage Examples
|
|
878
|
+
|
|
879
|
+
### Interactive Testing Workflow
|
|
880
|
+
```bash
|
|
881
|
+
# 1. Initialize server and install browsers
|
|
882
|
+
ensure_installed
|
|
883
|
+
|
|
884
|
+
# 2. Configure app settings (one-time setup)
|
|
885
|
+
update_configuration with base_url="https://app.example.com" and login_url="https://app.example.com/login" and login_username="testuser@example.com"
|
|
886
|
+
|
|
887
|
+
# 3. Start an automated test session
|
|
888
|
+
start_automated_session with task="Test user registration flow"
|
|
889
|
+
|
|
890
|
+
# 4. Monitor session progress
|
|
891
|
+
monitor_session with sessionId="session-123" and wait=true and timeout=300
|
|
892
|
+
|
|
893
|
+
# 5. Interact with session if needed (respond, pause, or close)
|
|
894
|
+
interact_with_session with sessionId="session-123" and action="respond" and message="john.doe@example.com"
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
### Development & Debugging Workflow
|
|
898
|
+
```bash
|
|
899
|
+
# 1. Start an interactive dev session (no auto-pilot)
|
|
900
|
+
start_dev_session with task="Exploring the checkout flow" and url="https://app.example.com/cart"
|
|
901
|
+
|
|
902
|
+
# 2. Monitor and interact as needed
|
|
903
|
+
monitor_session with sessionId="dev-session-456"
|
|
904
|
+
|
|
905
|
+
# 3. Close when done
|
|
906
|
+
interact_with_session with sessionId="dev-session-456" and action="close"
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
### Batch Testing Workflow
|
|
910
|
+
```bash
|
|
911
|
+
# 1. Find available tests
|
|
912
|
+
search_automated_tests with query="login" and limit=10
|
|
913
|
+
|
|
914
|
+
# 2. Run multiple tests simultaneously
|
|
915
|
+
run_automated_tests with test_ids=["login-test-1", "signup-test-2", "checkout-test-3"]
|
|
916
|
+
|
|
917
|
+
# 3. Monitor progress
|
|
918
|
+
search_sessions with limit=20
|
|
919
|
+
|
|
920
|
+
# 4. Check test run history
|
|
921
|
+
search_automated_test_runs with limit=50
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
### Using AAA Framework Template
|
|
925
|
+
```bash
|
|
926
|
+
# Generate a structured test using AAA framework
|
|
927
|
+
Use prompt: aaa_test with test_type="login" and url="https://app.example.com/login" and feature="user authentication"
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
### Resource Management
|
|
931
|
+
```bash
|
|
932
|
+
# When you hit the 10 session limit or need to free up resources
|
|
933
|
+
reset_browser_sessions
|
|
934
|
+
|
|
935
|
+
# This will clean up all active browsers and tunnels
|
|
936
|
+
# Useful when sessions aren't closing properly or you need to restart fresh
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
## Testing
|
|
940
|
+
|
|
941
|
+
Use the provided test scripts to test MCP server functionality:
|
|
942
|
+
|
|
943
|
+
```bash
|
|
944
|
+
# Test server initialization (uses env var if available)
|
|
945
|
+
./scripts/test-init.sh
|
|
946
|
+
|
|
947
|
+
# Test listing sessions
|
|
948
|
+
./scripts/test-list-sessions.sh
|
|
949
|
+
|
|
950
|
+
# Test starting a session
|
|
951
|
+
./scripts/test-start-session.sh
|
|
952
|
+
|
|
953
|
+
# Test with real API key from environment
|
|
954
|
+
node scripts/mcp-test.js
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
## Architecture
|
|
958
|
+
|
|
959
|
+
The project is organized into modular components:
|
|
960
|
+
|
|
961
|
+
- **`src/`**: Main MCP server implementation with comprehensive tool handlers
|
|
962
|
+
- MCP protocol implementation with tools, resources, and prompts
|
|
963
|
+
- Session management and monitoring with timeout protection
|
|
964
|
+
- BrowserSession management with automatic lifecycle tracking
|
|
965
|
+
- Each session wraps browser + tunnel with TTL and deadline tracking
|
|
966
|
+
- Session types: 'dev', 'automated', and 'test_run'
|
|
967
|
+
- Automatic cleanup on expiration or completion
|
|
968
|
+
- Real-time progress notifications using MCP logging specification
|
|
969
|
+
- AAA framework prompt templates for structured testing
|
|
970
|
+
- **`lib/browser/`**: Browser management functionality using Playwright
|
|
971
|
+
- Headless and headed browser support
|
|
972
|
+
- WebSocket endpoint management for remote control
|
|
973
|
+
- **`lib/tunnel/`**: Tunneling and port forwarding using localtunnel
|
|
974
|
+
- Public tunnel creation for browser WebSocket access
|
|
975
|
+
- Automatic WebSocket URL conversion for remote testing
|
|
976
|
+
- **`lib/api/`**: Complete API client for desplega.ai integration
|
|
977
|
+
- Session lifecycle management (create, monitor, respond)
|
|
978
|
+
- Test discovery and execution
|
|
979
|
+
- Test run analytics and history
|
|
980
|
+
- User registration and authentication
|
|
981
|
+
- Batch test execution with dependency handling
|
|
982
|
+
|
|
983
|
+
### Key Features Implementation
|
|
984
|
+
|
|
985
|
+
#### MCP Timeout Protection
|
|
986
|
+
- Limited monitoring calls to 25 seconds to prevent MCP timeouts
|
|
987
|
+
- Automatic continuation support for long-running sessions
|
|
988
|
+
- Real-time progress notifications during session monitoring
|
|
989
|
+
|
|
990
|
+
#### AAA Framework Integration
|
|
991
|
+
- Pre-built templates for login, forms, e-commerce, and navigation testing
|
|
992
|
+
- Comprehensive test scenarios for accessibility, performance, and mobile testing
|
|
993
|
+
- Dynamic argument support for customizable test generation
|
|
994
|
+
|
|
995
|
+
#### Test Analytics
|
|
996
|
+
- Complete test run history with performance metrics
|
|
997
|
+
- Probabilistic Flakiness Score (PFS) tracking
|
|
998
|
+
- Execution timing and error tracking
|
|
999
|
+
- Filtering and pagination for large datasets
|
|
1000
|
+
|
|
1001
|
+
## License
|
|
1002
|
+
|
|
1003
|
+
MIT
|