zephyr-scale-mcp-server 0.3.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 CHANGED
@@ -68,7 +68,7 @@ The server automatically detects your Jira environment and uses the appropriate
68
68
  - **Jira Cloud**: Uses Zephyr Scale API v2.
69
69
  - **Jira Data Center**: Uses Zephyr Scale API v1.
70
70
 
71
- This may result in slightly different behavior for some tools, such as `add_test_cases_to_run`.
71
+ Some tools are platform-specific. For example, `add_test_cases_to_run` is only available on Cloud, as the Data Center API (v1) does not support modifying test runs after creation.
72
72
 
73
73
  ### Resource System
74
74
  The server provides access to various resources through URI schemes:
@@ -88,11 +88,12 @@ The server provides access to various resources through URI schemes:
88
88
  - `create_test_run`: Create a new test run.
89
89
  - `get_test_run`: Get detailed information about a specific test run.
90
90
  - `get_test_run_cases`: Get test case keys from a test run.
91
- - `add_test_cases_to_run`: Add test cases to an existing test run.
91
+ - `add_test_cases_to_run`: Add test cases to an existing test run. *(Cloud only)*
92
92
 
93
93
  ### Test Execution & Search
94
94
  - `get_test_execution`: Get detailed individual test execution results.
95
95
  - `search_test_cases_by_folder`: Search for test cases in a specific folder.
96
+ - `search_test_runs`: Search for test runs by project key and/or folder path.
96
97
 
97
98
  ### Organization
98
99
  - `create_folder`: Create a new folder in Zephyr Scale.
