@qcentriq/mcp 0.2.0 → 0.3.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/README.md +18 -10
- package/dist/index.js +368 -177
- package/dist/index.js.map +1 -1
- package/package.json +11 -4
package/dist/index.js
CHANGED
|
@@ -96,6 +96,21 @@ function sanitizePayload(value) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// src/client/api.ts
|
|
99
|
+
async function readErrorDetail(res) {
|
|
100
|
+
let text;
|
|
101
|
+
try {
|
|
102
|
+
text = await res.text();
|
|
103
|
+
} catch {
|
|
104
|
+
return res.statusText;
|
|
105
|
+
}
|
|
106
|
+
if (!text) return res.statusText;
|
|
107
|
+
try {
|
|
108
|
+
const json = JSON.parse(text);
|
|
109
|
+
return json?.detail || JSON.stringify(json);
|
|
110
|
+
} catch {
|
|
111
|
+
return text;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
99
114
|
var QCentriqApiClient = class {
|
|
100
115
|
config;
|
|
101
116
|
constructor(config) {
|
|
@@ -121,15 +136,32 @@ var QCentriqApiClient = class {
|
|
|
121
136
|
}
|
|
122
137
|
});
|
|
123
138
|
if (!res.ok) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
139
|
+
throw new Error(`API error (${res.status}): ${await readErrorDetail(res)}`);
|
|
140
|
+
}
|
|
141
|
+
const data = await res.json();
|
|
142
|
+
return sanitizePayload(data);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Make an authenticated write request to the QCentriq backend.
|
|
146
|
+
*
|
|
147
|
+
* Separate from `request`, which is GET-only: a write must never be retried
|
|
148
|
+
* or cached the way a read can be.
|
|
149
|
+
*/
|
|
150
|
+
async send(method, path5, body) {
|
|
151
|
+
const cleanPath = path5.startsWith("/") ? path5 : `/${path5}`;
|
|
152
|
+
const url = `${this.config.baseUrl}/api/v1/mcp-client${cleanPath}`;
|
|
153
|
+
logger.debug(`[mcp-client] HTTP ${method} ${url}`);
|
|
154
|
+
const res = await fetch(url, {
|
|
155
|
+
method,
|
|
156
|
+
headers: {
|
|
157
|
+
Authorization: `Bearer ${this.config.apiKey}`,
|
|
158
|
+
Accept: "application/json",
|
|
159
|
+
"Content-Type": "application/json"
|
|
160
|
+
},
|
|
161
|
+
body: JSON.stringify(body)
|
|
162
|
+
});
|
|
163
|
+
if (!res.ok) {
|
|
164
|
+
throw new Error(`API error (${res.status}): ${await readErrorDetail(res)}`);
|
|
133
165
|
}
|
|
134
166
|
const data = await res.json();
|
|
135
167
|
return sanitizePayload(data);
|
|
@@ -143,12 +175,13 @@ var QCentriqApiClient = class {
|
|
|
143
175
|
let data;
|
|
144
176
|
switch (toolName) {
|
|
145
177
|
case "qcentriq_list_tests": {
|
|
146
|
-
const { project_id, group_id, priority, test_type, limit, offset } = args;
|
|
178
|
+
const { project_id, group_id, priority, test_type, status, limit, offset } = args;
|
|
147
179
|
data = await this.request("/tests", {
|
|
148
180
|
project_id,
|
|
149
181
|
group_id,
|
|
150
182
|
priority,
|
|
151
183
|
test_type,
|
|
184
|
+
status,
|
|
152
185
|
limit,
|
|
153
186
|
offset
|
|
154
187
|
});
|
|
@@ -178,12 +211,11 @@ var QCentriqApiClient = class {
|
|
|
178
211
|
break;
|
|
179
212
|
}
|
|
180
213
|
case "qcentriq_get_environment": {
|
|
181
|
-
const { project_id, environment_id, environment_name
|
|
214
|
+
const { project_id, environment_id, environment_name } = args;
|
|
182
215
|
data = await this.request("/environment", {
|
|
183
216
|
project_id,
|
|
184
217
|
environment_id,
|
|
185
|
-
environment_name
|
|
186
|
-
include_secrets
|
|
218
|
+
environment_name
|
|
187
219
|
});
|
|
188
220
|
break;
|
|
189
221
|
}
|
|
@@ -242,6 +274,7 @@ function registerListTestsTool(server, client, config) {
|
|
|
242
274
|
group_id: z.uuid().optional().describe("Optional test group UUID filter."),
|
|
243
275
|
priority: z.enum(["low", "medium", "high", "critical"]).optional().describe("Filter by priority."),
|
|
244
276
|
test_type: z.enum(["web", "api", "mobile"]).optional().describe("Filter by test type."),
|
|
277
|
+
status: z.enum(["failed", "passed", "error", "never_run", "blocked", "active", "flaky"]).optional().describe("Filter by test status (e.g. 'failed' or 'blocked')."),
|
|
245
278
|
limit: z.number().int().min(1).max(100).default(50).describe("Max number of test cases to return (default 50)."),
|
|
246
279
|
offset: z.number().int().min(0).default(0).describe("Pagination offset.")
|
|
247
280
|
}
|
|
@@ -327,20 +360,92 @@ function registerGetTestGroupsTool(server, client, config) {
|
|
|
327
360
|
}
|
|
328
361
|
|
|
329
362
|
// src/tools/download-script.ts
|
|
363
|
+
import { z as z5 } from "zod";
|
|
364
|
+
import * as fs2 from "fs/promises";
|
|
365
|
+
import * as path2 from "path";
|
|
366
|
+
|
|
367
|
+
// src/tools/save-script.ts
|
|
330
368
|
import { z as z4 } from "zod";
|
|
331
369
|
import * as fs from "fs/promises";
|
|
332
370
|
import * as path from "path";
|
|
371
|
+
var DEFAULT_SCRIPT_DIR = "./qcentriq_tests";
|
|
372
|
+
function registerSaveScriptTool(server) {
|
|
373
|
+
server.registerTool(
|
|
374
|
+
"qcentriq_save_script",
|
|
375
|
+
{
|
|
376
|
+
description: "Save downloaded Playwright Python test script and fixtures directly to the local workspace disk so they can be run or edited locally.",
|
|
377
|
+
inputSchema: {
|
|
378
|
+
file_name: z4.string().describe("Target filename (e.g. 'test_login.py')."),
|
|
379
|
+
content: z4.string().describe("Python test script source code."),
|
|
380
|
+
conftest_content: z4.string().optional().describe("Accompanying conftest.py source code if present."),
|
|
381
|
+
destination_dir: z4.string().default(DEFAULT_SCRIPT_DIR).describe(`Destination directory in the local workspace (default '${DEFAULT_SCRIPT_DIR}'). Kept separate from a project's own ./tests so an existing conftest.py is never overwritten.`)
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
async (args) => {
|
|
385
|
+
try {
|
|
386
|
+
const targetDir = path.resolve(process.cwd(), args.destination_dir ?? DEFAULT_SCRIPT_DIR);
|
|
387
|
+
await fs.mkdir(targetDir, { recursive: true });
|
|
388
|
+
const savedFiles = [];
|
|
389
|
+
const safeFileName = path.basename(args.file_name);
|
|
390
|
+
if (!safeFileName || safeFileName === "." || safeFileName === "..") {
|
|
391
|
+
throw new Error(`Invalid file name: "${args.file_name}"`);
|
|
392
|
+
}
|
|
393
|
+
const scriptPath = path.join(targetDir, safeFileName);
|
|
394
|
+
if (!path.resolve(scriptPath).startsWith(targetDir)) {
|
|
395
|
+
throw new Error(`Path traversal detected for file name: "${args.file_name}"`);
|
|
396
|
+
}
|
|
397
|
+
await fs.writeFile(scriptPath, args.content, "utf-8");
|
|
398
|
+
savedFiles.push(scriptPath);
|
|
399
|
+
logger.info(`Saved test script to: ${scriptPath}`);
|
|
400
|
+
if (args.conftest_content) {
|
|
401
|
+
const conftestPath = path.join(targetDir, "conftest.py");
|
|
402
|
+
await fs.writeFile(conftestPath, args.conftest_content, "utf-8");
|
|
403
|
+
savedFiles.push(conftestPath);
|
|
404
|
+
logger.info(`Saved conftest.py to: ${conftestPath}`);
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
content: [
|
|
408
|
+
{
|
|
409
|
+
type: "text",
|
|
410
|
+
text: JSON.stringify(
|
|
411
|
+
{
|
|
412
|
+
status: "success",
|
|
413
|
+
message: `Successfully saved ${savedFiles.length} file(s) to ${targetDir}`,
|
|
414
|
+
saved_files: savedFiles
|
|
415
|
+
},
|
|
416
|
+
null,
|
|
417
|
+
2
|
|
418
|
+
)
|
|
419
|
+
}
|
|
420
|
+
]
|
|
421
|
+
};
|
|
422
|
+
} catch (err) {
|
|
423
|
+
return {
|
|
424
|
+
isError: true,
|
|
425
|
+
content: [
|
|
426
|
+
{
|
|
427
|
+
type: "text",
|
|
428
|
+
text: `Failed to save test script to disk: ${err.message}`
|
|
429
|
+
}
|
|
430
|
+
]
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// src/tools/download-script.ts
|
|
333
438
|
function registerDownloadScriptTool(server, client, config) {
|
|
334
439
|
server.registerTool(
|
|
335
440
|
"qcentriq_download_script",
|
|
336
441
|
{
|
|
337
442
|
description: "Download test group script and accompanying fixture files (e.g. conftest.py) for local test execution and editing. Optionally writes files directly to the local filesystem.",
|
|
338
443
|
inputSchema: {
|
|
339
|
-
group_id:
|
|
340
|
-
project_id:
|
|
341
|
-
include_fixtures:
|
|
342
|
-
save_to_disk:
|
|
343
|
-
destination_dir:
|
|
444
|
+
group_id: z5.uuid().describe("UUID of the target test group."),
|
|
445
|
+
project_id: z5.uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
446
|
+
include_fixtures: z5.boolean().default(true).describe("Whether to retrieve accompanying conftest.py / fixtures (default True)."),
|
|
447
|
+
save_to_disk: z5.boolean().default(false).describe("If true, saves the downloaded test script and fixtures directly to the local filesystem."),
|
|
448
|
+
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.`)
|
|
344
449
|
}
|
|
345
450
|
},
|
|
346
451
|
async (args) => {
|
|
@@ -356,25 +461,25 @@ function registerDownloadScriptTool(server, client, config) {
|
|
|
356
461
|
const textItem = response.content.find((c) => c.type === "text");
|
|
357
462
|
if (textItem && textItem.text) {
|
|
358
463
|
const data = JSON.parse(textItem.text);
|
|
359
|
-
const targetDir =
|
|
360
|
-
await
|
|
464
|
+
const targetDir = path2.resolve(process.cwd(), args.destination_dir ?? DEFAULT_SCRIPT_DIR);
|
|
465
|
+
await fs2.mkdir(targetDir, { recursive: true });
|
|
361
466
|
const savedFiles = [];
|
|
362
467
|
if (data.file_name && data.content) {
|
|
363
|
-
const safeFileName =
|
|
468
|
+
const safeFileName = path2.basename(data.file_name);
|
|
364
469
|
if (!safeFileName || safeFileName === "." || safeFileName === "..") {
|
|
365
470
|
throw new Error(`Invalid file name returned: "${data.file_name}"`);
|
|
366
471
|
}
|
|
367
|
-
const scriptPath =
|
|
368
|
-
if (!
|
|
472
|
+
const scriptPath = path2.join(targetDir, safeFileName);
|
|
473
|
+
if (!path2.resolve(scriptPath).startsWith(targetDir)) {
|
|
369
474
|
throw new Error(`Path traversal detected in returned file name: "${data.file_name}"`);
|
|
370
475
|
}
|
|
371
|
-
await
|
|
476
|
+
await fs2.writeFile(scriptPath, data.content, "utf-8");
|
|
372
477
|
savedFiles.push(scriptPath);
|
|
373
478
|
logger.info(`Saved test script to: ${scriptPath}`);
|
|
374
479
|
}
|
|
375
480
|
if (data.conftest_content) {
|
|
376
|
-
const conftestPath =
|
|
377
|
-
await
|
|
481
|
+
const conftestPath = path2.join(targetDir, "conftest.py");
|
|
482
|
+
await fs2.writeFile(conftestPath, data.conftest_content, "utf-8");
|
|
378
483
|
savedFiles.push(conftestPath);
|
|
379
484
|
logger.info(`Saved conftest.py to: ${conftestPath}`);
|
|
380
485
|
}
|
|
@@ -399,17 +504,16 @@ function registerDownloadScriptTool(server, client, config) {
|
|
|
399
504
|
}
|
|
400
505
|
|
|
401
506
|
// src/tools/environment.ts
|
|
402
|
-
import { z as
|
|
507
|
+
import { z as z6 } from "zod";
|
|
403
508
|
function registerEnvironmentTool(server, client, config) {
|
|
404
509
|
server.registerTool(
|
|
405
510
|
"qcentriq_get_environment",
|
|
406
511
|
{
|
|
407
|
-
description: "Retrieve target test environment configuration, base URL (BASE_URL), environment variables, and
|
|
512
|
+
description: "Retrieve target test environment configuration, base URL (BASE_URL), environment variables, and required secret variable names for local test execution.",
|
|
408
513
|
inputSchema: {
|
|
409
|
-
project_id:
|
|
410
|
-
environment_id:
|
|
411
|
-
environment_name:
|
|
412
|
-
include_secrets: z5.boolean().default(false).describe("Whether to include decrypted secret values for runtime injection (default False).")
|
|
514
|
+
project_id: z6.uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
515
|
+
environment_id: z6.uuid().optional().describe("Optional specific environment UUID."),
|
|
516
|
+
environment_name: z6.string().optional().describe("Optional environment name filter (e.g. 'staging', 'dev', 'production').")
|
|
413
517
|
}
|
|
414
518
|
},
|
|
415
519
|
async (args) => {
|
|
@@ -431,22 +535,22 @@ function registerEnvironmentTool(server, client, config) {
|
|
|
431
535
|
}
|
|
432
536
|
|
|
433
537
|
// src/tools/run-logs.ts
|
|
434
|
-
import { z as
|
|
538
|
+
import { z as z7 } from "zod";
|
|
435
539
|
function registerRunLogsTool(server, client, config) {
|
|
436
540
|
server.registerTool(
|
|
437
541
|
"qcentriq_get_test_run_logs",
|
|
438
542
|
{
|
|
439
543
|
description: "Retrieve execution history and logs for a test case: per-run status, timing, error message, stack trace, and raw output logs across runs.",
|
|
440
544
|
inputSchema: {
|
|
441
|
-
test_case_id:
|
|
442
|
-
project_id:
|
|
443
|
-
run_id:
|
|
444
|
-
status:
|
|
445
|
-
latest_only:
|
|
446
|
-
from_date:
|
|
447
|
-
to_date:
|
|
448
|
-
limit:
|
|
449
|
-
offset:
|
|
545
|
+
test_case_id: z7.uuid().describe("UUID of the target test case."),
|
|
546
|
+
project_id: z7.uuid().optional().describe("Optional project UUID (inferred from API key if omitted)."),
|
|
547
|
+
run_id: z7.uuid().optional().describe("Optional specific run UUID to fetch a single run's full log."),
|
|
548
|
+
status: z7.enum(["failed", "passed", "error"]).optional().describe("Filter by result status."),
|
|
549
|
+
latest_only: z7.boolean().default(false).describe("If True, returns only the most recent matching run."),
|
|
550
|
+
from_date: z7.string().optional().describe("Optional ISO-8601 start date filter."),
|
|
551
|
+
to_date: z7.string().optional().describe("Optional ISO-8601 end date filter."),
|
|
552
|
+
limit: z7.number().int().min(1).max(100).default(20).describe("Max runs to return."),
|
|
553
|
+
offset: z7.number().int().min(0).default(0).describe("Pagination offset.")
|
|
450
554
|
}
|
|
451
555
|
},
|
|
452
556
|
async (args) => {
|
|
@@ -467,15 +571,143 @@ function registerRunLogsTool(server, client, config) {
|
|
|
467
571
|
);
|
|
468
572
|
}
|
|
469
573
|
|
|
574
|
+
// src/tools/authoring-guide.ts
|
|
575
|
+
function registerAuthoringGuideTool(server, client) {
|
|
576
|
+
server.registerTool(
|
|
577
|
+
"qcentriq_get_authoring_guide",
|
|
578
|
+
{
|
|
579
|
+
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.",
|
|
580
|
+
inputSchema: {},
|
|
581
|
+
annotations: {
|
|
582
|
+
readOnlyHint: true,
|
|
583
|
+
destructiveHint: false,
|
|
584
|
+
idempotentHint: true,
|
|
585
|
+
openWorldHint: false
|
|
586
|
+
}
|
|
587
|
+
},
|
|
588
|
+
async () => {
|
|
589
|
+
try {
|
|
590
|
+
const guide = await client.request("/authoring-guide");
|
|
591
|
+
return {
|
|
592
|
+
content: [{ type: "text", text: JSON.stringify(guide, null, 2) }]
|
|
593
|
+
};
|
|
594
|
+
} catch (err) {
|
|
595
|
+
return {
|
|
596
|
+
isError: true,
|
|
597
|
+
content: [{ type: "text", text: `Error fetching the authoring guide: ${err.message}` }]
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// src/tools/create-plan.ts
|
|
605
|
+
import { z as z8 } from "zod";
|
|
606
|
+
function registerCreatePlanTool(server, client, config) {
|
|
607
|
+
server.registerTool(
|
|
608
|
+
"qcentriq_create_plan",
|
|
609
|
+
{
|
|
610
|
+
description: "Create test groups and test cases in QCentriq from a plan you authored. Call qcentriq_get_authoring_guide first \u2014 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.",
|
|
611
|
+
inputSchema: {
|
|
612
|
+
plan: z8.record(z8.string(), z8.any()).describe("The plan object, matching the TaskPlan schema from qcentriq_get_authoring_guide."),
|
|
613
|
+
project_id: z8.uuid().optional().describe("Optional project UUID (inferred from the API key if omitted).")
|
|
614
|
+
},
|
|
615
|
+
annotations: {
|
|
616
|
+
readOnlyHint: false,
|
|
617
|
+
destructiveHint: false,
|
|
618
|
+
// Creates new groups and cases; never modifies existing ones.
|
|
619
|
+
idempotentHint: false,
|
|
620
|
+
// Calling twice creates two plans.
|
|
621
|
+
openWorldHint: false
|
|
622
|
+
}
|
|
623
|
+
},
|
|
624
|
+
async (args) => {
|
|
625
|
+
try {
|
|
626
|
+
const data = await client.send("POST", "/plans", {
|
|
627
|
+
plan: args.plan,
|
|
628
|
+
project_id: args.project_id || config.defaultProjectId
|
|
629
|
+
});
|
|
630
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
631
|
+
} catch (err) {
|
|
632
|
+
return {
|
|
633
|
+
isError: true,
|
|
634
|
+
content: [{ type: "text", text: `Error in qcentriq_create_plan: ${err.message}` }]
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// src/tools/save-group-script.ts
|
|
642
|
+
import { z as z9 } from "zod";
|
|
643
|
+
function registerSaveGroupScriptTool(server, client, config) {
|
|
644
|
+
server.registerTool(
|
|
645
|
+
"qcentriq_save_group_script",
|
|
646
|
+
{
|
|
647
|
+
description: "Save a test script you wrote back to QCentriq so the cloud runner executes exactly what you ran locally. 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. Pass expected_updated_at from the last download to turn a concurrent edit into a conflict rather than a lost update. conftest.py cannot be saved; QCentriq provides it. Requires the 'test:write' scope.",
|
|
648
|
+
inputSchema: {
|
|
649
|
+
group_id: z9.uuid().describe("UUID of the target test group."),
|
|
650
|
+
content: z9.string().describe("The Python test script source."),
|
|
651
|
+
project_id: z9.uuid().optional().describe("Optional project UUID (inferred from the API key if omitted)."),
|
|
652
|
+
filename: z9.string().optional().describe("Optional script filename; derived from the group title if omitted."),
|
|
653
|
+
fixtures: z9.array(z9.object({ file_name: z9.string(), content: z9.string() })).optional().describe("Companion files to store next to the script (page objects, test data). conftest.py is rejected."),
|
|
654
|
+
expected_updated_at: z9.string().optional().describe("ISO-8601 timestamp from the last download. Supply it to get a conflict instead of silently overwriting someone else's edit.")
|
|
655
|
+
},
|
|
656
|
+
annotations: {
|
|
657
|
+
readOnlyHint: false,
|
|
658
|
+
destructiveHint: true,
|
|
659
|
+
// Replaces the group's existing script.
|
|
660
|
+
idempotentHint: true,
|
|
661
|
+
// Saving the same content twice leaves the same state.
|
|
662
|
+
openWorldHint: false
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
async (args) => {
|
|
666
|
+
try {
|
|
667
|
+
const { group_id, ...rest } = args;
|
|
668
|
+
const data = await client.send("PUT", `/groups/${group_id}/script`, {
|
|
669
|
+
...rest,
|
|
670
|
+
project_id: args.project_id || config.defaultProjectId
|
|
671
|
+
});
|
|
672
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
673
|
+
} catch (err) {
|
|
674
|
+
return {
|
|
675
|
+
isError: true,
|
|
676
|
+
content: [{ type: "text", text: `Error in qcentriq_save_group_script: ${err.message}` }]
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
|
|
470
683
|
// src/tools/local-run.ts
|
|
471
|
-
import { z as
|
|
684
|
+
import { z as z10 } from "zod";
|
|
472
685
|
|
|
473
686
|
// src/local/runner.ts
|
|
474
687
|
import { spawn } from "child_process";
|
|
475
|
-
import * as
|
|
688
|
+
import * as path3 from "path";
|
|
689
|
+
function buildTestEnv(params) {
|
|
690
|
+
const env = {
|
|
691
|
+
...process.env,
|
|
692
|
+
...params.envVars || {}
|
|
693
|
+
};
|
|
694
|
+
if (params.baseUrl) {
|
|
695
|
+
env.BASE_URL = params.baseUrl;
|
|
696
|
+
}
|
|
697
|
+
if (params.browser) {
|
|
698
|
+
env.BROWSER = params.browser;
|
|
699
|
+
}
|
|
700
|
+
if (params.headless !== void 0) {
|
|
701
|
+
env.HEADLESS = params.headless ? "true" : "false";
|
|
702
|
+
}
|
|
703
|
+
if (params.groupId) {
|
|
704
|
+
env.QCAQ_TEST_GROUP_ID = params.groupId;
|
|
705
|
+
}
|
|
706
|
+
return env;
|
|
707
|
+
}
|
|
476
708
|
function resolvePytestCommand() {
|
|
477
709
|
if (process.env.VIRTUAL_ENV) {
|
|
478
|
-
const venvPytest =
|
|
710
|
+
const venvPytest = path3.join(process.env.VIRTUAL_ENV, "bin", "pytest");
|
|
479
711
|
return { cmd: venvPytest, baseArgs: [] };
|
|
480
712
|
}
|
|
481
713
|
return { cmd: "pytest", baseArgs: [] };
|
|
@@ -497,7 +729,7 @@ function killProcessTree(child) {
|
|
|
497
729
|
}
|
|
498
730
|
async function runLocalPytest(params) {
|
|
499
731
|
const startTime = Date.now();
|
|
500
|
-
const cwd = params.workingDir ?
|
|
732
|
+
const cwd = params.workingDir ? path3.resolve(params.workingDir) : process.cwd();
|
|
501
733
|
const timeoutMs = (params.timeoutSeconds || 60) * 1e3;
|
|
502
734
|
const { cmd, baseArgs } = resolvePytestCommand();
|
|
503
735
|
const args = [...baseArgs, params.filePath];
|
|
@@ -510,19 +742,7 @@ async function runLocalPytest(params) {
|
|
|
510
742
|
if (!args.includes("-v") && !args.includes("-vv")) {
|
|
511
743
|
args.push("-v");
|
|
512
744
|
}
|
|
513
|
-
const env =
|
|
514
|
-
...process.env,
|
|
515
|
-
...params.envVars || {}
|
|
516
|
-
};
|
|
517
|
-
if (params.baseUrl) {
|
|
518
|
-
env.BASE_URL = params.baseUrl;
|
|
519
|
-
}
|
|
520
|
-
if (params.browser) {
|
|
521
|
-
env.BROWSER = params.browser;
|
|
522
|
-
}
|
|
523
|
-
if (params.headless !== void 0) {
|
|
524
|
-
env.HEADLESS = params.headless ? "true" : "false";
|
|
525
|
-
}
|
|
745
|
+
const env = buildTestEnv(params);
|
|
526
746
|
const fullCommand = `${cmd} ${args.join(" ")}`;
|
|
527
747
|
logger.info(`Running local test command: ${fullCommand} in ${cwd}`);
|
|
528
748
|
return new Promise((resolve5) => {
|
|
@@ -649,15 +869,16 @@ function registerLocalRunTool(server) {
|
|
|
649
869
|
{
|
|
650
870
|
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.",
|
|
651
871
|
inputSchema: {
|
|
652
|
-
file_path:
|
|
653
|
-
test_name:
|
|
654
|
-
headless:
|
|
655
|
-
browser:
|
|
656
|
-
base_url:
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
872
|
+
file_path: z10.string().describe("Path to the local test file to run (e.g. 'tests/test_login.py')."),
|
|
873
|
+
test_name: z10.string().optional().describe("Optional specific test function name or expression to run (passed to pytest -k)."),
|
|
874
|
+
headless: z10.boolean().default(true).describe("Whether to run the browser in headless mode (default True). Set False to watch the browser execution live."),
|
|
875
|
+
browser: z10.enum(["chromium", "firefox", "webkit"]).default("chromium").describe("Browser engine to execute against (default 'chromium')."),
|
|
876
|
+
base_url: z10.url().optional().describe("Target application base URL (e.g. from qcentriq_get_environment). Injected as BASE_URL env var."),
|
|
877
|
+
group_id: z10.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."),
|
|
878
|
+
env_vars: z10.record(z10.string(), z10.string()).optional().describe("Environment variables to inject into the local test process."),
|
|
879
|
+
extra_args: z10.array(z10.string()).optional().describe("Additional CLI arguments to pass to pytest (e.g. ['-s', '--alluredir=allure-results'])."),
|
|
880
|
+
timeout_seconds: z10.number().int().min(5).max(300).default(60).describe("Timeout in seconds for test execution (default 60)."),
|
|
881
|
+
working_dir: z10.string().optional().describe("Working directory to run pytest in (defaults to current project directory).")
|
|
661
882
|
}
|
|
662
883
|
},
|
|
663
884
|
async (args) => {
|
|
@@ -668,6 +889,7 @@ function registerLocalRunTool(server) {
|
|
|
668
889
|
headless: args.headless,
|
|
669
890
|
browser: args.browser,
|
|
670
891
|
baseUrl: args.base_url,
|
|
892
|
+
groupId: args.group_id,
|
|
671
893
|
envVars: args.env_vars,
|
|
672
894
|
extraArgs: args.extra_args,
|
|
673
895
|
timeoutSeconds: args.timeout_seconds,
|
|
@@ -709,77 +931,8 @@ function registerLocalRunTool(server) {
|
|
|
709
931
|
);
|
|
710
932
|
}
|
|
711
933
|
|
|
712
|
-
// src/tools/save-script.ts
|
|
713
|
-
import { z as z8 } from "zod";
|
|
714
|
-
import * as fs2 from "fs/promises";
|
|
715
|
-
import * as path3 from "path";
|
|
716
|
-
function registerSaveScriptTool(server) {
|
|
717
|
-
server.registerTool(
|
|
718
|
-
"qcentriq_save_script",
|
|
719
|
-
{
|
|
720
|
-
description: "Save downloaded Playwright Python test script and fixtures directly to the local workspace disk so they can be run or edited locally.",
|
|
721
|
-
inputSchema: {
|
|
722
|
-
file_name: z8.string().describe("Target filename (e.g. 'test_login.py')."),
|
|
723
|
-
content: z8.string().describe("Python test script source code."),
|
|
724
|
-
conftest_content: z8.string().optional().describe("Accompanying conftest.py source code if present."),
|
|
725
|
-
destination_dir: z8.string().default("./tests").describe("Destination directory in the local workspace (default './tests').")
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
async (args) => {
|
|
729
|
-
try {
|
|
730
|
-
const targetDir = path3.resolve(process.cwd(), args.destination_dir);
|
|
731
|
-
await fs2.mkdir(targetDir, { recursive: true });
|
|
732
|
-
const savedFiles = [];
|
|
733
|
-
const safeFileName = path3.basename(args.file_name);
|
|
734
|
-
if (!safeFileName || safeFileName === "." || safeFileName === "..") {
|
|
735
|
-
throw new Error(`Invalid file name: "${args.file_name}"`);
|
|
736
|
-
}
|
|
737
|
-
const scriptPath = path3.join(targetDir, safeFileName);
|
|
738
|
-
if (!path3.resolve(scriptPath).startsWith(targetDir)) {
|
|
739
|
-
throw new Error(`Path traversal detected for file name: "${args.file_name}"`);
|
|
740
|
-
}
|
|
741
|
-
await fs2.writeFile(scriptPath, args.content, "utf-8");
|
|
742
|
-
savedFiles.push(scriptPath);
|
|
743
|
-
logger.info(`Saved test script to: ${scriptPath}`);
|
|
744
|
-
if (args.conftest_content) {
|
|
745
|
-
const conftestPath = path3.join(targetDir, "conftest.py");
|
|
746
|
-
await fs2.writeFile(conftestPath, args.conftest_content, "utf-8");
|
|
747
|
-
savedFiles.push(conftestPath);
|
|
748
|
-
logger.info(`Saved conftest.py to: ${conftestPath}`);
|
|
749
|
-
}
|
|
750
|
-
return {
|
|
751
|
-
content: [
|
|
752
|
-
{
|
|
753
|
-
type: "text",
|
|
754
|
-
text: JSON.stringify(
|
|
755
|
-
{
|
|
756
|
-
status: "success",
|
|
757
|
-
message: `Successfully saved ${savedFiles.length} file(s) to ${targetDir}`,
|
|
758
|
-
saved_files: savedFiles
|
|
759
|
-
},
|
|
760
|
-
null,
|
|
761
|
-
2
|
|
762
|
-
)
|
|
763
|
-
}
|
|
764
|
-
]
|
|
765
|
-
};
|
|
766
|
-
} catch (err) {
|
|
767
|
-
return {
|
|
768
|
-
isError: true,
|
|
769
|
-
content: [
|
|
770
|
-
{
|
|
771
|
-
type: "text",
|
|
772
|
-
text: `Failed to save test script to disk: ${err.message}`
|
|
773
|
-
}
|
|
774
|
-
]
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
);
|
|
779
|
-
}
|
|
780
|
-
|
|
781
934
|
// src/tools/setup-instructions.ts
|
|
782
|
-
import { z as
|
|
935
|
+
import { z as z11 } from "zod";
|
|
783
936
|
|
|
784
937
|
// src/local/environment-setup.ts
|
|
785
938
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -789,17 +942,18 @@ var MANAGER_PRIORITY = ["uv", "poetry", "conda", "venv"];
|
|
|
789
942
|
var PROBE_TIMEOUT_MS = 5e3;
|
|
790
943
|
var DEFAULT_PYTHON_VERSION = "3.12";
|
|
791
944
|
var DEFAULT_PLAYWRIGHT_VERSION = "1.56.0";
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
945
|
+
var FALLBACK_TEST_PACKAGES = [
|
|
946
|
+
"pytest",
|
|
947
|
+
"pytest-playwright",
|
|
948
|
+
"allure-pytest",
|
|
949
|
+
"httpx",
|
|
950
|
+
"nest-asyncio",
|
|
951
|
+
"pytest-playwright-visual-snapshot",
|
|
952
|
+
"Pillow"
|
|
953
|
+
];
|
|
954
|
+
function testDependencies(playwrightVersion, packages) {
|
|
955
|
+
const base = packages && packages.length > 0 ? packages : FALLBACK_TEST_PACKAGES;
|
|
956
|
+
return [...base, `playwright==${playwrightVersion}`].join(" ");
|
|
803
957
|
}
|
|
804
958
|
function probeCommand(cmd, args) {
|
|
805
959
|
return new Promise((resolve5) => {
|
|
@@ -891,7 +1045,7 @@ function activateCommand(ctx) {
|
|
|
891
1045
|
return ctx.isWindows ? ".venv\\Scripts\\activate" : "source .venv/bin/activate";
|
|
892
1046
|
}
|
|
893
1047
|
function buildUvSteps(ctx) {
|
|
894
|
-
const deps = testDependencies(ctx.playwrightVersion);
|
|
1048
|
+
const deps = testDependencies(ctx.playwrightVersion, ctx.packages);
|
|
895
1049
|
if (ctx.projectFiles.includes("uv.lock")) {
|
|
896
1050
|
return [
|
|
897
1051
|
{ description: "Install the project's locked dependencies into a uv-managed virtualenv.", command: "uv sync" },
|
|
@@ -912,8 +1066,18 @@ function buildUvSteps(ctx) {
|
|
|
912
1066
|
);
|
|
913
1067
|
return steps;
|
|
914
1068
|
}
|
|
1069
|
+
function buildUvBootstrapSteps(ctx) {
|
|
1070
|
+
return [
|
|
1071
|
+
{
|
|
1072
|
+
description: "Install uv, the recommended package manager. It also downloads Python, so nothing else needs to be installed first.",
|
|
1073
|
+
command: ctx.isWindows ? UV_INSTALL_COMMANDS.windows : UV_INSTALL_COMMANDS.unix
|
|
1074
|
+
},
|
|
1075
|
+
{ description: "Open a new terminal so uv is on PATH, then confirm it is installed.", command: "uv --version" },
|
|
1076
|
+
...buildUvSteps(ctx)
|
|
1077
|
+
];
|
|
1078
|
+
}
|
|
915
1079
|
function buildPoetrySteps(ctx) {
|
|
916
|
-
const deps = testDependencies(ctx.playwrightVersion);
|
|
1080
|
+
const deps = testDependencies(ctx.playwrightVersion, ctx.packages);
|
|
917
1081
|
const steps = [
|
|
918
1082
|
{
|
|
919
1083
|
description: "Keep the virtualenv inside the project so qcentriq_run_local_test can find it.",
|
|
@@ -935,7 +1099,7 @@ function buildPoetrySteps(ctx) {
|
|
|
935
1099
|
return steps;
|
|
936
1100
|
}
|
|
937
1101
|
function buildCondaSteps(ctx) {
|
|
938
|
-
const deps = testDependencies(ctx.playwrightVersion);
|
|
1102
|
+
const deps = testDependencies(ctx.playwrightVersion, ctx.packages);
|
|
939
1103
|
const envFile = ctx.projectFiles.find((f) => f === "environment.yml" || f === "environment.yaml");
|
|
940
1104
|
const steps = envFile ? [{ description: "Create the conda environment from the project's environment file.", command: `conda env create -f ${envFile}` }] : [
|
|
941
1105
|
{
|
|
@@ -951,7 +1115,7 @@ function buildCondaSteps(ctx) {
|
|
|
951
1115
|
return steps;
|
|
952
1116
|
}
|
|
953
1117
|
function buildVenvSteps(ctx) {
|
|
954
|
-
const deps = testDependencies(ctx.playwrightVersion);
|
|
1118
|
+
const deps = testDependencies(ctx.playwrightVersion, ctx.packages);
|
|
955
1119
|
const steps = [
|
|
956
1120
|
{ description: "Create a virtual environment in .venv.", command: "python3 -m venv .venv" },
|
|
957
1121
|
{ description: "Activate the virtual environment.", command: activateCommand(ctx) },
|
|
@@ -978,6 +1142,10 @@ var VERIFY_COMMANDS = {
|
|
|
978
1142
|
conda: "pytest --version",
|
|
979
1143
|
venv: "pytest --version"
|
|
980
1144
|
};
|
|
1145
|
+
var UV_INSTALL_COMMANDS = {
|
|
1146
|
+
unix: "curl -LsSf https://astral.sh/uv/install.sh | sh",
|
|
1147
|
+
windows: 'powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"'
|
|
1148
|
+
};
|
|
981
1149
|
var INSTALL_HINTS = {
|
|
982
1150
|
uv: "uv: https://docs.astral.sh/uv/getting-started/installation/",
|
|
983
1151
|
poetry: "poetry: https://python-poetry.org/docs/#installation",
|
|
@@ -999,32 +1167,32 @@ async function buildEnvironmentSetupPlan(params = {}) {
|
|
|
999
1167
|
const availability = new Map(packageManagers.map((m) => [m.name, m.available]));
|
|
1000
1168
|
const preferred = params.preferredManager;
|
|
1001
1169
|
const notes = [];
|
|
1002
|
-
let
|
|
1170
|
+
let installed;
|
|
1003
1171
|
if (preferred && availability.get(preferred)) {
|
|
1004
|
-
|
|
1172
|
+
installed = preferred;
|
|
1005
1173
|
} else {
|
|
1006
1174
|
if (preferred) {
|
|
1007
1175
|
notes.push(`Requested package manager "${preferred}" was not found on PATH; falling back to the best available option.`);
|
|
1008
1176
|
}
|
|
1009
|
-
|
|
1177
|
+
installed = MANAGER_PRIORITY.find((name) => availability.get(name));
|
|
1010
1178
|
}
|
|
1179
|
+
const recommended = installed ?? "uv";
|
|
1011
1180
|
const ctx = {
|
|
1012
1181
|
workingDir,
|
|
1013
1182
|
isWindows: process.platform === "win32",
|
|
1014
1183
|
envName: params.envName || "qcentriq-tests",
|
|
1015
1184
|
pythonVersion: params.pythonVersion || DEFAULT_PYTHON_VERSION,
|
|
1016
1185
|
playwrightVersion: params.playwrightVersion || DEFAULT_PLAYWRIGHT_VERSION,
|
|
1186
|
+
packages: params.packages,
|
|
1017
1187
|
projectFiles
|
|
1018
1188
|
};
|
|
1019
1189
|
const activeEnvironment = detectActiveEnvironment();
|
|
1020
1190
|
if (activeEnvironment) {
|
|
1021
1191
|
notes.push(`An environment is already active (${activeEnvironment}). Reuse it instead of creating a new one if it already has pytest and playwright installed.`);
|
|
1022
1192
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
if (
|
|
1026
|
-
steps = STEP_BUILDERS[recommended](ctx);
|
|
1027
|
-
verifyCommand = VERIFY_COMMANDS[recommended];
|
|
1193
|
+
const steps = installed ? STEP_BUILDERS[installed](ctx) : buildUvBootstrapSteps(ctx);
|
|
1194
|
+
const verifyCommand = VERIFY_COMMANDS[recommended];
|
|
1195
|
+
if (installed) {
|
|
1028
1196
|
if (recommended !== "uv" && availability.get("uv")) {
|
|
1029
1197
|
notes.push("uv is also available on this machine and is recommended over other package managers for faster, more reliable installs. Pass preferred_manager to override this choice.");
|
|
1030
1198
|
}
|
|
@@ -1033,8 +1201,8 @@ async function buildEnvironmentSetupPlan(params = {}) {
|
|
|
1033
1201
|
notes.push(`Also available on this machine: ${alternatives.join(", ")}. Re-run this tool with preferred_manager to get instructions for one of them.`);
|
|
1034
1202
|
}
|
|
1035
1203
|
} else {
|
|
1036
|
-
notes.push("No supported Python package manager was found on PATH.
|
|
1037
|
-
for (const name of MANAGER_PRIORITY) {
|
|
1204
|
+
notes.push("No supported Python package manager was found on PATH. The steps below install uv, the recommended option. To use a different tool instead, install one of the following and run this tool again:");
|
|
1205
|
+
for (const name of MANAGER_PRIORITY.filter((name2) => name2 !== "uv")) {
|
|
1038
1206
|
notes.push(` - ${INSTALL_HINTS[name]}`);
|
|
1039
1207
|
}
|
|
1040
1208
|
}
|
|
@@ -1042,7 +1210,7 @@ async function buildEnvironmentSetupPlan(params = {}) {
|
|
|
1042
1210
|
"Run these commands in a terminal from the working directory below \u2014 this tool returns instructions only and does not create the environment for you.",
|
|
1043
1211
|
"qcentriq_run_local_test resolves pytest from the VIRTUAL_ENV the MCP server was launched with, then falls back to pytest on PATH. After creating a new environment, restart your MCP client (Claude Desktop, Cursor, ...) from an activated shell so local runs pick it up."
|
|
1044
1212
|
);
|
|
1045
|
-
logger.debug(`Environment setup plan: recommended=${recommended
|
|
1213
|
+
logger.debug(`Environment setup plan: recommended=${recommended}, project files=[${projectFiles.join(", ")}]`);
|
|
1046
1214
|
return {
|
|
1047
1215
|
working_dir: workingDir,
|
|
1048
1216
|
package_managers: packageManagers,
|
|
@@ -1056,17 +1224,30 @@ async function buildEnvironmentSetupPlan(params = {}) {
|
|
|
1056
1224
|
}
|
|
1057
1225
|
|
|
1058
1226
|
// src/tools/setup-instructions.ts
|
|
1059
|
-
function
|
|
1227
|
+
async function fetchRuntimeRequirements(client) {
|
|
1228
|
+
if (!client) return {};
|
|
1229
|
+
try {
|
|
1230
|
+
const res = await client.request("/runtime-requirements");
|
|
1231
|
+
return {
|
|
1232
|
+
packages: Array.isArray(res?.packages) ? res.packages : void 0,
|
|
1233
|
+
playwright_version: typeof res?.playwright_version === "string" ? res.playwright_version : void 0
|
|
1234
|
+
};
|
|
1235
|
+
} catch (err) {
|
|
1236
|
+
logger.warn(`Could not fetch runtime requirements from the backend, using the bundled list: ${err.message}`);
|
|
1237
|
+
return {};
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
function registerSetupInstructionsTool(server, client) {
|
|
1060
1241
|
server.registerTool(
|
|
1061
1242
|
"qcentriq_get_setup_instructions",
|
|
1062
1243
|
{
|
|
1063
|
-
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. Returns instructions only \u2014 it does not create the environment.",
|
|
1244
|
+
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.",
|
|
1064
1245
|
inputSchema: {
|
|
1065
|
-
preferred_manager:
|
|
1066
|
-
working_dir:
|
|
1067
|
-
env_name:
|
|
1068
|
-
python_version:
|
|
1069
|
-
playwright_version:
|
|
1246
|
+
preferred_manager: z11.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."),
|
|
1247
|
+
working_dir: z11.string().optional().describe("Directory to inspect for pyproject.toml / lockfiles / requirements.txt (defaults to the current project directory)."),
|
|
1248
|
+
env_name: z11.string().default("qcentriq-tests").describe("Name for the created environment (used by conda, default 'qcentriq-tests')."),
|
|
1249
|
+
python_version: z11.string().default("3.12").describe("Python version to request when creating the environment (default '3.12', matching the QCentriq execution container)."),
|
|
1250
|
+
playwright_version: z11.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.")
|
|
1070
1251
|
},
|
|
1071
1252
|
annotations: {
|
|
1072
1253
|
readOnlyHint: true,
|
|
@@ -1080,12 +1261,16 @@ function registerSetupInstructionsTool(server) {
|
|
|
1080
1261
|
},
|
|
1081
1262
|
async (args) => {
|
|
1082
1263
|
try {
|
|
1264
|
+
const runtime = await fetchRuntimeRequirements(client);
|
|
1083
1265
|
const plan = await buildEnvironmentSetupPlan({
|
|
1084
1266
|
preferredManager: args.preferred_manager,
|
|
1085
1267
|
workingDir: args.working_dir,
|
|
1086
1268
|
envName: args.env_name,
|
|
1087
1269
|
pythonVersion: args.python_version,
|
|
1088
|
-
|
|
1270
|
+
// An explicitly requested pin wins; otherwise use whatever the
|
|
1271
|
+
// project's active execution image is built against.
|
|
1272
|
+
playwrightVersion: args.playwright_version ?? runtime.playwright_version,
|
|
1273
|
+
packages: runtime.packages
|
|
1089
1274
|
});
|
|
1090
1275
|
return {
|
|
1091
1276
|
content: [
|
|
@@ -1093,8 +1278,7 @@ function registerSetupInstructionsTool(server) {
|
|
|
1093
1278
|
type: "text",
|
|
1094
1279
|
text: JSON.stringify(plan, null, 2)
|
|
1095
1280
|
}
|
|
1096
|
-
]
|
|
1097
|
-
isError: plan.recommended_manager === null
|
|
1281
|
+
]
|
|
1098
1282
|
};
|
|
1099
1283
|
} catch (err) {
|
|
1100
1284
|
return {
|
|
@@ -1120,12 +1304,19 @@ function registerAllTools(server, client, config) {
|
|
|
1120
1304
|
registerDownloadScriptTool(server, client, config);
|
|
1121
1305
|
registerEnvironmentTool(server, client, config);
|
|
1122
1306
|
registerRunLogsTool(server, client, config);
|
|
1307
|
+
registerAuthoringGuideTool(server, client);
|
|
1308
|
+
registerCreatePlanTool(server, client, config);
|
|
1309
|
+
registerSaveGroupScriptTool(server, client, config);
|
|
1123
1310
|
registerSaveScriptTool(server);
|
|
1124
1311
|
registerLocalRunTool(server);
|
|
1125
|
-
registerSetupInstructionsTool(server);
|
|
1126
|
-
logger.info("Successfully registered
|
|
1312
|
+
registerSetupInstructionsTool(server, client);
|
|
1313
|
+
logger.info("Successfully registered 12 QCentriq MCP tools (7 remote discovery + 2 authoring + 3 local client execution).");
|
|
1127
1314
|
}
|
|
1128
1315
|
|
|
1316
|
+
// src/version.ts
|
|
1317
|
+
import { createRequire } from "module";
|
|
1318
|
+
var PACKAGE_VERSION = createRequire(import.meta.url)("../package.json").version;
|
|
1319
|
+
|
|
1129
1320
|
// src/index.ts
|
|
1130
1321
|
async function main() {
|
|
1131
1322
|
try {
|
|
@@ -1134,7 +1325,7 @@ async function main() {
|
|
|
1134
1325
|
const apiClient = new QCentriqApiClient(config);
|
|
1135
1326
|
const server = new McpServer({
|
|
1136
1327
|
name: "@qcentriq/mcp",
|
|
1137
|
-
version:
|
|
1328
|
+
version: PACKAGE_VERSION
|
|
1138
1329
|
});
|
|
1139
1330
|
registerAllTools(server, apiClient, config);
|
|
1140
1331
|
const transport = new StdioServerTransport();
|