@qcentriq/mcp 0.5.0 → 0.5.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 +202 -202
- package/README.md +348 -348
- package/dist/index.js +32 -4
- package/package.json +51 -51
package/README.md
CHANGED
|
@@ -1,348 +1,348 @@
|
|
|
1
|
-
# @qcentriq/mcp
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@qcentriq/mcp)
|
|
4
|
-
[](LICENSE)
|
|
5
|
-
[](https://nodejs.org)
|
|
6
|
-
[](https://modelcontextprotocol.io)
|
|
7
|
-
|
|
8
|
-
Official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for **QCentriq** automated test discovery, error diagnostics, script retrieval, and local test execution.
|
|
9
|
-
|
|
10
|
-
Connect your AI coding assistants (**Cursor**, **Claude Desktop**, **VS Code Cline / Roo Code**, **Windsurf**, **Zed**, or **Gemini / Antigravity**) directly to your QCentriq QA projects to inspect test cases, analyze failure logs, retrieve Playwright test scripts, and validate fixes locally.
|
|
11
|
-
|
|
12
|
-
## ⚡ Highlights
|
|
13
|
-
|
|
14
|
-
- **Remote Cloud Discovery & Diagnostics**: Instantly query test cases, groups, run logs, failure stack traces, and environment variables via authenticated REST client endpoints.
|
|
15
|
-
- **Local Playwright Test Execution**: Safely execute tests locally with `pytest` without triggering unwanted cloud runners. Supports headless and headed modes across Chromium, Firefox, and WebKit.
|
|
16
|
-
- **Smart Environment Setup**: Probes installed local Python package managers (`uv`, `poetry`, `conda`, or standard `venv`) and generates ready-to-run setup commands (prefers `uv` for lightning-fast setup).
|
|
17
|
-
- **Direct Workspace Script Saving**: Download test scripts and their helper files, nested folders included, into a per-group `qcentriq_tests/<group_id>/` workspace directory (kept apart from your own `tests/`, so an existing `conftest.py` is never overwritten). Before each local run there, `qcentriq_run_local_test` refreshes the `conftest.py` QCentriq cloud runs use with path traversal protections.
|
|
18
|
-
- **Zero-Leak Redaction**: Automatically filters all outgoing tool payloads, masking API keys (`qc_...`), bearer tokens, and URL credentials before sending them to the LLM.
|
|
19
|
-
- **Strict Stdio Isolation**: Protocol JSON-RPC frames communicate cleanly over `stdout`, while all diagnostic logs route to `stderr`.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## 🚀 Quick Start
|
|
23
|
-
|
|
24
|
-
### Using `npx` (No installation needed)
|
|
25
|
-
|
|
26
|
-
Launch the MCP server directly using `npx`:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npx -y @qcentriq/mcp@latest --api-key "qc_your_api_key_here"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Or pass your configuration via environment variables:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
export QCENTRIQ_API_KEY="qc_your_api_key_here"
|
|
36
|
-
export QCENTRIQ_BASE_URL="https://api.qcentriq.com" # Optional, defaults to production
|
|
37
|
-
export QCENTRIQ_PROJECT_ID="your-project-uuid" # Optional default project ID
|
|
38
|
-
|
|
39
|
-
npx -y @qcentriq/mcp@latest
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Global Installation
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
npm install -g @qcentriq/mcp
|
|
46
|
-
qcentriq-mcp --api-key "qc_your_api_key_here"
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## 📋 CLI Options & Environment Variables
|
|
51
|
-
|
|
52
|
-
| CLI Option | Environment Variable | Default | Description |
|
|
53
|
-
| :--- | :--- | :--- | :--- |
|
|
54
|
-
| `-k, --api-key <key>` | `QCENTRIQ_API_KEY` | *(Required)* | Your QCentriq API key (`qc_...`). |
|
|
55
|
-
| `-u, --base-url <url>` | `QCENTRIQ_BASE_URL` | `https://api.qcentriq.com` | Base URL of the QCentriq backend API. |
|
|
56
|
-
| `-p, --project-id <id>` | `QCENTRIQ_PROJECT_ID` | `undefined` | Optional default project UUID (inferred from API key if omitted). |
|
|
57
|
-
| `-d, --debug` | `DEBUG` or `QCENTRIQ_DEBUG` | `false` | Enable verbose debug logging to stderr. |
|
|
58
|
-
| `-h, --help` | — | — | Display CLI usage information and flags. |
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## ⚙️ Assistant Configuration Guides
|
|
62
|
-
|
|
63
|
-
### 1. Claude Desktop
|
|
64
|
-
|
|
65
|
-
Add QCentriq to your configuration file:
|
|
66
|
-
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
67
|
-
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
68
|
-
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
69
|
-
|
|
70
|
-
```json
|
|
71
|
-
{
|
|
72
|
-
"mcpServers": {
|
|
73
|
-
"qcentriq": {
|
|
74
|
-
"command": "npx",
|
|
75
|
-
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
76
|
-
"env": {
|
|
77
|
-
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
78
|
-
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com",
|
|
79
|
-
"QCENTRIQ_PROJECT_ID": "optional-default-project-uuid"
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### 2. Cursor IDE
|
|
88
|
-
|
|
89
|
-
In Cursor, open **Settings** $\to$ **Features** $\to$ **MCP Servers** $\to$ **Add New MCP Server**, or edit `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your repository root):
|
|
90
|
-
|
|
91
|
-
```json
|
|
92
|
-
{
|
|
93
|
-
"mcpServers": {
|
|
94
|
-
"qcentriq": {
|
|
95
|
-
"command": "npx",
|
|
96
|
-
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
97
|
-
"env": {
|
|
98
|
-
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
99
|
-
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### 3. VS Code (Cline / Roo Code)
|
|
108
|
-
|
|
109
|
-
In VS Code with the Cline or Roo Code extension, open `cline_mcp_settings.json`:
|
|
110
|
-
|
|
111
|
-
```json
|
|
112
|
-
{
|
|
113
|
-
"mcpServers": {
|
|
114
|
-
"qcentriq": {
|
|
115
|
-
"command": "npx",
|
|
116
|
-
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
117
|
-
"env": {
|
|
118
|
-
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
119
|
-
},
|
|
120
|
-
"disabled": false,
|
|
121
|
-
"autoApprove": [
|
|
122
|
-
"qcentriq_list_tests",
|
|
123
|
-
"qcentriq_get_test",
|
|
124
|
-
"qcentriq_get_test_groups",
|
|
125
|
-
"qcentriq_get_test_run_logs"
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### 4. Windsurf
|
|
134
|
-
|
|
135
|
-
In `~/.codeium/windsurf/mcp_config.json`:
|
|
136
|
-
|
|
137
|
-
```json
|
|
138
|
-
{
|
|
139
|
-
"mcpServers": {
|
|
140
|
-
"qcentriq": {
|
|
141
|
-
"command": "npx",
|
|
142
|
-
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
143
|
-
"env": {
|
|
144
|
-
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
### 5. Zed
|
|
153
|
-
|
|
154
|
-
In your Zed `settings.json` (under `experimental.context_servers`):
|
|
155
|
-
|
|
156
|
-
```json
|
|
157
|
-
{
|
|
158
|
-
"context_servers": {
|
|
159
|
-
"qcentriq": {
|
|
160
|
-
"command": "npx",
|
|
161
|
-
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
162
|
-
"env": {
|
|
163
|
-
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
### 6. Gemini / Antigravity IDE
|
|
172
|
-
|
|
173
|
-
In `~/.gemini/config/mcp_config.json` (or `.agents/mcp_config.json` in workspace):
|
|
174
|
-
|
|
175
|
-
```json
|
|
176
|
-
{
|
|
177
|
-
"mcpServers": {
|
|
178
|
-
"qcentriq": {
|
|
179
|
-
"command": "npx",
|
|
180
|
-
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
181
|
-
"env": {
|
|
182
|
-
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
183
|
-
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
### 7. Claude Code CLI
|
|
192
|
-
|
|
193
|
-
Add the QCentriq MCP server using the Claude CLI:
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
claude mcp add qcentriq -- npx -y @qcentriq/mcp@latest --api-key "qc_your_api_key_here"
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
### 🎭 Add Playwright MCP for writing tests (recommended)
|
|
201
|
-
|
|
202
|
-
Before writing a test plan or script, the assistant is told to explore your app in a real browser with the [Playwright MCP server](https://github.com/microsoft/playwright-mcp). That way, URLs, labels and selectors come from the pages themselves instead of guesses. QCentriq MCP cannot call Playwright MCP itself, so add it to the same client next to `qcentriq`:
|
|
203
|
-
|
|
204
|
-
```json
|
|
205
|
-
{
|
|
206
|
-
"mcpServers": {
|
|
207
|
-
"playwright": {
|
|
208
|
-
"command": "npx",
|
|
209
|
-
"args": ["@playwright/mcp@latest"]
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
With Claude Code: `claude mcp add playwright -- npx @playwright/mcp@latest`. If Playwright MCP is not connected, the assistant should say so before it writes a plan.
|
|
216
|
-
|
|
217
|
-
**Sites behind HTTP basic auth** (common on staging) answer 401 with a blank page until the browser logs in. The assistant is told to notice this and continue on its own. It takes the credentials from your request, or from the environment's `BASIC_AUTH_USERNAME` / `BASIC_AUTH_PASSWORD` variables (or the keys that `QCENTRIQ_BASIC_AUTH_USERNAME_KEY` / `QCENTRIQ_BASIC_AUTH_PASSWORD_KEY` name). Then it reopens the site with them in the URL, and Chromium remembers them for the rest of the session. It asks you only when the credentials are stored as secrets, because QCentriq never sends secret values to the assistant. To avoid that question, give Playwright MCP the credentials up front by starting it with `--config playwright-mcp.json`:
|
|
218
|
-
|
|
219
|
-
```json
|
|
220
|
-
{
|
|
221
|
-
"browser": {
|
|
222
|
-
"contextOptions": {
|
|
223
|
-
"httpCredentials": { "username": "staging-user", "password": "staging-password" }
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Scripts never contain the credentials. The `conftest.py` QCentriq ships applies them from `BASIC_AUTH_USERNAME` / `BASIC_AUTH_PASSWORD`, which the assistant passes to `qcentriq_run_local_test` in `env_vars` for local runs.
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
## 🛠️ Available MCP Tools
|
|
233
|
-
|
|
234
|
-
The QCentriq MCP Server cleanly separates **remote cloud discovery/diagnostics** (connected via authenticated REST endpoints to `/api/v1/mcp-client/`) and **local client operations** (executed purely inside your machine's local workspace):
|
|
235
|
-
|
|
236
|
-
### 🌐 Remote Discovery & Diagnostics (Cloud REST Endpoints)
|
|
237
|
-
|
|
238
|
-
| Tool Name | Description | Key Arguments |
|
|
239
|
-
| :--- | :--- | :--- |
|
|
240
|
-
| `qcentriq_list_tests` | Discover test cases and test groups with status, priority, and update timestamps. Script availability is highlighted. | `project_id` *(uuid)*, `group_id` *(uuid)*, `priority` *("low"\|"medium"\|"high"\|"critical")*, `test_type` *("web"\|"api"\|"mobile")*, `limit` *(int)*, `offset` *(int)* |
|
|
241
|
-
| `qcentriq_get_test` | Retrieve full test case definitions, step descriptions, preconditions, latest execution diagnostics, and error stack traces. | `test_case_id` *(uuid, required)*, `project_id` *(uuid)* |
|
|
242
|
-
| `qcentriq_get_test_groups` | Discover and inspect test groups, member test cases, test counts, and script availability. | `project_id` *(uuid)*, `group_id` *(uuid)*, `limit` *(int)*, `offset` *(int)* |
|
|
243
|
-
| `qcentriq_download_script` | Download a group's Playwright Python test script and its helper files and save them to `./qcentriq_tests/<group_id>/`, each helper at its relative path (e.g. `pages/login_page.py`). Pass `save_to_disk=false` to only return the content. | `group_id` *(uuid, required)*, `project_id` *(uuid)*, `include_fixtures` *(bool, default true)*, `save_to_disk` *(bool, default true)*, `destination_dir` *(string, default "./qcentriq_tests"; the group folder is created inside it)* |
|
|
244
|
-
| `qcentriq_get_environment` | Retrieve target environment configuration, base URL (`BASE_URL`), environment variables, and required secret variable names for local execution. | `project_id` *(uuid)*, `environment_id` *(uuid)*, `environment_name` *(string)* |
|
|
245
|
-
| `qcentriq_get_test_run_logs` | Fetch execution history, logs, stdout/stderr, and stack traces across single-case and suite runs. | `test_case_id` *(uuid, required)*, `project_id` *(uuid)*, `run_id` *(uuid)*, `status` *("failed"\|"passed"\|"error")*, `latest_only` *(bool)*, `from_date` *(ISO date)*, `to_date` *(ISO date)*, `limit` *(int)*, `offset` *(int)* |
|
|
246
|
-
|
|
247
|
-
### ✍️ Authoring (Cloud REST Endpoints, writes require `test:write`)
|
|
248
|
-
|
|
249
|
-
The intended order is: `qcentriq_get_authoring_guide` and `qcentriq_get_environment`, then explore the app with [Playwright MCP](#-add-playwright-mcp-for-writing-tests-recommended), then `qcentriq_create_plan`, then write the script, run it with `qcentriq_run_local_test` until it passes, and upload it with `qcentriq_save_group_script`. The server sends this order to the assistant as its MCP instructions.
|
|
250
|
-
|
|
251
|
-
Both write tools send to QCentriq as soon as they are called; your MCP client's own tool-approval prompt is the check before an upload (see [Security & Privacy](#-security--privacy)).
|
|
252
|
-
|
|
253
|
-
| Tool Name | Description | Key Arguments |
|
|
254
|
-
| :--- | :--- | :--- |
|
|
255
|
-
| `qcentriq_get_authoring_guide` | Fetch the contract for plans and scripts: the TaskPlan JSON schema, the `${VAR}` environment-variable convention, the `@allure.id` rules, and the available conftest fixtures. Read-only. | — |
|
|
256
|
-
| `qcentriq_create_plan` | Create test groups and test cases from an authored plan. Returns one UUID per created test case. A case whose flow failed in the browser can be created with `status: "blocked"` and an evidence `block_reason`; QCentriq re-validates it live and keeps it blocked only if it sees the same failure (`block_source` shows `client` until then). **Writes.** | `plan` *(object, required)*, `project_id` *(uuid)* |
|
|
257
|
-
| `qcentriq_save_group_script` | Validate and store a test script for a group, replacing the existing one. Every unblocked case in the group must appear exactly once as `@allure.id('<case_id>')`; blocked cases may be left out. Only uploads a script that passed `qcentriq_run_local_test` with this exact content (see [Local pass before upload](#-security--privacy)). Checked against the version from the last download or save of the group in this session, so someone else's newer edit is refused as a conflict instead of overwritten. `fixtures` is the group's complete helper set, each `file_name` relative to the script's folder: helpers left out are deleted, and a save that leaves out a helper still in the folder is refused. **Writes.** | `group_id` *(uuid, required)*, `content` *(string, required)*, `project_id` *(uuid)*, `filename` *(string)*, `fixtures` *(array)* |
|
|
258
|
-
| `qcentriq_update_test_case` | Edit an existing test case (title, description, priority, preconditions, steps, expected result, target URL) instead of creating a duplicate. Requires `last_updated_at` from `qcentriq_get_test`; a newer edit by someone else is refused as a conflict. Reports `script_stale` when the change means the group script needs updating. Blocked status is not editable. **Writes.** | `test_case_id` *(uuid, required)*, `expected_last_updated_at` *(string, required)*, plus the fields to change, `project_id` *(uuid)* |
|
|
259
|
-
| `qcentriq_recheck_blocked_case` | Ask QCentriq to re-validate a blocked test case against the live site. QCentriq's own agent decides the verdict: `active` unblocks the case and adds it to the group script (in a group whose script you wrote, you add the test yourself), `blocked` refreshes `block_reason`. The caller cannot set the verdict. Can take several minutes (client timeout 7 min). **Writes.** | `test_case_id` *(uuid, required)*, `project_id` *(uuid)* |
|
|
260
|
-
|
|
261
|
-
### 💻 Local Client Tools (Executed in Your Local Workspace)
|
|
262
|
-
|
|
263
|
-
| Tool Name | Description | Key Arguments |
|
|
264
|
-
| :--- | :--- | :--- |
|
|
265
|
-
| `qcentriq_get_setup_instructions` | Detect which Python package managers (`uv`, `poetry`, `conda`, `venv`) are installed on the local system and return step-by-step commands to create a virtual environment matching the QCentriq runner container. If none are installed, the steps start by installing `uv`. *(Read-only instructions, never runs commands).* | `preferred_manager` *("uv"\|"poetry"\|"conda"\|"venv")*, `working_dir` *(string)*, `env_name` *(string, default "qcentriq-tests")*, `python_version` *(string, default "3.12")*, `playwright_version` *(string, default "1.56.0")* |
|
|
266
|
-
| `qcentriq_save_script` | Save a test script and its helper files (at their relative paths) directly into the local workspace (defaults to `./qcentriq_tests/`; use `./qcentriq_tests/<group_id>/` for a group) with path traversal guards. | `file_name` *(string, required)*, `content` *(string, required)*, `fixtures` *(array)*, `destination_dir` *(string, default "./qcentriq_tests")* |
|
|
267
|
-
| `qcentriq_run_local_test` | Run the test locally via `pytest`. Captures stdout, stderr, execution duration, and exit codes without triggering cloud runners. A whole-file pass qualifies that exact script for `qcentriq_save_group_script`. If no Python package manager is installed, it tells you to install `uv` first. | `file_path` *(string, required)*, `test_name` *(string)*, `headless` *(bool, default true)*, `browser` *("chromium"\|"firefox"\|"webkit", default "chromium")*, `base_url` *(url)*, `env_vars` *(record)*, `extra_args` *(array)*, `timeout_seconds` *(int, default 60)*, `working_dir` *(string)* |
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
## 🔄 End-to-End AI Self-Healing Workflow
|
|
271
|
-
|
|
272
|
-
Here is how an AI assistant (e.g. Cursor or Claude) uses `@qcentriq/mcp` to diagnose and fix a failing test:
|
|
273
|
-
|
|
274
|
-
```mermaid
|
|
275
|
-
sequenceDiagram
|
|
276
|
-
autonumber
|
|
277
|
-
actor User
|
|
278
|
-
participant AI as AI Assistant
|
|
279
|
-
participant MCP as QCentriq MCP Server
|
|
280
|
-
participant API as QCentriq Cloud API
|
|
281
|
-
participant Local as Local Workspace & Subprocess
|
|
282
|
-
|
|
283
|
-
User->>AI: "Fix the failing login test in QCentriq"
|
|
284
|
-
AI->>MCP: qcentriq_list_tests(priority="high")
|
|
285
|
-
MCP->>API: GET /api/v1/mcp-client/tests
|
|
286
|
-
API-->>MCP: Test cases metadata
|
|
287
|
-
MCP-->>AI: List of tests
|
|
288
|
-
|
|
289
|
-
AI->>MCP: qcentriq_get_test_run_logs(test_case_id="...")
|
|
290
|
-
MCP->>API: GET /api/v1/mcp-client/tests/{id}/run-logs
|
|
291
|
-
API-->>MCP: Failure trace (e.g. SelectorTimeoutError)
|
|
292
|
-
MCP-->>AI: Error diagnostics & stack trace
|
|
293
|
-
|
|
294
|
-
AI->>MCP: qcentriq_get_setup_instructions()
|
|
295
|
-
MCP-->>AI: Recommended setup commands (uv venv, uv pip install ...)
|
|
296
|
-
|
|
297
|
-
AI->>MCP: qcentriq_download_script(group_id="...")
|
|
298
|
-
MCP->>API: GET /api/v1/mcp-client/groups/{id}/script
|
|
299
|
-
API-->>MCP: Script & helper files
|
|
300
|
-
MCP->>Local: Write qcentriq_tests/<group_id>/test_login.py (+ helpers)
|
|
301
|
-
MCP-->>AI: File paths confirmed
|
|
302
|
-
|
|
303
|
-
AI->>Local: Inspect and update selector in test_login.py
|
|
304
|
-
AI->>MCP: qcentriq_run_local_test(file_path="qcentriq_tests/<group_id>/test_login.py", headless=false)
|
|
305
|
-
MCP->>Local: Run pytest with Playwright
|
|
306
|
-
Local-->>MCP: Test result (PASSED)
|
|
307
|
-
MCP-->>AI: PASSED (exit code 0, 1.42s)
|
|
308
|
-
AI->>User: "Fixed selector in qcentriq_tests/<group_id>/test_login.py and verified locally!"
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
## 🔒 Security & Privacy
|
|
313
|
-
|
|
314
|
-
- **Safe Network Boundary**: The client MCP server connects **exclusively** to `${baseUrl}/api/v1/mcp-client/` using HTTPS. Discovery and diagnostics tools only read. The authoring tools `qcentriq_create_plan`, `qcentriq_update_test_case`, `qcentriq_save_group_script` and `qcentriq_recheck_blocked_case` write to your project (creating and editing test groups/cases, replacing a group's script, and unblocking a case when QCentriq's live recheck confirms it works), and the backend rejects them unless the API key carries the `test:write` scope.
|
|
315
|
-
- **Local Pass Before Upload**: `qcentriq_save_group_script` refuses a script unless that exact content passed `qcentriq_run_local_test` in the current server session, as a whole file: no `test_name`, node id, or `-k`/`-m`/`--deselect`/`--lf`-style filters, and at least one test passed (not all skipped). Each companion file must match the file that sat next to the script during that run and not have changed since. Passing runs are kept in memory, so after a restart the script has to be run again. If no Python package manager is installed, the refusal says to install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) first (recommended), then use `qcentriq_get_setup_instructions`.
|
|
316
|
-
- **Client-Side Control**: Test executions, script modifications, and environment setups happen **locally on your machine**. No local code or files are uploaded without your knowledge.
|
|
317
|
-
- **Zero-Leak Redaction**: The server actively scans and redacts API keys (`qc_...`), bearer tokens, and embedded basic-auth credentials before returning data to the LLM.
|
|
318
|
-
- **Filesystem Security**: Path traversal attacks (e.g. `../../etc/passwd`) are blocked when writing test scripts and fixtures to disk.
|
|
319
|
-
- **Stdio Integrity**: All server diagnostic logs are strictly routed to `stderr`. Standard output (`stdout`) is reserved purely for JSON-RPC 2.0 communication.
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
## 💻 Local Development
|
|
323
|
-
|
|
324
|
-
```bash
|
|
325
|
-
# Clone the repository
|
|
326
|
-
git clone https://github.com/qcentriq/qcentriq.git
|
|
327
|
-
cd packages/qcentriq-mcp
|
|
328
|
-
|
|
329
|
-
# Install dependencies
|
|
330
|
-
npm install
|
|
331
|
-
|
|
332
|
-
# Run typecheck
|
|
333
|
-
npm run typecheck
|
|
334
|
-
|
|
335
|
-
# Run test suite
|
|
336
|
-
npm test
|
|
337
|
-
|
|
338
|
-
# Build production bundle with tsup
|
|
339
|
-
npm run build
|
|
340
|
-
|
|
341
|
-
# Run local development server with live reload
|
|
342
|
-
QCENTRIQ_API_KEY="qc_your_key" QCENTRIQ_BASE_URL="http://localhost:8787" npm run dev
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
## 📄 License
|
|
347
|
-
|
|
348
|
-
Apache-2.0 © [QCentriq](https://qcentriq.com)
|
|
1
|
+
# @qcentriq/mcp
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@qcentriq/mcp)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://nodejs.org)
|
|
6
|
+
[](https://modelcontextprotocol.io)
|
|
7
|
+
|
|
8
|
+
Official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for **QCentriq** automated test discovery, error diagnostics, script retrieval, and local test execution.
|
|
9
|
+
|
|
10
|
+
Connect your AI coding assistants (**Cursor**, **Claude Desktop**, **VS Code Cline / Roo Code**, **Windsurf**, **Zed**, or **Gemini / Antigravity**) directly to your QCentriq QA projects to inspect test cases, analyze failure logs, retrieve Playwright test scripts, and validate fixes locally.
|
|
11
|
+
|
|
12
|
+
## ⚡ Highlights
|
|
13
|
+
|
|
14
|
+
- **Remote Cloud Discovery & Diagnostics**: Instantly query test cases, groups, run logs, failure stack traces, and environment variables via authenticated REST client endpoints.
|
|
15
|
+
- **Local Playwright Test Execution**: Safely execute tests locally with `pytest` without triggering unwanted cloud runners. Supports headless and headed modes across Chromium, Firefox, and WebKit.
|
|
16
|
+
- **Smart Environment Setup**: Probes installed local Python package managers (`uv`, `poetry`, `conda`, or standard `venv`) and generates ready-to-run setup commands (prefers `uv` for lightning-fast setup).
|
|
17
|
+
- **Direct Workspace Script Saving**: Download test scripts and their helper files, nested folders included, into a per-group `qcentriq_tests/<group_id>/` workspace directory (kept apart from your own `tests/`, so an existing `conftest.py` is never overwritten). Before each local run there, `qcentriq_run_local_test` refreshes the `conftest.py` QCentriq cloud runs use with path traversal protections.
|
|
18
|
+
- **Zero-Leak Redaction**: Automatically filters all outgoing tool payloads, masking API keys (`qc_...`), bearer tokens, and URL credentials before sending them to the LLM.
|
|
19
|
+
- **Strict Stdio Isolation**: Protocol JSON-RPC frames communicate cleanly over `stdout`, while all diagnostic logs route to `stderr`.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 🚀 Quick Start
|
|
23
|
+
|
|
24
|
+
### Using `npx` (No installation needed)
|
|
25
|
+
|
|
26
|
+
Launch the MCP server directly using `npx`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx -y @qcentriq/mcp@latest --api-key "qc_your_api_key_here"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or pass your configuration via environment variables:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export QCENTRIQ_API_KEY="qc_your_api_key_here"
|
|
36
|
+
export QCENTRIQ_BASE_URL="https://api.qcentriq.com" # Optional, defaults to production
|
|
37
|
+
export QCENTRIQ_PROJECT_ID="your-project-uuid" # Optional default project ID
|
|
38
|
+
|
|
39
|
+
npx -y @qcentriq/mcp@latest
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Global Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g @qcentriq/mcp
|
|
46
|
+
qcentriq-mcp --api-key "qc_your_api_key_here"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## 📋 CLI Options & Environment Variables
|
|
51
|
+
|
|
52
|
+
| CLI Option | Environment Variable | Default | Description |
|
|
53
|
+
| :--- | :--- | :--- | :--- |
|
|
54
|
+
| `-k, --api-key <key>` | `QCENTRIQ_API_KEY` | *(Required)* | Your QCentriq API key (`qc_...`). |
|
|
55
|
+
| `-u, --base-url <url>` | `QCENTRIQ_BASE_URL` | `https://api.qcentriq.com` | Base URL of the QCentriq backend API. |
|
|
56
|
+
| `-p, --project-id <id>` | `QCENTRIQ_PROJECT_ID` | `undefined` | Optional default project UUID (inferred from API key if omitted). |
|
|
57
|
+
| `-d, --debug` | `DEBUG` or `QCENTRIQ_DEBUG` | `false` | Enable verbose debug logging to stderr. |
|
|
58
|
+
| `-h, --help` | — | — | Display CLI usage information and flags. |
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## ⚙️ Assistant Configuration Guides
|
|
62
|
+
|
|
63
|
+
### 1. Claude Desktop
|
|
64
|
+
|
|
65
|
+
Add QCentriq to your configuration file:
|
|
66
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
67
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
68
|
+
- **Linux**: `~/.config/Claude/claude_desktop_config.json`
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"qcentriq": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
76
|
+
"env": {
|
|
77
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
78
|
+
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com",
|
|
79
|
+
"QCENTRIQ_PROJECT_ID": "optional-default-project-uuid"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
### 2. Cursor IDE
|
|
88
|
+
|
|
89
|
+
In Cursor, open **Settings** $\to$ **Features** $\to$ **MCP Servers** $\to$ **Add New MCP Server**, or edit `~/.cursor/mcp.json` (or `.cursor/mcp.json` in your repository root):
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"qcentriq": {
|
|
95
|
+
"command": "npx",
|
|
96
|
+
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
97
|
+
"env": {
|
|
98
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
99
|
+
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
### 3. VS Code (Cline / Roo Code)
|
|
108
|
+
|
|
109
|
+
In VS Code with the Cline or Roo Code extension, open `cline_mcp_settings.json`:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"mcpServers": {
|
|
114
|
+
"qcentriq": {
|
|
115
|
+
"command": "npx",
|
|
116
|
+
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
117
|
+
"env": {
|
|
118
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
119
|
+
},
|
|
120
|
+
"disabled": false,
|
|
121
|
+
"autoApprove": [
|
|
122
|
+
"qcentriq_list_tests",
|
|
123
|
+
"qcentriq_get_test",
|
|
124
|
+
"qcentriq_get_test_groups",
|
|
125
|
+
"qcentriq_get_test_run_logs"
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### 4. Windsurf
|
|
134
|
+
|
|
135
|
+
In `~/.codeium/windsurf/mcp_config.json`:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"mcpServers": {
|
|
140
|
+
"qcentriq": {
|
|
141
|
+
"command": "npx",
|
|
142
|
+
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
143
|
+
"env": {
|
|
144
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
### 5. Zed
|
|
153
|
+
|
|
154
|
+
In your Zed `settings.json` (under `experimental.context_servers`):
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"context_servers": {
|
|
159
|
+
"qcentriq": {
|
|
160
|
+
"command": "npx",
|
|
161
|
+
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
162
|
+
"env": {
|
|
163
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
### 6. Gemini / Antigravity IDE
|
|
172
|
+
|
|
173
|
+
In `~/.gemini/config/mcp_config.json` (or `.agents/mcp_config.json` in workspace):
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"mcpServers": {
|
|
178
|
+
"qcentriq": {
|
|
179
|
+
"command": "npx",
|
|
180
|
+
"args": ["-y", "@qcentriq/mcp@latest"],
|
|
181
|
+
"env": {
|
|
182
|
+
"QCENTRIQ_API_KEY": "qc_your_api_key_here",
|
|
183
|
+
"QCENTRIQ_BASE_URL": "https://api.qcentriq.com"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
### 7. Claude Code CLI
|
|
192
|
+
|
|
193
|
+
Add the QCentriq MCP server using the Claude CLI:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
claude mcp add qcentriq -- npx -y @qcentriq/mcp@latest --api-key "qc_your_api_key_here"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### 🎭 Add Playwright MCP for writing tests (recommended)
|
|
201
|
+
|
|
202
|
+
Before writing a test plan or script, the assistant is told to explore your app in a real browser with the [Playwright MCP server](https://github.com/microsoft/playwright-mcp). That way, URLs, labels and selectors come from the pages themselves instead of guesses. QCentriq MCP cannot call Playwright MCP itself, so add it to the same client next to `qcentriq`:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"mcpServers": {
|
|
207
|
+
"playwright": {
|
|
208
|
+
"command": "npx",
|
|
209
|
+
"args": ["@playwright/mcp@latest"]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
With Claude Code: `claude mcp add playwright -- npx @playwright/mcp@latest`. If Playwright MCP is not connected, the assistant should say so before it writes a plan.
|
|
216
|
+
|
|
217
|
+
**Sites behind HTTP basic auth** (common on staging) answer 401 with a blank page until the browser logs in. The assistant is told to notice this and continue on its own. It takes the credentials from your request, or from the environment's `BASIC_AUTH_USERNAME` / `BASIC_AUTH_PASSWORD` variables (or the keys that `QCENTRIQ_BASIC_AUTH_USERNAME_KEY` / `QCENTRIQ_BASIC_AUTH_PASSWORD_KEY` name). Then it reopens the site with them in the URL, and Chromium remembers them for the rest of the session. It asks you only when the credentials are stored as secrets, because QCentriq never sends secret values to the assistant. To avoid that question, give Playwright MCP the credentials up front by starting it with `--config playwright-mcp.json`:
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"browser": {
|
|
222
|
+
"contextOptions": {
|
|
223
|
+
"httpCredentials": { "username": "staging-user", "password": "staging-password" }
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Scripts never contain the credentials. The `conftest.py` QCentriq ships applies them from `BASIC_AUTH_USERNAME` / `BASIC_AUTH_PASSWORD`, which the assistant passes to `qcentriq_run_local_test` in `env_vars` for local runs.
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
## 🛠️ Available MCP Tools
|
|
233
|
+
|
|
234
|
+
The QCentriq MCP Server cleanly separates **remote cloud discovery/diagnostics** (connected via authenticated REST endpoints to `/api/v1/mcp-client/`) and **local client operations** (executed purely inside your machine's local workspace):
|
|
235
|
+
|
|
236
|
+
### 🌐 Remote Discovery & Diagnostics (Cloud REST Endpoints)
|
|
237
|
+
|
|
238
|
+
| Tool Name | Description | Key Arguments |
|
|
239
|
+
| :--- | :--- | :--- |
|
|
240
|
+
| `qcentriq_list_tests` | Discover test cases and test groups with status, priority, and update timestamps. Script availability is highlighted. | `project_id` *(uuid)*, `group_id` *(uuid)*, `priority` *("low"\|"medium"\|"high"\|"critical")*, `test_type` *("web"\|"api"\|"mobile")*, `limit` *(int)*, `offset` *(int)* |
|
|
241
|
+
| `qcentriq_get_test` | Retrieve full test case definitions, step descriptions, preconditions, latest execution diagnostics, and error stack traces. | `test_case_id` *(uuid, required)*, `project_id` *(uuid)* |
|
|
242
|
+
| `qcentriq_get_test_groups` | Discover and inspect test groups, member test cases, test counts, and script availability. | `project_id` *(uuid)*, `group_id` *(uuid)*, `limit` *(int)*, `offset` *(int)* |
|
|
243
|
+
| `qcentriq_download_script` | Download a group's Playwright Python test script and its helper files and save them to `./qcentriq_tests/<group_id>/`, each helper at its relative path (e.g. `pages/login_page.py`). Pass `save_to_disk=false` to only return the content. | `group_id` *(uuid, required)*, `project_id` *(uuid)*, `include_fixtures` *(bool, default true)*, `save_to_disk` *(bool, default true)*, `destination_dir` *(string, default "./qcentriq_tests"; the group folder is created inside it)* |
|
|
244
|
+
| `qcentriq_get_environment` | Retrieve target environment configuration, base URL (`BASE_URL`), environment variables, and required secret variable names for local execution. | `project_id` *(uuid)*, `environment_id` *(uuid)*, `environment_name` *(string)* |
|
|
245
|
+
| `qcentriq_get_test_run_logs` | Fetch execution history, logs, stdout/stderr, and stack traces across single-case and suite runs. | `test_case_id` *(uuid, required)*, `project_id` *(uuid)*, `run_id` *(uuid)*, `status` *("failed"\|"passed"\|"error")*, `latest_only` *(bool)*, `from_date` *(ISO date)*, `to_date` *(ISO date)*, `limit` *(int)*, `offset` *(int)* |
|
|
246
|
+
|
|
247
|
+
### ✍️ Authoring (Cloud REST Endpoints, writes require `test:write`)
|
|
248
|
+
|
|
249
|
+
The intended order is: `qcentriq_get_authoring_guide` and `qcentriq_get_environment`, then explore the app with [Playwright MCP](#-add-playwright-mcp-for-writing-tests-recommended), then `qcentriq_create_plan`, then write the script, run it with `qcentriq_run_local_test` until it passes, and upload it with `qcentriq_save_group_script`. The server sends this order to the assistant as its MCP instructions.
|
|
250
|
+
|
|
251
|
+
Both write tools send to QCentriq as soon as they are called; your MCP client's own tool-approval prompt is the check before an upload (see [Security & Privacy](#-security--privacy)).
|
|
252
|
+
|
|
253
|
+
| Tool Name | Description | Key Arguments |
|
|
254
|
+
| :--- | :--- | :--- |
|
|
255
|
+
| `qcentriq_get_authoring_guide` | Fetch the contract for plans and scripts: the TaskPlan JSON schema, the `${VAR}` environment-variable convention, the `@allure.id` rules, and the available conftest fixtures. Read-only. | — |
|
|
256
|
+
| `qcentriq_create_plan` | Create test groups and test cases from an authored plan. Returns one UUID per created test case. A case whose flow failed in the browser can be created with `status: "blocked"` and an evidence `block_reason`; QCentriq re-validates it live and keeps it blocked only if it sees the same failure (`block_source` shows `client` until then). **Writes.** | `plan` *(object, required)*, `project_id` *(uuid)* |
|
|
257
|
+
| `qcentriq_save_group_script` | Validate and store a test script for a group, replacing the existing one. Every unblocked case in the group must appear exactly once as `@allure.id('<case_id>')`; blocked cases may be left out. Only uploads a script that passed `qcentriq_run_local_test` with this exact content (see [Local pass before upload](#-security--privacy)). Checked against the version from the last download or save of the group in this session, so someone else's newer edit is refused as a conflict instead of overwritten. `fixtures` is the group's complete helper set, each `file_name` relative to the script's folder: helpers left out are deleted, and a save that leaves out a helper still in the folder is refused. **Writes.** | `group_id` *(uuid, required)*, `content` *(string, required)*, `project_id` *(uuid)*, `filename` *(string)*, `fixtures` *(array)* |
|
|
258
|
+
| `qcentriq_update_test_case` | Edit an existing test case (title, description, priority, preconditions, steps, expected result, target URL) instead of creating a duplicate. Requires `last_updated_at` from `qcentriq_get_test`; a newer edit by someone else is refused as a conflict. Reports `script_stale` when the change means the group script needs updating. Blocked status is not editable. **Writes.** | `test_case_id` *(uuid, required)*, `expected_last_updated_at` *(string, required)*, plus the fields to change, `project_id` *(uuid)* |
|
|
259
|
+
| `qcentriq_recheck_blocked_case` | Ask QCentriq to re-validate a blocked test case against the live site. QCentriq's own agent decides the verdict: `active` unblocks the case and adds it to the group script (in a group whose script you wrote, you add the test yourself), `blocked` refreshes `block_reason`. The caller cannot set the verdict. Can take several minutes (client timeout 7 min). **Writes.** | `test_case_id` *(uuid, required)*, `project_id` *(uuid)* |
|
|
260
|
+
|
|
261
|
+
### 💻 Local Client Tools (Executed in Your Local Workspace)
|
|
262
|
+
|
|
263
|
+
| Tool Name | Description | Key Arguments |
|
|
264
|
+
| :--- | :--- | :--- |
|
|
265
|
+
| `qcentriq_get_setup_instructions` | Detect which Python package managers (`uv`, `poetry`, `conda`, `venv`) are installed on the local system and return step-by-step commands to create a virtual environment matching the QCentriq runner container. If none are installed, the steps start by installing `uv`. *(Read-only instructions, never runs commands).* | `preferred_manager` *("uv"\|"poetry"\|"conda"\|"venv")*, `working_dir` *(string)*, `env_name` *(string, default "qcentriq-tests")*, `python_version` *(string, default "3.12")*, `playwright_version` *(string, default "1.56.0")* |
|
|
266
|
+
| `qcentriq_save_script` | Save a test script and its helper files (at their relative paths) directly into the local workspace (defaults to `./qcentriq_tests/`; use `./qcentriq_tests/<group_id>/` for a group) with path traversal guards. | `file_name` *(string, required)*, `content` *(string, required)*, `fixtures` *(array)*, `destination_dir` *(string, default "./qcentriq_tests")* |
|
|
267
|
+
| `qcentriq_run_local_test` | Run the test locally via `pytest`. Captures stdout, stderr, execution duration, and exit codes without triggering cloud runners. A whole-file pass qualifies that exact script for `qcentriq_save_group_script`. If no Python package manager is installed, it tells you to install `uv` first. | `file_path` *(string, required)*, `test_name` *(string)*, `headless` *(bool, default true)*, `browser` *("chromium"\|"firefox"\|"webkit", default "chromium")*, `base_url` *(url)*, `env_vars` *(record)*, `extra_args` *(array)*, `timeout_seconds` *(int, default 60)*, `working_dir` *(string)* |
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
## 🔄 End-to-End AI Self-Healing Workflow
|
|
271
|
+
|
|
272
|
+
Here is how an AI assistant (e.g. Cursor or Claude) uses `@qcentriq/mcp` to diagnose and fix a failing test:
|
|
273
|
+
|
|
274
|
+
```mermaid
|
|
275
|
+
sequenceDiagram
|
|
276
|
+
autonumber
|
|
277
|
+
actor User
|
|
278
|
+
participant AI as AI Assistant
|
|
279
|
+
participant MCP as QCentriq MCP Server
|
|
280
|
+
participant API as QCentriq Cloud API
|
|
281
|
+
participant Local as Local Workspace & Subprocess
|
|
282
|
+
|
|
283
|
+
User->>AI: "Fix the failing login test in QCentriq"
|
|
284
|
+
AI->>MCP: qcentriq_list_tests(priority="high")
|
|
285
|
+
MCP->>API: GET /api/v1/mcp-client/tests
|
|
286
|
+
API-->>MCP: Test cases metadata
|
|
287
|
+
MCP-->>AI: List of tests
|
|
288
|
+
|
|
289
|
+
AI->>MCP: qcentriq_get_test_run_logs(test_case_id="...")
|
|
290
|
+
MCP->>API: GET /api/v1/mcp-client/tests/{id}/run-logs
|
|
291
|
+
API-->>MCP: Failure trace (e.g. SelectorTimeoutError)
|
|
292
|
+
MCP-->>AI: Error diagnostics & stack trace
|
|
293
|
+
|
|
294
|
+
AI->>MCP: qcentriq_get_setup_instructions()
|
|
295
|
+
MCP-->>AI: Recommended setup commands (uv venv, uv pip install ...)
|
|
296
|
+
|
|
297
|
+
AI->>MCP: qcentriq_download_script(group_id="...")
|
|
298
|
+
MCP->>API: GET /api/v1/mcp-client/groups/{id}/script
|
|
299
|
+
API-->>MCP: Script & helper files
|
|
300
|
+
MCP->>Local: Write qcentriq_tests/<group_id>/test_login.py (+ helpers)
|
|
301
|
+
MCP-->>AI: File paths confirmed
|
|
302
|
+
|
|
303
|
+
AI->>Local: Inspect and update selector in test_login.py
|
|
304
|
+
AI->>MCP: qcentriq_run_local_test(file_path="qcentriq_tests/<group_id>/test_login.py", headless=false)
|
|
305
|
+
MCP->>Local: Run pytest with Playwright
|
|
306
|
+
Local-->>MCP: Test result (PASSED)
|
|
307
|
+
MCP-->>AI: PASSED (exit code 0, 1.42s)
|
|
308
|
+
AI->>User: "Fixed selector in qcentriq_tests/<group_id>/test_login.py and verified locally!"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
## 🔒 Security & Privacy
|
|
313
|
+
|
|
314
|
+
- **Safe Network Boundary**: The client MCP server connects **exclusively** to `${baseUrl}/api/v1/mcp-client/` using HTTPS. Discovery and diagnostics tools only read. The authoring tools `qcentriq_create_plan`, `qcentriq_update_test_case`, `qcentriq_save_group_script` and `qcentriq_recheck_blocked_case` write to your project (creating and editing test groups/cases, replacing a group's script, and unblocking a case when QCentriq's live recheck confirms it works), and the backend rejects them unless the API key carries the `test:write` scope.
|
|
315
|
+
- **Local Pass Before Upload**: `qcentriq_save_group_script` refuses a script unless that exact content passed `qcentriq_run_local_test` in the current server session, as a whole file: no `test_name`, node id, or `-k`/`-m`/`--deselect`/`--lf`-style filters, and at least one test passed (not all skipped). Each companion file must match the file that sat next to the script during that run and not have changed since. Passing runs are kept in memory, so after a restart the script has to be run again. If no Python package manager is installed, the refusal says to install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) first (recommended), then use `qcentriq_get_setup_instructions`.
|
|
316
|
+
- **Client-Side Control**: Test executions, script modifications, and environment setups happen **locally on your machine**. No local code or files are uploaded without your knowledge.
|
|
317
|
+
- **Zero-Leak Redaction**: The server actively scans and redacts API keys (`qc_...`), bearer tokens, and embedded basic-auth credentials before returning data to the LLM.
|
|
318
|
+
- **Filesystem Security**: Path traversal attacks (e.g. `../../etc/passwd`) are blocked when writing test scripts and fixtures to disk.
|
|
319
|
+
- **Stdio Integrity**: All server diagnostic logs are strictly routed to `stderr`. Standard output (`stdout`) is reserved purely for JSON-RPC 2.0 communication.
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
## 💻 Local Development
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Clone the repository
|
|
326
|
+
git clone https://github.com/qcentriq/qcentriq.git
|
|
327
|
+
cd packages/qcentriq-mcp
|
|
328
|
+
|
|
329
|
+
# Install dependencies
|
|
330
|
+
npm install
|
|
331
|
+
|
|
332
|
+
# Run typecheck
|
|
333
|
+
npm run typecheck
|
|
334
|
+
|
|
335
|
+
# Run test suite
|
|
336
|
+
npm test
|
|
337
|
+
|
|
338
|
+
# Build production bundle with tsup
|
|
339
|
+
npm run build
|
|
340
|
+
|
|
341
|
+
# Run local development server with live reload
|
|
342
|
+
QCENTRIQ_API_KEY="qc_your_key" QCENTRIQ_BASE_URL="http://localhost:8787" npm run dev
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
## 📄 License
|
|
347
|
+
|
|
348
|
+
Apache-2.0 © [QCentriq](https://qcentriq.com)
|