package/build/index.js CHANGED
@@ -14,7 +14,7 @@ class ZephyrServer {
14
14
  const jiraConfig = createJiraConfig();
15
15
  this.server = new Server({
16
16
  name: 'zephyr-server',
17
- version: '0.3.0',
17
+ version: '0.3.1',
18
18
  }, {
19
19
  capabilities: {
20
20
  tools: {},
@@ -557,48 +557,18 @@ export class ZephyrToolHandlers {
557
557
  }
558
558
  async addTestCasesToRun(args) {
559
559
  const { test_run_key, test_case_keys } = args;
560
+ if (this.jiraConfig.type === 'datacenter') {
561
+ throw new McpError(ErrorCode.InvalidRequest, 'add_test_cases_to_run is only supported on Zephyr Scale Cloud. The Data Center API (v1) does not provide an endpoint to modify test runs after creation.');
562
+ }
560
563
  try {
561
- // For Data Center, we need to get the current items and then update
562
- if (this.jiraConfig.type === 'datacenter') {
563
- const getResponse = await this.axiosInstance.get(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}`);
564
- const existingItems = getResponse.data.items || [];
565
- const existingKeys = new Set(existingItems.map((item) => item.testCaseKey));
566
- const newItems = test_case_keys
567
- .filter(key => !existingKeys.has(key))
568
- .map(key => ({ testCaseKey: key, testResultStatus: 'Not Executed' }));
569
- if (newItems.length > 0) {
570
- let response;
571
- if (this.jiraConfig.type === 'datacenter') {
572
- const minimalPayload = {
573
- items: [...existingItems, ...newItems]
574
- };
575
- response = await this.axiosInstance.put(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}`, minimalPayload);
576
- }
577
- else {
578
- const postPayload = { items: newItems.map(item => item.testCaseKey) };
579
- response = await this.axiosInstance.post(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}/testcases`, postPayload);
580
- }
581
- if (response.status === 200 || response.status === 201 || response.status === 204) {
582
- return {
583
- content: [{ type: 'text', text: `Added ${newItems.length} new test cases to test run ${test_run_key}.` }],
584
- };
585
- }
586
- }
587
- else {
588
- return {
589
- content: [{ type: 'text', text: 'All specified test cases are already in the test run.' }],
590
- };
591
- }
592
- }
593
- else {
594
- // For Cloud, we can just post the new test case keys
595
- const fullPayload = { items: test_case_keys };
596
- const response = await this.axiosInstance.put(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}`, fullPayload);
597
- if (response.status === 200 || response.status === 204) {
598
- return {
599
- content: [{ type: 'text', text: `Successfully updated test cases for test run ${test_run_key}.` }],
600
- };
601
- }
564
+ const payload = {
565
+ items: test_case_keys.map(key => ({ testCaseKey: key }))
566
+ };
567
+ const response = await this.axiosInstance.post(`/testcycles/${test_run_key}/testcases`, payload);
568
+ if (response.status === 200 || response.status === 201 || response.status === 204) {
569
+ return {
570
+ content: [{ type: 'text', text: `Added ${test_case_keys.length} test case(s) to test run ${test_run_key}.` }],
571
+ };
602
572
  }
603
573
  }
604
574
  catch (error) {
@@ -375,7 +375,7 @@ export const toolSchemas = [
375
375
  },
376
376
  {
377
377
  name: 'add_test_cases_to_run',
378
- description: 'Add test cases to an existing test run',
378
+ description: 'Add test cases to an existing test run (Cloud only — not supported on Data Center)',
379
379
  inputSchema: {
380
380
  type: 'object',
381
381
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zephyr-scale-mcp-server",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Model Context Protocol (MCP) server for Zephyr Scale test case management with comprehensive STEP_BY_STEP, PLAIN_TEXT, and BDD support",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -22,6 +22,7 @@
22
22
  "test": "node test/run-tests.cjs",
23
23
  "test:unit": "node test/zephyr-server.test.cjs",
24
24
  "test:integration": "node test/integration.test.cjs",
25
+ "report:weekly": "node scripts/weekly-report.cjs",
25
26
  "prepublishOnly": "npm run build"
26
27
  },
27
28
  "keywords": [
package/src/index.ts CHANGED
@@ -25,7 +25,7 @@ class ZephyrServer {
25
25
  this.server = new Server(
26
26
  {
27
27
  name: 'zephyr-server',
28
- version: '0.3.0',
28
+ version: '0.3.1',
29
29
  },
30
30
  {
31
31
  capabilities: {
@@ -611,49 +611,23 @@ export class ZephyrToolHandlers {
611
611
  async addTestCasesToRun(args: AddTestCasesToRunArgs) {
612
612
  const { test_run_key, test_case_keys } = args;
613
613
 
614
+ if (this.jiraConfig.type === 'datacenter') {
615
+ throw new McpError(
616
+ ErrorCode.InvalidRequest,
617
+ 'add_test_cases_to_run is only supported on Zephyr Scale Cloud. The Data Center API (v1) does not provide an endpoint to modify test runs after creation.'
618
+ );
619
+ }
620
+
614
621
  try {
615
- // For Data Center, we need to get the current items and then update
616
- if (this.jiraConfig.type === 'datacenter') {
617
- const getResponse = await this.axiosInstance.get(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}`);
618
- const existingItems = getResponse.data.items || [];
619
- const existingKeys = new Set(existingItems.map((item: any) => item.testCaseKey));
620
-
621
- const newItems = test_case_keys
622
- .filter(key => !existingKeys.has(key))
623
- .map(key => ({ testCaseKey: key, testResultStatus: 'Not Executed' }));
624
-
625
- if (newItems.length > 0) {
626
- let response;
627
- if (this.jiraConfig.type === 'datacenter') {
628
- const minimalPayload = {
629
- items: [...existingItems, ...newItems]
630
- };
631
- response = await this.axiosInstance.put(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}`, minimalPayload);
632
- } else {
633
- const postPayload = { items: newItems.map(item => item.testCaseKey) };
634
- response = await this.axiosInstance.post(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}/testcases`, postPayload);
635
- }
622
+ const payload = {
623
+ items: test_case_keys.map(key => ({ testCaseKey: key }))
624
+ };
625
+ const response = await this.axiosInstance.post(`/testcycles/${test_run_key}/testcases`, payload);
636
626
 
637
- if (response.status === 200 || response.status === 201 || response.status === 204) {
638
- return {
639
- content: [{ type: 'text', text: `Added ${newItems.length} new test cases to test run ${test_run_key}.` }],
640
- };
641
- }
642
- } else {
643
- return {
644
- content: [{ type: 'text', text: 'All specified test cases are already in the test run.' }],
645
- };
646
- }
647
- } else {
648
- // For Cloud, we can just post the new test case keys
649
- const fullPayload = { items: test_case_keys };
650
- const response = await this.axiosInstance.put(`${this.jiraConfig.apiEndpoints.testrun}/${test_run_key}`, fullPayload);
651
-
652
- if (response.status === 200 || response.status === 204) {
653
- return {
654
- content: [{ type: 'text', text: `Successfully updated test cases for test run ${test_run_key}.` }],
655
- };
656
- }
627
+ if (response.status === 200 || response.status === 201 || response.status === 204) {
628
+ return {
629
+ content: [{ type: 'text', text: `Added ${test_case_keys.length} test case(s) to test run ${test_run_key}.` }],
630
+ };
657
631
  }
658
632
  } catch (error) {
659
633
  throw new McpError(ErrorCode.InternalError, `Failed to add test cases: ${error instanceof Error ? error.message : String(error)}`);
@@ -375,7 +375,7 @@ export const toolSchemas = [
375
375
  },
376
376
  {
377
377
  name: 'add_test_cases_to_run',
378
- description: 'Add test cases to an existing test run',
378
+ description: 'Add test cases to an existing test run (Cloud only — not supported on Data Center)',
379
379
  inputSchema: {
380
380
  type: 'object',
381
381
  properties: {