xray-mcp 1.0.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/LICENSE +15 -0
- package/README.md +259 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +851 -0
- package/dist/xray-client.d.ts +191 -0
- package/dist/xray-client.js +759 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Xray MCP Server
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server to integrate Xray Cloud APIs with Claude Code and other MCP clients.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
This MCP server exposes tools to manage test cases and test executions in Xray Cloud using the official GraphQL API:
|
|
8
|
+
|
|
9
|
+
### Test Cases (Test Management)
|
|
10
|
+
- **create_test_case**: Create a new test case (uses GraphQL mutation `createTest`)
|
|
11
|
+
- **get_test_case**: Retrieve details of a specific test case (uses GraphQL query `getTests`)
|
|
12
|
+
- **delete_test_case**: Delete a test case (uses GraphQL mutation `deleteTest`)
|
|
13
|
+
- **search_test_cases**: Search test cases using JQL (Jira Query Language)
|
|
14
|
+
- **get_project_test_cases**: Retrieve all test cases for a project
|
|
15
|
+
- **update_test_case**: ⚠️ Not directly supported - use Jira REST API to update standard fields
|
|
16
|
+
|
|
17
|
+
### Test Executions (Test Automation & CI/CD)
|
|
18
|
+
- **create_test_execution**: Create a new test execution to run tests
|
|
19
|
+
- **get_test_execution**: Retrieve details of a test execution with all test runs
|
|
20
|
+
- **search_test_executions**: Search test executions using JQL
|
|
21
|
+
- **get_project_test_executions**: Retrieve all test executions for a project
|
|
22
|
+
- **update_test_run_status**: Update the status of a test run (PASS, FAIL, etc.)
|
|
23
|
+
|
|
24
|
+
### Test Plans (Test Organization)
|
|
25
|
+
- **create_test_plan**: Create a new test plan to organize tests
|
|
26
|
+
- **get_test_plan**: Retrieve details of a specific test plan with all tests
|
|
27
|
+
- **search_test_plans**: Search test plans using JQL
|
|
28
|
+
- **get_project_test_plans**: Retrieve all test plans for a project
|
|
29
|
+
- **add_tests_to_test_plan**: Add tests to an existing test plan
|
|
30
|
+
- **remove_tests_from_test_plan**: Remove tests from a test plan
|
|
31
|
+
|
|
32
|
+
### Test Sets (Test Grouping)
|
|
33
|
+
- **create_test_set**: Create a new test set to group tests
|
|
34
|
+
- **get_test_set**: Retrieve details of a specific test set with all tests
|
|
35
|
+
- **search_test_sets**: Search test sets using JQL
|
|
36
|
+
- **get_project_test_sets**: Retrieve all test sets for a project
|
|
37
|
+
- **add_tests_to_test_set**: Add tests to an existing test set
|
|
38
|
+
- **remove_tests_from_test_set**: Remove tests from a test set
|
|
39
|
+
|
|
40
|
+
## Prerequisites
|
|
41
|
+
|
|
42
|
+
- Node.js 18 or higher
|
|
43
|
+
- Xray Cloud API credentials (Client ID and Client Secret)
|
|
44
|
+
|
|
45
|
+
## Testing
|
|
46
|
+
|
|
47
|
+
This project includes comprehensive test coverage:
|
|
48
|
+
|
|
49
|
+
- **Unit Tests**: Fast tests with mocked API responses (no credentials needed)
|
|
50
|
+
- **Integration Tests**: End-to-end tests with real Xray Cloud API
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Run unit tests
|
|
54
|
+
npm run test:unit
|
|
55
|
+
|
|
56
|
+
# Run integration tests (requires credentials)
|
|
57
|
+
npm run test:integration
|
|
58
|
+
|
|
59
|
+
# Run all tests
|
|
60
|
+
npm test
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
For detailed testing documentation, see [TESTING.md](./TESTING.md)
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
1. Clone or download this repository
|
|
68
|
+
2. Install dependencies:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
3. Build the project:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run build
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### How to Obtain API Credentials
|
|
81
|
+
|
|
82
|
+
1. Go to https://xray.cloud.getxray.app/
|
|
83
|
+
2. Navigate to **Settings** → **API Keys**
|
|
84
|
+
3. Click on **Create API Key**
|
|
85
|
+
4. Copy the generated Client ID and Client Secret
|
|
86
|
+
|
|
87
|
+
## Usage
|
|
88
|
+
|
|
89
|
+
### Configuration in Claude Code
|
|
90
|
+
|
|
91
|
+
To use this MCP server with Claude Code, add the following configuration to your MCP configuration file (typically `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"xray": {
|
|
97
|
+
"command": "node",
|
|
98
|
+
"args": ["/path/to/xray-mcp/dist/index.js"],
|
|
99
|
+
"env": {
|
|
100
|
+
"XRAY_CLIENT_ID": "your_client_id",
|
|
101
|
+
"XRAY_CLIENT_SECRET": "your_client_secret"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Important:** Replace:
|
|
109
|
+
- `/path/to/xray-mcp` with the absolute path to the project (e.g., `/Users/manuel/repositories/xray-mcp`)
|
|
110
|
+
- `your_client_id` and `your_client_secret` with your Xray Cloud credentials
|
|
111
|
+
|
|
112
|
+
### Local Testing
|
|
113
|
+
|
|
114
|
+
To test the server in development mode:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Set environment variables
|
|
118
|
+
export XRAY_CLIENT_ID="your_client_id"
|
|
119
|
+
export XRAY_CLIENT_SECRET="your_client_secret"
|
|
120
|
+
|
|
121
|
+
# Run the server
|
|
122
|
+
npm run dev
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Usage Examples
|
|
126
|
+
|
|
127
|
+
### Test Cases
|
|
128
|
+
|
|
129
|
+
#### Create a Test Case
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"projectKey": "ABC",
|
|
134
|
+
"summary": "Verify login functionality",
|
|
135
|
+
"description": "Test that users can log in with valid credentials",
|
|
136
|
+
"testType": "Manual",
|
|
137
|
+
"labels": ["login", "authentication"],
|
|
138
|
+
"priority": "High"
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Search Test Cases
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"jql": "project = ABC AND labels = automation",
|
|
147
|
+
"maxResults": 20
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Retrieve Project Test Cases
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"projectKey": "ABC",
|
|
156
|
+
"maxResults": 50
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Test Executions
|
|
161
|
+
|
|
162
|
+
#### Create a Test Execution
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"projectKey": "ABC",
|
|
167
|
+
"summary": "Sprint 23 Regression Tests",
|
|
168
|
+
"description": "Regression testing for sprint 23",
|
|
169
|
+
"testIssueIds": ["10001", "10002", "10003"],
|
|
170
|
+
"testEnvironments": ["Chrome", "Firefox"]
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Retrieve a Test Execution
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"testExecutionKey": "ABC-456"
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### Update Test Run Status
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"testRunId": "5acc7ab0a3fe1b6fcdc3c737",
|
|
187
|
+
"status": "PASS"
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### Search Recent Test Executions
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"jql": "project = ABC AND created >= -7d",
|
|
196
|
+
"maxResults": 20
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Project Structure
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
xray-mcp/
|
|
204
|
+
├── src/
|
|
205
|
+
│ ├── index.ts # Main MCP server
|
|
206
|
+
│ └── xray-client.ts # Client for Xray Cloud APIs
|
|
207
|
+
├── dist/ # Compiled files (generated after build)
|
|
208
|
+
├── .env.example # Template for environment variables
|
|
209
|
+
├── .gitignore
|
|
210
|
+
├── package.json
|
|
211
|
+
├── tsconfig.json
|
|
212
|
+
└── README.md
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Xray Cloud APIs
|
|
216
|
+
|
|
217
|
+
This server uses the following Xray Cloud APIs:
|
|
218
|
+
|
|
219
|
+
- **Authentication**: `POST /api/v1/authenticate` (token valid for 24 hours)
|
|
220
|
+
- **GraphQL Endpoint**: `POST /api/v2/graphql`
|
|
221
|
+
- **Test Queries**: `getTests` - Retrieve tests using JQL
|
|
222
|
+
- **Test Mutations**: `createTest`, `deleteTest` - Create/delete tests
|
|
223
|
+
- **Test Execution Queries**: `getTestExecutions` - Retrieve executions using JQL
|
|
224
|
+
- **Test Execution Mutations**: `createTestExecution`, `updateTestRunStatus` - Manage executions and results
|
|
225
|
+
- **Test Plan Queries**: `getTestPlans` - Retrieve test plans using JQL
|
|
226
|
+
- **Test Plan Mutations**: `createTestPlan`, `addTestsToTestPlan`, `removeTestsFromTestPlan` - Manage test plans
|
|
227
|
+
- **Test Set Queries**: `getTestSets` - Retrieve test sets using JQL
|
|
228
|
+
- **Test Set Mutations**: `createTestSet`, `addTestsToTestSet`, `removeTestsFromTestSet` - Manage test sets
|
|
229
|
+
|
|
230
|
+
For complete API documentation, visit:
|
|
231
|
+
- GraphQL API: https://docs.getxray.app/display/XRAYCLOUD/GraphQL+API
|
|
232
|
+
- GraphQL Schema: https://us.xray.cloud.getxray.app/doc/graphql/
|
|
233
|
+
- REST API: https://docs.getxray.app/display/XRAYCLOUD/REST+API
|
|
234
|
+
|
|
235
|
+
## Use Cases
|
|
236
|
+
|
|
237
|
+
### CI/CD Integration
|
|
238
|
+
Use this MCP server to:
|
|
239
|
+
1. Automatically create test executions in CI/CD pipelines
|
|
240
|
+
2. Update test run statuses based on automated test results
|
|
241
|
+
3. Track test execution across different environments
|
|
242
|
+
4. Generate test execution reports for sprint reviews
|
|
243
|
+
|
|
244
|
+
### Test Management
|
|
245
|
+
Use this MCP server to:
|
|
246
|
+
1. Create and organize test cases
|
|
247
|
+
2. Search tests using complex JQL queries
|
|
248
|
+
3. Manage manual test executions
|
|
249
|
+
4. Track test status over time
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
ISC
|
|
254
|
+
|
|
255
|
+
## Support
|
|
256
|
+
|
|
257
|
+
For issues or questions about Xray Cloud APIs, consult the official documentation:
|
|
258
|
+
- https://docs.getxray.app/
|
|
259
|
+
- https://support.getxray.app/
|
package/dist/index.d.ts
ADDED