@qcentriq/mcp 0.4.4 → 0.4.6

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
@@ -14,7 +14,7 @@ Connect your AI coding assistants (**Cursor**, **Claude Desktop**, **VS Code Cli
14
14
  - **Remote Cloud Discovery & Diagnostics**: Instantly query test cases, groups, run logs, failure stack traces, and environment variables via authenticated REST client endpoints.
15
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
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`) into a dedicated `qcentriq_tests/` workspace directory (kept apart from your own `tests/`, so an existing `conftest.py` is never overwritten) with path traversal protections.
17
+ - **Direct Workspace Script Saving**: Download test scripts and their helper files into a dedicated `qcentriq_tests/` 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
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
19
  - **Strict Stdio Isolation**: Protocol JSON-RPC frames communicate cleanly over `stdout`, while all diagnostic logs route to `stderr`.
20
20
 
@@ -240,7 +240,7 @@ The QCentriq MCP Server cleanly separates **remote cloud discovery/diagnostics**
240
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
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
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 Playwright Python test script and accompanying fixtures (`conftest.py`) and save them to `./qcentriq_tests/` (the same directory `qcentriq_save_script` uses). 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")* |
243
+ | `qcentriq_download_script` | Download Playwright Python test script and its helper files and save them to `./qcentriq_tests/` (the same directory `qcentriq_save_script` uses). 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")* |
244
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
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
246
 
@@ -296,8 +296,8 @@ sequenceDiagram
296
296
 
297
297
  AI->>MCP: qcentriq_download_script(group_id="...")
298
298
  MCP->>API: GET /api/v1/mcp-client/groups/{id}/script
299
- API-->>MCP: Script & conftest.py content
300
- MCP->>Local: Write qcentriq_tests/test_login.py & conftest.py
299
+ API-->>MCP: Script & helper files
300
+ MCP->>Local: Write qcentriq_tests/test_login.py
301
301
  MCP-->>AI: File paths confirmed
302
302
 
303
303
  AI->>Local: Inspect and update selector in test_login.py
package/dist/index.js CHANGED
@@ -314,11 +314,11 @@ function registerDownloadScriptTool(server, client, config, versions) {
314
314
  server.registerTool(
315
315
  "qcentriq_download_script",
316
316
  {
317
- description: `Download test group script and accompanying fixture files (e.g. conftest.py) for local test execution and editing. By default the files are written to '${DEFAULT_SCRIPT_DIR}', the same directory qcentriq_save_script uses, and their paths are returned in saved_files.`,
317
+ description: `Download test group script and accompanying helper files for local test execution and editing (qcentriq_run_local_test supplies the QCentriq conftest.py). By default the files are written to '${DEFAULT_SCRIPT_DIR}', the same directory qcentriq_save_script uses, and their paths are returned in saved_files.`,
318
318
  inputSchema: z5.object({
319
319
  group_id: z5.uuid().describe("UUID of the target test group."),
320
320
  project_id: z5.uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
321
- include_fixtures: z5.boolean().default(true).describe("Whether to retrieve accompanying conftest.py / fixtures (default True)."),
321
+ include_fixtures: z5.boolean().default(true).describe("Whether to retrieve accompanying helper files (default True)."),
322
322
  save_to_disk: z5.boolean().default(true).describe("Saves the downloaded test script and fixtures to destination_dir (default True). Set false to only return the content."),
323
323
  destination_dir: z5.string().default(DEFAULT_SCRIPT_DIR).describe(`Destination directory when save_to_disk is true (default '${DEFAULT_SCRIPT_DIR}'). Kept separate from a project's own ./tests so an existing conftest.py is never overwritten.`)
324
324
  })
