@qcentriq/mcp 0.4.3 → 0.4.4
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 +5 -3
- package/dist/index.js +115 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -253,8 +253,10 @@ Both write tools send to QCentriq as soon as they are called; your MCP client's
|
|
|
253
253
|
| Tool Name | Description | Key Arguments |
|
|
254
254
|
| :--- | :--- | :--- |
|
|
255
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. **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 case in the group must appear exactly once as `@allure.id('<case_id>')
|
|
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. **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)* |
|
|
258
260
|
|
|
259
261
|
### 💻 Local Client Tools (Executed in Your Local Workspace)
|
|
260
262
|
|
|
@@ -309,7 +311,7 @@ sequenceDiagram
|
|
|
309
311
|
|
|
310
312
|
## 🔒 Security & Privacy
|
|
311
313
|
|
|
312
|
-
- **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` and `
|
|
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.
|
|
313
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`.
|
|
314
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.
|
|
315
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.
|
package/dist/index.js
CHANGED
|
@@ -126,11 +126,14 @@ var QCentriqApiClient = class {
|
|
|
126
126
|
}
|
|
127
127
|
return this.call("GET", path6, query);
|
|
128
128
|
}
|
|
129
|
-
/**
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Authenticated JSON write against the QCentriq backend. `timeoutMs`
|
|
131
|
+
* overrides the configured timeout for a call known to be slow.
|
|
132
|
+
*/
|
|
133
|
+
async send(method, path6, body, opts = {}) {
|
|
134
|
+
return this.call(method, path6, void 0, body, opts.timeoutMs);
|
|
132
135
|
}
|
|
133
|
-
async call(method, path6, query, body) {
|
|
136
|
+
async call(method, path6, query, body, timeoutMs) {
|
|
134
137
|
const cleanPath = path6.startsWith("/") ? path6 : `/${path6}`;
|
|
135
138
|
const qs = query?.toString();
|
|
136
139
|
const url = `${this.config.baseUrl}/api/v1/mcp-client${cleanPath}${qs ? `?${qs}` : ""}`;
|
|
@@ -140,10 +143,13 @@ var QCentriqApiClient = class {
|
|
|
140
143
|
Accept: "application/json"
|
|
141
144
|
};
|
|
142
145
|
if (body) headers["Content-Type"] = "application/json";
|
|
143
|
-
const res = await this.fetchWithTimeout(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
146
|
+
const res = await this.fetchWithTimeout(
|
|
147
|
+
method,
|
|
148
|
+
cleanPath,
|
|
149
|
+
url,
|
|
150
|
+
{ headers, body: body ? JSON.stringify(body) : void 0 },
|
|
151
|
+
timeoutMs ?? this.config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS
|
|
152
|
+
);
|
|
147
153
|
if (!res.ok) {
|
|
148
154
|
throw new Error(`API error (${res.status}): ${await readErrorDetail(res)}`);
|
|
149
155
|
}
|
|
@@ -153,8 +159,7 @@ var QCentriqApiClient = class {
|
|
|
153
159
|
* Issue a request that is aborted after the configured timeout, reporting
|
|
154
160
|
* the timeout as such rather than as a bare AbortError.
|
|
155
161
|
*/
|
|
156
|
-
async fetchWithTimeout(method, path6, url, init) {
|
|
157
|
-
const timeoutMs = this.config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
162
|
+
async fetchWithTimeout(method, path6, url, init, timeoutMs) {
|
|
158
163
|
try {
|
|
159
164
|
return await fetch(url, { ...init, method, signal: AbortSignal.timeout(timeoutMs) });
|
|
160
165
|
} catch (err) {
|
|
@@ -423,7 +428,7 @@ function registerCreatePlanTool(server, client, config) {
|
|
|
423
428
|
server.registerTool(
|
|
424
429
|
"qcentriq_create_plan",
|
|
425
430
|
{
|
|
426
|
-
description: "Create test groups and test cases in QCentriq from a plan you authored. Call qcentriq_get_authoring_guide first, and walk through every flow in the plan with the Playwright MCP server (browser_navigate, browser_snapshot) when it is connected, so each test case describes behaviour you saw rather than guessed. The plan must match the TaskPlan schema, and any value that exists as a project environment variable must be written as ${VAR_NAME} rather than inlined. Returns one UUID per created test case; each must appear exactly once as @allure.id('<case_id>') in the script you then save with qcentriq_save_group_script. Requires an API key with the 'test:write' scope.",
|
|
431
|
+
description: "Create test groups and test cases in QCentriq from a plan you authored. Call qcentriq_get_authoring_guide first, and walk through every flow in the plan with the Playwright MCP server (browser_navigate, browser_snapshot) when it is connected, so each test case describes behaviour you saw rather than guessed. The plan must match the TaskPlan schema, and any value that exists as a project environment variable must be written as ${VAR_NAME} rather than inlined. Returns one UUID per created test case; each unblocked one must appear exactly once as @allure.id('<case_id>') in the script you then save with qcentriq_save_group_script. A case whose flow you saw fail in the browser may be created with status 'blocked' and a block_reason describing the failure: it is left out of the script, and QCentriq re-validates it live, keeping it blocked only if it sees the same failure. Never block a case because your script fails. Requires an API key with the 'test:write' scope.",
|
|
427
432
|
inputSchema: z9.object({
|
|
428
433
|
plan: z9.record(z9.string(), z9.any()).describe("The plan object, matching the TaskPlan schema from qcentriq_get_authoring_guide."),
|
|
429
434
|
project_id: z9.uuid().optional().describe("Optional project UUID (inferred from the API key if omitted).")
|
|
@@ -510,8 +515,8 @@ var FALLBACK_TEST_PACKAGES = [
|
|
|
510
515
|
"allure-pytest",
|
|
511
516
|
"httpx",
|
|
512
517
|
"nest-asyncio",
|
|
513
|
-
"
|
|
514
|
-
"
|
|
518
|
+
"Pillow",
|
|
519
|
+
"numpy"
|
|
515
520
|
];
|
|
516
521
|
function testDependencies(playwrightVersion, packages) {
|
|
517
522
|
const base = packages && packages.length > 0 ? packages : FALLBACK_TEST_PACKAGES;
|
|
@@ -796,7 +801,7 @@ function registerSaveGroupScriptTool(server, client, config, passingRuns, versio
|
|
|
796
801
|
server.registerTool(
|
|
797
802
|
"qcentriq_save_group_script",
|
|
798
803
|
{
|
|
799
|
-
description: "Save a test script you wrote back to QCentriq so the cloud runner executes exactly what you ran locally. Only a script that passed qcentriq_run_local_test as a whole file, with this exact content, is uploaded; each fixture must match the file next to it when it ran. The script is validated before it is stored: valid Python, and every test case in the group present exactly once as @allure.id('<case_id>') \u2014 no duplicates, no ids from other groups. A rejection names the offending id or line so you can correct it. The save is checked against the version from your last qcentriq_download_script (or save) of this group, so if someone else changed the script since, it is refused rather than overwritten; download again, reapply your change and save. conftest.py cannot be saved; QCentriq provides it. Requires the 'test:write' scope.",
|
|
804
|
+
description: "Save a test script you wrote back to QCentriq so the cloud runner executes exactly what you ran locally. Only a script that passed qcentriq_run_local_test as a whole file, with this exact content, is uploaded; each fixture must match the file next to it when it ran. The script is validated before it is stored: valid Python, and every unblocked test case in the group present exactly once as @allure.id('<case_id>') (blocked cases may be left out) \u2014 no duplicates, no ids from other groups. A rejection names the offending id or line so you can correct it. The save is checked against the version from your last qcentriq_download_script (or save) of this group, so if someone else changed the script since, it is refused rather than overwritten; download again, reapply your change and save. conftest.py cannot be saved; QCentriq provides it. Requires the 'test:write' scope.",
|
|
800
805
|
inputSchema: z10.object({
|
|
801
806
|
group_id: z10.uuid().describe("UUID of the target test group."),
|
|
802
807
|
content: z10.string().describe("The Python test script source."),
|
|
@@ -852,8 +857,83 @@ ${notice}` : reason;
|
|
|
852
857
|
return null;
|
|
853
858
|
}
|
|
854
859
|
|
|
855
|
-
// src/tools/
|
|
860
|
+
// src/tools/recheck-blocked-case.ts
|
|
856
861
|
import { z as z11 } from "zod";
|
|
862
|
+
var RECHECK_TIMEOUT_MS = 42e4;
|
|
863
|
+
function registerRecheckBlockedCaseTool(server, client, config) {
|
|
864
|
+
server.registerTool(
|
|
865
|
+
"qcentriq_recheck_blocked_case",
|
|
866
|
+
{
|
|
867
|
+
description: "Ask QCentriq to re-validate a blocked test case against the live site. QCentriq's own agent replays the case in a browser and decides: an 'active' verdict unblocks the case and adds it to the group script (for a group whose script you wrote, QCentriq leaves the script alone and next_step tells you to add the test); 'blocked' keeps it blocked with fresh evidence in block_reason. You cannot choose the verdict. Use it after the cause of the block (a broken page, wrong data) has been fixed; find blocked cases with qcentriq_list_tests. Takes up to a few minutes. After an unblock, re-download the group script before editing it. Requires an API key with the 'test:write' scope.",
|
|
868
|
+
inputSchema: z11.object({
|
|
869
|
+
test_case_id: z11.uuid().describe("UUID of the blocked test case."),
|
|
870
|
+
project_id: z11.uuid().optional().describe("Optional project UUID (inferred from the API key if omitted).")
|
|
871
|
+
}),
|
|
872
|
+
annotations: {
|
|
873
|
+
readOnlyHint: false,
|
|
874
|
+
destructiveHint: false,
|
|
875
|
+
// Changes only blocked status, and only on the server's verdict.
|
|
876
|
+
idempotentHint: false,
|
|
877
|
+
// Each call is a fresh live run whose verdict can differ.
|
|
878
|
+
openWorldHint: true
|
|
879
|
+
// Drives a browser against the project's live site.
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
async ({ test_case_id, project_id }) => {
|
|
883
|
+
try {
|
|
884
|
+
return jsonResult(
|
|
885
|
+
await client.send(
|
|
886
|
+
"POST",
|
|
887
|
+
`/tests/${test_case_id}/recheck`,
|
|
888
|
+
{ project_id: project_id || config.defaultProjectId },
|
|
889
|
+
{ timeoutMs: RECHECK_TIMEOUT_MS }
|
|
890
|
+
)
|
|
891
|
+
);
|
|
892
|
+
} catch (err) {
|
|
893
|
+
const hint = /timed out/.test(err.message) ? " The recheck may still complete on the server; call qcentriq_get_test for this case to see whether it is still blocked." : "";
|
|
894
|
+
return errorResult(`Error in qcentriq_recheck_blocked_case: ${err.message}${hint}`);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// src/tools/update-test-case.ts
|
|
901
|
+
import { z as z12 } from "zod";
|
|
902
|
+
function registerUpdateTestCaseTool(server, client, config) {
|
|
903
|
+
server.registerTool(
|
|
904
|
+
"qcentriq_update_test_case",
|
|
905
|
+
{
|
|
906
|
+
description: "Edit an existing test case's content instead of creating a duplicate with qcentriq_create_plan. Read the case with qcentriq_get_test first and pass its last_updated_at as expected_last_updated_at; if someone edited it since, the call fails with 409 and you must re-read and reapply. Send only the fields you change. Blocked/active status cannot be edited here (use qcentriq_recheck_blocked_case). If the response says script_stale, update the group script to match: qcentriq_download_script, edit, qcentriq_run_local_test, qcentriq_save_group_script. Requires an API key with the 'test:write' scope.",
|
|
907
|
+
inputSchema: z12.object({
|
|
908
|
+
test_case_id: z12.uuid().describe("UUID of the test case to edit."),
|
|
909
|
+
expected_last_updated_at: z12.string().describe("last_updated_at from your latest qcentriq_get_test of this case."),
|
|
910
|
+
title: z12.string().min(1).max(255).optional(),
|
|
911
|
+
description: z12.string().optional(),
|
|
912
|
+
priority: z12.enum(["high", "medium", "low"]).optional(),
|
|
913
|
+
preconditions: z12.string().optional(),
|
|
914
|
+
steps_description: z12.string().optional(),
|
|
915
|
+
expected_result: z12.string().optional(),
|
|
916
|
+
target_url: z12.string().optional().describe("Write project environment values as ${VAR_NAME}."),
|
|
917
|
+
project_id: z12.uuid().optional().describe("Optional project UUID (inferred from the API key if omitted).")
|
|
918
|
+
}),
|
|
919
|
+
annotations: {
|
|
920
|
+
readOnlyHint: false,
|
|
921
|
+
destructiveHint: true,
|
|
922
|
+
// Overwrites the fields it is given.
|
|
923
|
+
idempotentHint: false,
|
|
924
|
+
// A repeat carries a stale version and is refused.
|
|
925
|
+
openWorldHint: false
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
async ({ test_case_id, project_id, ...edit }) => backendCall(
|
|
929
|
+
"qcentriq_update_test_case",
|
|
930
|
+
() => client.send("PATCH", `/tests/${test_case_id}`, { project_id: project_id || config.defaultProjectId, ...edit })
|
|
931
|
+
)
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
// src/tools/local-run.ts
|
|
936
|
+
import { z as z13 } from "zod";
|
|
857
937
|
import * as fs4 from "fs/promises";
|
|
858
938
|
import * as path5 from "path";
|
|
859
939
|
|
|
@@ -983,17 +1063,17 @@ function registerLocalRunTool(server, passingRuns) {
|
|
|
983
1063
|
"qcentriq_run_local_test",
|
|
984
1064
|
{
|
|
985
1065
|
description: "Execute a downloaded Playwright/pytest test script locally in the developer's environment. Runs pytest as a local subprocess and returns stdout, stderr, exit code, and test diagnostics without using QCentriq cloud runners. A script must pass here, as a whole file (no test_name or other test filters), before qcentriq_save_group_script will upload it.",
|
|
986
|
-
inputSchema:
|
|
987
|
-
file_path:
|
|
988
|
-
test_name:
|
|
989
|
-
headless:
|
|
990
|
-
browser:
|
|
991
|
-
base_url:
|
|
992
|
-
group_id:
|
|
993
|
-
env_vars:
|
|
994
|
-
extra_args:
|
|
995
|
-
timeout_seconds:
|
|
996
|
-
working_dir:
|
|
1066
|
+
inputSchema: z13.object({
|
|
1067
|
+
file_path: z13.string().describe("Path to the local test file to run (e.g. 'tests/test_login.py')."),
|
|
1068
|
+
test_name: z13.string().optional().describe("Optional specific test function name or expression to run (passed to pytest -k)."),
|
|
1069
|
+
headless: z13.boolean().default(true).describe("Whether to run the browser in headless mode (default True). Set False to watch the browser execution live."),
|
|
1070
|
+
browser: z13.enum(["chromium", "firefox", "webkit"]).default("chromium").describe("Browser engine to execute against (default 'chromium')."),
|
|
1071
|
+
base_url: z13.url().optional().describe("Target application base URL (e.g. from qcentriq_get_environment). Injected as BASE_URL env var."),
|
|
1072
|
+
group_id: z13.string().optional().describe("Test group UUID this script belongs to. Injected as QCAQ_TEST_GROUP_ID so the Allure results stay mappable back to the QCentriq group."),
|
|
1073
|
+
env_vars: z13.record(z13.string(), z13.string()).optional().describe("Environment variables to inject into the local test process."),
|
|
1074
|
+
extra_args: z13.array(z13.string()).optional().describe("Additional CLI arguments to pass to pytest (e.g. ['-s', '--alluredir=allure-results'])."),
|
|
1075
|
+
timeout_seconds: z13.number().int().min(5).max(300).default(60).describe("Timeout in seconds for test execution (default 60)."),
|
|
1076
|
+
working_dir: z13.string().optional().describe("Working directory to run pytest in (defaults to current project directory).")
|
|
997
1077
|
})
|
|
998
1078
|
},
|
|
999
1079
|
async (args) => {
|
|
@@ -1059,7 +1139,7 @@ async function nextStep(result, args, scriptReadable) {
|
|
|
1059
1139
|
}
|
|
1060
1140
|
|
|
1061
1141
|
// src/tools/setup-instructions.ts
|
|
1062
|
-
import { z as
|
|
1142
|
+
import { z as z14 } from "zod";
|
|
1063
1143
|
async function fetchRuntimeRequirements(client) {
|
|
1064
1144
|
try {
|
|
1065
1145
|
const res = await client.request("/runtime-requirements");
|
|
@@ -1077,12 +1157,12 @@ function registerSetupInstructionsTool(server, client) {
|
|
|
1077
1157
|
"qcentriq_get_setup_instructions",
|
|
1078
1158
|
{
|
|
1079
1159
|
description: "Check which Python package managers (uv, poetry, conda, or the stdlib venv module) are installed on the developer's machine and return step-by-step commands for creating an environment that can run QCentriq Playwright/pytest tests locally. Prefers uv when it is available; if no package manager is installed, the steps start by installing uv. Returns instructions only \u2014 it does not create the environment.",
|
|
1080
|
-
inputSchema:
|
|
1081
|
-
preferred_manager:
|
|
1082
|
-
working_dir:
|
|
1083
|
-
env_name:
|
|
1084
|
-
python_version:
|
|
1085
|
-
playwright_version:
|
|
1160
|
+
inputSchema: z14.object({
|
|
1161
|
+
preferred_manager: z14.enum(["uv", "poetry", "conda", "venv"]).optional().describe("Force instructions for a specific package manager. Falls back to the best available one if it is not installed."),
|
|
1162
|
+
working_dir: z14.string().optional().describe("Directory to inspect for pyproject.toml / lockfiles / requirements.txt (defaults to the current project directory)."),
|
|
1163
|
+
env_name: z14.string().default("qcentriq-tests").describe("Name for the created environment (used by conda, default 'qcentriq-tests')."),
|
|
1164
|
+
python_version: z14.string().default("3.12").describe("Python version to request when creating the environment (default '3.12', matching the QCentriq execution container)."),
|
|
1165
|
+
playwright_version: z14.string().optional().describe("Playwright version to pin when installing test dependencies. Defaults to the version the project's active execution image is built against, as reported by the backend.")
|
|
1086
1166
|
}),
|
|
1087
1167
|
annotations: {
|
|
1088
1168
|
readOnlyHint: true,
|
|
@@ -1124,6 +1204,8 @@ function registerAllTools(server, client, config) {
|
|
|
1124
1204
|
registerAuthoringGuideTool(server, client);
|
|
1125
1205
|
registerCreatePlanTool(server, client, config);
|
|
1126
1206
|
registerSaveGroupScriptTool(server, client, config, passingRuns, versions);
|
|
1207
|
+
registerUpdateTestCaseTool(server, client, config);
|
|
1208
|
+
registerRecheckBlockedCaseTool(server, client, config);
|
|
1127
1209
|
registerSaveScriptTool(server);
|
|
1128
1210
|
registerLocalRunTool(server, passingRuns);
|
|
1129
1211
|
registerSetupInstructionsTool(server, client);
|