@qcentriq/mcp 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,35 +1,68 @@
1
1
  # @qcentriq/mcp
2
2
 
3
- Official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for **QCentriq** automated test discovery, error diagnostics, self-healing, and cloud execution.
3
+ [![npm version](https://img.shields.io/npm/v/@qcentriq/mcp.svg?style=flat-square)](https://www.npmjs.com/package/@qcentriq/mcp)
4
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg?style=flat-square)](LICENSE)
5
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg?style=flat-square)](https://nodejs.org)
6
+ [![MCP](https://img.shields.io/badge/protocol-Model%20Context%20Protocol-orange.svg?style=flat-square)](https://modelcontextprotocol.io)
4
7
 
5
- Connect your favorite AI coding assistant (**Cursor**, **Claude Desktop**, **VS Code Cline / Roo Code**, **Windsurf**, or **Zed**) directly to your QCentriq QA projects.
8
+ Official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for **QCentriq** automated test discovery, error diagnostics, script retrieval, and local test execution.
6
9
 
7
- ---
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.
8
11
 
9
- ## 🚀 Quick Start (npx)
12
+ ## ⚡ Highlights
10
13
 
11
- You do not need to install anything globally. You can launch the server instantly using `npx`:
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 accompanying fixtures (`conftest.py`) directly to your workspace `tests/` directory 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`:
12
27
 
13
28
  ```bash
14
29
  npx -y @qcentriq/mcp --api-key "qc_your_api_key_here"
15
30
  ```
16
31
 
17
- Or set environment variables:
32
+ Or pass your configuration via environment variables:
18
33
 
19
34
  ```bash
20
35
  export QCENTRIQ_API_KEY="qc_your_api_key_here"
21
- export QCENTRIQ_BASE_URL="https://api.qcentriq.com" # optional, defaults to production
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
22
38
 
23
39
  npx -y @qcentriq/mcp
24
40
  ```
25
41
 
26
- ---
42
+ ### Global Installation
43
+
44
+ ```bash
45
+ npm install -g @qcentriq/mcp
46
+ qcentriq-mcp --api-key "qc_your_api_key_here"
47
+ ```
48
+
27
49
 
28
- ## ⚙️ Configuration Guides
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
29
62
 
30
63
  ### 1. Claude Desktop
31
64
 
32
- Add QCentriq to your `claude_desktop_config.json`:
65
+ Add QCentriq to your configuration file:
33
66
  - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
34
67
  - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
35
68
  - **Linux**: `~/.config/Claude/claude_desktop_config.json`
@@ -50,7 +83,6 @@ Add QCentriq to your `claude_desktop_config.json`:
50
83
  }
51
84
  ```
52
85
 
53
- ---
54
86
 
55
87
  ### 2. Cursor IDE
56
88
 
@@ -71,7 +103,6 @@ In Cursor, open **Settings** $\to$ **Features** $\to$ **MCP Servers** $\to$ **Ad
71
103
  }
72
104
  ```
73
105
 
74
- ---
75
106
 
76
107
  ### 3. VS Code (Cline / Roo Code)
77
108
 
@@ -98,7 +129,6 @@ In VS Code with the Cline or Roo Code extension, open `cline_mcp_settings.json`:
98
129
  }
99
130
  ```
100
131
 
101
- ---
102
132
 
103
133
  ### 4. Windsurf
104
134
 
@@ -118,58 +148,154 @@ In `~/.codeium/windsurf/mcp_config.json`:
118
148
  }
119
149
  ```
120
150
 
121
- ---
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"],
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"],
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 --api-key "qc_your_api_key_here"
197
+ ```
198
+
122
199
 
123
200
  ## 🛠️ Available MCP Tools
124
201
 
125
- The QCentriq MCP Server cleanly separates **remote cloud discovery/diagnostics** (connected exclusively to `api/v1/mcp/sse`) and **local client operations** (executed purely inside your machine's environment):
202
+ 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):
203
+
204
+ ### 🌐 Remote Discovery & Diagnostics (Cloud REST Endpoints)
126
205
 
127
- ### 🌐 Remote Discovery & Diagnostics (via `/api/v1/mcp/sse`)
128
206
  | Tool Name | Description | Key Arguments |
129
207
  | :--- | :--- | :--- |
130
- | `qcentriq_list_tests` | Discover test cases, groups, status, priority, and update timestamps. | `project_id`, `group_id`, `priority`, `test_type`, `limit`, `offset` |
131
- | `qcentriq_get_test` | Fetch full test case details, step definitions, preconditions, and latest execution failure diagnostics. | `test_case_id`, `project_id` |
132
- | `qcentriq_get_test_groups` | Discover and inspect test groups, member cases, and whether an automation script exists. | `project_id`, `group_id`, `limit`, `offset` |
133
- | `qcentriq_download_script` | Download Playwright Python test script and accompanying fixtures (`conftest.py`) from storage. | `group_id`, `project_id`, `include_fixtures` |
134
- | `qcentriq_get_environment` | Retrieve target environment configuration, base URL (`BASE_URL`), and variables for local execution. | `project_id`, `environment_id`, `environment_name`, `include_secrets` |
135
- | `qcentriq_get_test_run_logs` | Fetch execution history, logs, stdout/stderr, and stack traces across single-case, suite, and group runs. | `test_case_id`, `project_id`, `run_id`, `status`, `latest_only`, `from_date`, `to_date` |
136
-
137
- ### 💻 Client-Focused Local Tools (Executed Locally on Your Machine)
208
+ | `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)* |
209
+ | `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)* |
210
+ | `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)* |
211
+ | `qcentriq_download_script` | Download Playwright Python test script and accompanying fixtures (`conftest.py`). Can optionally save files directly to disk. | `group_id` *(uuid, required)*, `project_id` *(uuid)*, `include_fixtures` *(bool, default true)*, `save_to_disk` *(bool, default false)*, `destination_dir` *(string, default "./tests")* |
212
+ | `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)* |
213
+ | `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)* |
214
+
215
+ ### 💻 Local Client Tools (Executed in Your Local Workspace)
216
+
138
217
  | Tool Name | Description | Key Arguments |
139
218
  | :--- | :--- | :--- |
140
- | `qcentriq_save_script` | Save downloaded test scripts and fixtures directly to your local workspace disk (`tests/` folder). | `file_name`, `content`, `conftest_content`, `destination_dir` |
141
- | `qcentriq_run_local_test` | Run the test locally in your environment via `pytest`. Captures stdout, stderr, exit code, and test duration without triggering cloud runners. | `file_path`, `test_name`, `headless`, `browser`, `base_url`, `env_vars`, `extra_args`, `timeout_seconds` |
219
+ | `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. *(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")* |
220
+ | `qcentriq_save_script` | Save downloaded test scripts and fixtures directly into the local workspace (defaults to `./tests/`) with path traversal guards. | `file_name` *(string, required)*, `content` *(string, required)*, `conftest_content` *(string)*, `destination_dir` *(string, default "./tests")* |
221
+ | `qcentriq_run_local_test` | Run the test locally via `pytest`. Captures stdout, stderr, execution duration, and exit codes without triggering cloud runners. | `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)* |
222
+
223
+
224
+ ## 🔄 End-to-End AI Self-Healing Workflow
225
+
226
+ Here is how an AI assistant (e.g. Cursor or Claude) uses `@qcentriq/mcp` to diagnose and fix a failing test:
227
+
228
+ ```mermaid
229
+ sequenceDiagram
230
+ autonumber
231
+ actor User
232
+ participant AI as AI Assistant
233
+ participant MCP as QCentriq MCP Server
234
+ participant API as QCentriq Cloud API
235
+ participant Local as Local Workspace & Subprocess
236
+
237
+ User->>AI: "Fix the failing login test in QCentriq"
238
+ AI->>MCP: qcentriq_list_tests(priority="high")
239
+ MCP->>API: GET /api/v1/mcp-client/tests
240
+ API-->>MCP: Test cases metadata
241
+ MCP-->>AI: List of tests
242
+
243
+ AI->>MCP: qcentriq_get_test_run_logs(test_case_id="...")
244
+ MCP->>API: GET /api/v1/mcp-client/tests/{id}/run-logs
245
+ API-->>MCP: Failure trace (e.g. SelectorTimeoutError)
246
+ MCP-->>AI: Error diagnostics & stack trace
247
+
248
+ AI->>MCP: qcentriq_get_setup_instructions()
249
+ MCP-->>AI: Recommended setup commands (uv venv, uv pip install ...)
250
+
251
+ AI->>MCP: qcentriq_download_script(group_id="...", save_to_disk=true)
252
+ MCP->>API: GET /api/v1/mcp-client/groups/{id}/script
253
+ API-->>MCP: Script & conftest.py content
254
+ MCP->>Local: Write tests/test_login.py & conftest.py
255
+ MCP-->>AI: File paths confirmed
256
+
257
+ AI->>Local: Inspect and update selector in test_login.py
258
+ AI->>MCP: qcentriq_run_local_test(file_path="tests/test_login.py", headless=false)
259
+ MCP->>Local: Run pytest with Playwright
260
+ Local-->>MCP: Test result (PASSED)
261
+ MCP-->>AI: PASSED (exit code 0, 1.42s)
262
+ AI->>User: "Fixed selector in tests/test_login.py and verified locally!"
263
+ ```
142
264
 
143
- ---
144
265
 
145
266
  ## 🔒 Security & Privacy
146
267
 
147
- - **Safe Network Boundary**: The client MCP server connects **exclusively** to `${baseUrl}/api/v1/mcp/sse`. It does not trigger remote cloud runs or invoke unwanted cloud integration endpoints.
148
- - **Client-Focused Execution**: Test runs and file saves are executed locally on your machine, giving you full control and privacy.
149
- - **Zero-Leak Redaction**: The MCP server filters all outgoing tool payloads, masking API keys (`qc_...`), bearer tokens, and URL credentials (`https://user:pass@...`) to prevent accidental leaks to LLM contexts.
150
- - **Strict Stdio Isolation**: Diagnostic logging is strictly directed to `stderr`, leaving standard output (`stdout`) pristine for JSON-RPC 2.0 protocol frames.
268
+ - **Safe Network Boundary**: The client MCP server connects **exclusively** to `${baseUrl}/api/v1/mcp-client/` using HTTPS. It only performs read operations against cloud test definitions and diagnostic logs.
269
+ - **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.
270
+ - **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.
271
+ - **Filesystem Security**: Path traversal attacks (e.g. `../../etc/passwd`) are blocked when writing test scripts and fixtures to disk.
272
+ - **Stdio Integrity**: All server diagnostic logs are strictly routed to `stderr`. Standard output (`stdout`) is reserved purely for JSON-RPC 2.0 communication.
151
273
 
152
- ---
153
274
 
154
275
  ## 💻 Local Development
155
276
 
156
277
  ```bash
157
- # Clone and install dependencies
278
+ # Clone the repository
279
+ git clone https://github.com/qcentriq/qcentriq.git
158
280
  cd packages/qcentriq-mcp
281
+
282
+ # Install dependencies
159
283
  npm install
160
284
 
161
- # Run tests
285
+ # Run typecheck
286
+ npm run typecheck
287
+
288
+ # Run test suite
162
289
  npm test
163
290
 
164
- # Build production bundle
291
+ # Build production bundle with tsup
165
292
  npm run build
166
293
 
167
- # Run in development mode
168
- QCENTRIQ_API_KEY="qc_..." QCENTRIQ_BASE_URL="http://localhost:8787" npm run dev
294
+ # Run local development server with live reload
295
+ QCENTRIQ_API_KEY="qc_your_key" QCENTRIQ_BASE_URL="http://localhost:8787" npm run dev
169
296
  ```
170
297
 
171
- ---
172
298
 
173
299
  ## 📄 License
174
300
 
175
- Apache-2.0 © QCentriq
301
+ Apache-2.0 © [QCentriq](https://qcentriq.com)