@@ -407,7 +407,7 @@ function registerAuthoringGuideTool(server, client) {
407
407
  server.registerTool(
408
408
  "qcentriq_get_authoring_guide",
409
409
  {
410
- description: "Fetch the contract for authoring QCentriq test plans and scripts: the TaskPlan JSON schema, the ${VAR} environment-variable convention, the @allure.id rules a saved script is validated against, and the conftest fixtures a script may use. Call this before writing a plan or a test script \u2014 a script that violates the contract is rejected on save. Then explore the app under test with the Playwright MCP server (browser_navigate, browser_snapshot) before writing, so the plan and locators match what the app really shows.",
410
+ description: "Fetch the contract for authoring QCentriq test plans and scripts: the TaskPlan JSON schema, the ${VAR} environment-variable convention, the @allure.id rules and data-driven `state` placeholder rules a saved script is validated against, and the conftest fixtures a script may use. Call this before writing a plan or a test script \u2014 a script that violates the contract is rejected on save. Then explore the app under test with the Playwright MCP server (browser_navigate, browser_snapshot) before writing, so the plan and locators match what the app really shows.",
411
411
  inputSchema: z8.object({}),
412
412
  annotations: {
413
413
  readOnlyHint: true,
@@ -955,7 +955,7 @@ function buildTestEnv(params) {
955
955
  env.HEADLESS = params.headless ? "true" : "false";
956
956
  }
957
957
  if (params.groupId) {
958
- env.QCAQ_TEST_GROUP_ID = params.groupId;
958
+ env.QCENTRIQ_TEST_GROUP_ID = params.groupId;
959
959
  }
960
960
  return env;
961
961
  }
@@ -1058,18 +1058,18 @@ async function runLocalPytest(params) {
1058
1058
  }
1059
1059
 
1060
1060
  // src/tools/local-run.ts
1061
- function registerLocalRunTool(server, passingRuns) {
1061
+ function registerLocalRunTool(server, client, passingRuns) {
1062
1062
  server.registerTool(
1063
1063
  "qcentriq_run_local_test",
1064
1064
  {
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.",
1065
+ description: "Execute a downloaded Playwright/pytest test script locally in the developer's environment. Runs pytest as a local subprocess (in qcentriq_tests/ or any folder below it, it first refreshes the conftest.py QCentriq cloud runs use) 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.",
1066
1066
  inputSchema: z13.object({
1067
1067
  file_path: z13.string().describe("Path to the local test file to run (e.g. 'tests/test_login.py')."),
1068
1068
  test_name: z13.string().optional().describe("Optional specific test function name or expression to run (passed to pytest -k)."),
1069
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
1070
  browser: z13.enum(["chromium", "firefox", "webkit"]).default("chromium").describe("Browser engine to execute against (default 'chromium')."),
1071
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."),
1072
+ group_id: z13.string().optional().describe("Test group UUID this script belongs to. Injected as QCENTRIQ_TEST_GROUP_ID so the Allure results stay mappable back to the QCentriq group."),
1073
1073
  env_vars: z13.record(z13.string(), z13.string()).optional().describe("Environment variables to inject into the local test process."),
1074
1074
  extra_args: z13.array(z13.string()).optional().describe("Additional CLI arguments to pass to pytest (e.g. ['-s', '--alluredir=allure-results'])."),
1075
1075
  timeout_seconds: z13.number().int().min(5).max(300).default(60).describe("Timeout in seconds for test execution (default 60)."),
@@ -1079,6 +1079,8 @@ function registerLocalRunTool(server, passingRuns) {
1079
1079
  async (args) => {
1080
1080
  try {
1081
1081
  const scriptPath = path5.resolve(args.working_dir ?? process.cwd(), args.file_path.split("::")[0]);
1082
+ const ownDir = qcentriqDirAbove(path5.dirname(scriptPath));
1083
+ if (ownDir) await refreshConftest(client, ownDir);
1082
1084
  const content = await fs4.readFile(scriptPath, "utf-8").catch(() => null);
1083
1085
  const startedAt = Date.now();
1084
1086
  const result = await runLocalPytest({
@@ -1093,6 +1095,7 @@ function registerLocalRunTool(server, passingRuns) {
1093
1095
  timeoutSeconds: args.timeout_seconds,
1094
1096
  workingDir: args.working_dir
1095
1097
  });
1098
+ if (ownDir) await fs4.rm(path5.join(ownDir, "qc_state.json"), { force: true });
1096
1099
  const statusText = result.passed ? "PASSED" : "FAILED";
1097
1100
  const summary = [
1098
1101
  `Local Test Run Result: ${statusText} (exit code ${result.exitCode})`,
@@ -1117,6 +1120,20 @@ function registerLocalRunTool(server, passingRuns) {
1117
1120
  }
1118
1121
  );
1119
1122
  }
1123
+ function qcentriqDirAbove(dir) {
1124
+ for (let d = dir; ; d = path5.dirname(d)) {
1125
+ if (path5.basename(d) === path5.basename(DEFAULT_SCRIPT_DIR)) return d;
1126
+ if (path5.dirname(d) === d) return null;
1127
+ }
1128
+ }
1129
+ async function refreshConftest(client, dir) {
1130
+ try {
1131
+ const { content } = await client.request("/conftest");
1132
+ await fs4.writeFile(path5.join(dir, "conftest.py"), content, "utf-8");
1133
+ } catch (err) {
1134
+ logger.warn(`Could not refresh conftest.py: ${err.message}`);
1135
+ }
1136
+ }
1120
1137
  async function nextStep(result, args, scriptReadable) {
1121
1138
  if (result.pytestMissing) {
1122
1139
  const notice = installUvNotice(await detectPackageManagers());
@@ -1207,7 +1224,7 @@ function registerAllTools(server, client, config) {
1207
1224
  registerUpdateTestCaseTool(server, client, config);
1208
1225
  registerRecheckBlockedCaseTool(server, client, config);
1209
1226
  registerSaveScriptTool(server);
1210
- registerLocalRunTool(server, passingRuns);
1227
+ registerLocalRunTool(server, client, passingRuns);
1211
1228
  registerSetupInstructionsTool(server, client);
1212
1229
  logger.info("Registered QCentriq MCP tools.");
1213
1230
  }
@@ -1223,7 +1240,7 @@ To write a new test plan or script:
1223
1240
  1. Call qcentriq_get_authoring_guide for the plan schema and script rules, and qcentriq_get_environment for the BASE_URL of the app under test.
1224
1241
  2. Explore the app with the Playwright MCP server before writing anything. Start by navigating to the actual BASE_URL, then open each page under test (for example with browser_navigate), read it with browser_snapshot, and click through every flow the plan will cover. Take URLs, labels, roles and selectors from what the browser shows; do not guess them. If the Playwright MCP server is not connected, tell the user that the plan and script will be based on guesses about the app and recommend connecting it (npx @playwright/mcp@latest) before going on.
1225
1242
  3. Create the plan with qcentriq_create_plan, describing only flows you saw.
1226
- 4. Write the script using the locators you found, run it with qcentriq_run_local_test until the whole file passes, then upload it with qcentriq_save_group_script.
1243
+ 4. Write the script using the locators you found, reading every typed value through the state fixture as the guide's test_data_rules describe. Run it with qcentriq_run_local_test until the whole file passes, passing each variable an env.* placeholder reads in env_vars (env.admin_password reads ADMIN_PASSWORD; base_url covers env.base_url), then upload it with qcentriq_save_group_script. The first upload turns the script's defaults into each test case's data set.
1227
1244
 
1228
1245
  HTTP basic auth: a site behind basic auth answers 401 before any app content loads, so the page comes back blank (browser_snapshot shows nothing; browser_network_requests shows the 401). This is not the app's own login form. Do not stop there, and do not plan from the blank page:
1229
1246
  - Find the credentials the user defined: in their request, or in the variables from qcentriq_get_environment, either BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD or the keys named by QCENTRIQ_BASIC_AUTH_USERNAME_KEY and QCENTRIQ_BASIC_AUTH_PASSWORD_KEY.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qcentriq/mcp",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Official Model Context Protocol (MCP) server for QCentriq automated test discovery, diagnostics, and execution.",
5
5
  "type": "module",
6
6
  "bin": {