@testkase/mcp-server 1.0.1 → 1.3.2
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 +122 -29
- package/build/index.js +336 -1
- package/build/index.js.map +1 -1
- package/package.json +6 -32
- package/src/index.ts +0 -302
- package/src/test-config.ts +0 -89
- package/tsconfig.json +0 -19
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# @testkase/mcp-server
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/@testkase/mcp-server)
|
|
4
3
|
[](https://opensource.org/licenses/MIT)
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
⚠️ TEST MODE: This package is currently in testing phase and connects to the TestKase QA environment.
|
|
6
|
+
|
|
7
7
|
|
|
8
8
|
Model Context Protocol (MCP) server for TestKase API. Enables AI agents like Claude Desktop and GitHub Copilot to interact with your TestKase testcase management system.
|
|
9
9
|
|
|
@@ -16,25 +16,18 @@ Model Context Protocol (MCP) server for TestKase API. Enables AI agents like Cla
|
|
|
16
16
|
🔐 **Secure** - Uses Personal Access Token (PAT) authentication
|
|
17
17
|
🤖 **AI-Ready** - Works with Claude Desktop, GitHub Copilot, and other MCP clients
|
|
18
18
|
|
|
19
|
-
## Installation
|
|
20
19
|
|
|
21
|
-
### Global Installation (
|
|
20
|
+
### Global Installation (After NPM Publication)
|
|
22
21
|
|
|
23
22
|
```bash
|
|
24
23
|
npm install -g @testkase/mcp-server
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
### Local Installation
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm install @testkase/mcp-server
|
|
31
|
-
```
|
|
32
|
-
|
|
33
26
|
## Quick Start
|
|
34
27
|
|
|
35
28
|
### 1. Get Your PAT Token
|
|
36
29
|
|
|
37
|
-
1. Log in to [TestKase
|
|
30
|
+
1. Log in to [TestKase](https://apiqa.testkase.com)
|
|
38
31
|
2. Navigate to **Settings → Personal Access Tokens**
|
|
39
32
|
3. Click **"Generate New Token"**
|
|
40
33
|
4. Copy the token (starts with `xyz_`)
|
|
@@ -47,6 +40,23 @@ Edit your Claude config file:
|
|
|
47
40
|
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
48
41
|
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
49
42
|
|
|
43
|
+
**For local testing (before NPM publish):**
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"mcpServers": {
|
|
47
|
+
"testkase": {
|
|
48
|
+
"command": "node",
|
|
49
|
+
"args": ["D:\\workspaces\\TestKase\\testkase-backend\\mcp-server\\build\\index.js"],
|
|
50
|
+
"env": {
|
|
51
|
+
"TESTKASE_API_BASE_URL": "https://apiqa.testkase.com",
|
|
52
|
+
"TESTKASE_PAT_TOKEN": "xyz_your_pat_token_here"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**After NPM publication:**
|
|
50
60
|
```json
|
|
51
61
|
{
|
|
52
62
|
"mcpServers": {
|
|
@@ -68,6 +78,23 @@ Edit your Copilot config file:
|
|
|
68
78
|
- **Windows**: `%APPDATA%\Code\User\globalStorage\github.copilot\mcp.json`
|
|
69
79
|
- **macOS**: `~/Library/Application Support/Code/User/globalStorage/github.copilot/mcp.json`
|
|
70
80
|
|
|
81
|
+
**For local testing (before NPM publish):**
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"testkase": {
|
|
86
|
+
"command": "node",
|
|
87
|
+
"args": ["D:\\workspaces\\TestKase\\testkase-backend\\mcp-server\\build\\index.js"],
|
|
88
|
+
"env": {
|
|
89
|
+
"TESTKASE_API_BASE_URL": "https://apiqa.testkase.com",
|
|
90
|
+
"TESTKASE_PAT_TOKEN": "xyz_your_pat_token_here"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**After NPM publication:**
|
|
71
98
|
```json
|
|
72
99
|
{
|
|
73
100
|
"mcpServers": {
|
|
@@ -113,6 +140,59 @@ Retrieve testcases from a project with optional filters and pagination.
|
|
|
113
140
|
- `sortOrder`: `"asc"` or `"desc"`
|
|
114
141
|
- And more...
|
|
115
142
|
|
|
143
|
+
### `get_testcase_detail`
|
|
144
|
+
|
|
145
|
+
Get detailed information about a specific testcase including all fields, test steps, attachments, and related data.
|
|
146
|
+
|
|
147
|
+
**Parameters:**
|
|
148
|
+
- `projectId` (required): Project UUID
|
|
149
|
+
- `testcaseId` (required): Testcase ID
|
|
150
|
+
- `organizationId` (required): Organization ID
|
|
151
|
+
|
|
152
|
+
### `get_testcase_history`
|
|
153
|
+
|
|
154
|
+
Get the complete history of changes made to a testcase with timestamps and user information.
|
|
155
|
+
|
|
156
|
+
**Parameters:**
|
|
157
|
+
- `projectId` (required): Project UUID
|
|
158
|
+
- `testcaseId` (required): Testcase ID
|
|
159
|
+
- `organizationId` (required): Organization ID
|
|
160
|
+
|
|
161
|
+
### `get_folders`
|
|
162
|
+
|
|
163
|
+
Get the folder/section structure of a project used to organize testcases.
|
|
164
|
+
|
|
165
|
+
**Parameters:**
|
|
166
|
+
- `organizationId` (required): Organization ID
|
|
167
|
+
- `projectId` (required): Project UUID
|
|
168
|
+
- `folder_id` (optional): Filter by specific folder
|
|
169
|
+
|
|
170
|
+
### `get_labels`
|
|
171
|
+
|
|
172
|
+
Get all labels/tags available in a project for categorizing testcases.
|
|
173
|
+
|
|
174
|
+
**Parameters:**
|
|
175
|
+
- `projectId` (required): Project UUID
|
|
176
|
+
- `organizationId` (required): Organization ID
|
|
177
|
+
|
|
178
|
+
### `get_issues`
|
|
179
|
+
|
|
180
|
+
Get all issues/defects reported in a project with their status and priority.
|
|
181
|
+
|
|
182
|
+
**Parameters:**
|
|
183
|
+
- `projectId` (required): Project UUID
|
|
184
|
+
- `organizationId` (required): Organization ID
|
|
185
|
+
- `page` (optional): Page number
|
|
186
|
+
- `limit` (optional): Items per page
|
|
187
|
+
|
|
188
|
+
### `get_my_projects`
|
|
189
|
+
|
|
190
|
+
Get all projects that the current user (PAT token owner) has access to across all organizations.
|
|
191
|
+
|
|
192
|
+
**Parameters:**
|
|
193
|
+
- `page` (optional): Page number (default: 1)
|
|
194
|
+
- `limit` (optional): Items per page (default: 12)
|
|
195
|
+
|
|
116
196
|
## Configuration
|
|
117
197
|
|
|
118
198
|
### Environment Variables
|
|
@@ -120,28 +200,51 @@ Retrieve testcases from a project with optional filters and pagination.
|
|
|
120
200
|
- **`TESTKASE_API_BASE_URL`**: API base URL (default: `https://apiqa.testkase.com`)
|
|
121
201
|
- **`TESTKASE_PAT_TOKEN`**: Your Personal Access Token (required)
|
|
122
202
|
|
|
123
|
-
|
|
203
|
+
### Using with Different Environments
|
|
204
|
+
|
|
205
|
+
**Production:**
|
|
206
|
+
```json
|
|
207
|
+
"env": {
|
|
208
|
+
"TESTKASE_API_BASE_URL": "https://api.testkase.com",
|
|
209
|
+
"TESTKASE_PAT_TOKEN": "xyz_your_token"
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Local Development:**
|
|
214
|
+
```json
|
|
215
|
+
"env": {
|
|
216
|
+
"TESTKASE_API_BASE_URL": "http://localhost:8080",
|
|
217
|
+
"TESTKASE_PAT_TOKEN": "xyz_your_token"
|
|
218
|
+
}
|
|
219
|
+
```
|
|
124
220
|
|
|
125
221
|
## Usage Examples
|
|
126
222
|
|
|
127
|
-
### Basic
|
|
223
|
+
### Basic Queries
|
|
128
224
|
```
|
|
129
225
|
"Show me testcases for project PRJ-1030 organization 1171"
|
|
226
|
+
"Get high priority active testcases from project PRJ-1030 org 1171"
|
|
227
|
+
"Find testcases about 'authentication' in project PRJ-1030 org 1171"
|
|
228
|
+
"Show testcases updated this week in project PRJ-1030 org 1171"
|
|
130
229
|
```
|
|
131
230
|
|
|
132
|
-
###
|
|
231
|
+
### Detailed Information
|
|
133
232
|
```
|
|
134
|
-
"Get
|
|
233
|
+
"Get detailed information about testcase TC-123 in project PRJ-1030 org 1171"
|
|
234
|
+
"Show me the history of changes for testcase TC-456 in project PRJ-1030 org 1171"
|
|
135
235
|
```
|
|
136
236
|
|
|
137
|
-
###
|
|
237
|
+
### Project Organization
|
|
138
238
|
```
|
|
139
|
-
"
|
|
239
|
+
"Show me all folders in project PRJ-1030 org 1171"
|
|
240
|
+
"List all labels available in project PRJ-1030 org 1171"
|
|
241
|
+
"Get all issues/defects for project PRJ-1030 org 1171"
|
|
140
242
|
```
|
|
141
243
|
|
|
142
|
-
###
|
|
244
|
+
### User Projects
|
|
143
245
|
```
|
|
144
|
-
"Show
|
|
246
|
+
"Show me all my projects"
|
|
247
|
+
"List all projects I have access to"
|
|
145
248
|
```
|
|
146
249
|
|
|
147
250
|
## Troubleshooting
|
|
@@ -168,8 +271,6 @@ Retrieve testcases from a project with optional filters and pagination.
|
|
|
168
271
|
|
|
169
272
|
## Support
|
|
170
273
|
|
|
171
|
-
> **Note**: This is a test version connecting to the QA environment at `https://apiqa.testkase.com`
|
|
172
|
-
|
|
173
274
|
- 📧 Email: support@testkase.com
|
|
174
275
|
- 🌐 Website: [testkase.com](https://testkase.com)
|
|
175
276
|
|
|
@@ -184,11 +285,3 @@ Retrieve testcases from a project with optional filters and pagination.
|
|
|
184
285
|
|
|
185
286
|
MIT © TestKase
|
|
186
287
|
|
|
187
|
-
## Changelog
|
|
188
|
-
|
|
189
|
-
### 1.0.0 (2026-01-30)
|
|
190
|
-
- Initial release
|
|
191
|
-
- Support for `get_testcases` tool
|
|
192
|
-
- Claude Desktop and GitHub Copilot support
|
|
193
|
-
- PAT token authentication
|
|
194
|
-
- Advanced filtering and search capabilities
|
package/build/index.js
CHANGED
|
@@ -92,6 +92,145 @@ const GET_TESTCASES_TOOL = {
|
|
|
92
92
|
required: ["projectId", "organizationId"],
|
|
93
93
|
},
|
|
94
94
|
};
|
|
95
|
+
const GET_TESTCASE_DETAIL_TOOL = {
|
|
96
|
+
name: "get_testcase_detail",
|
|
97
|
+
description: "Get detailed information about a specific testcase including all fields, test steps, attachments, and related data. " +
|
|
98
|
+
"Use this tool to retrieve complete information about a single testcase.",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
projectId: {
|
|
103
|
+
type: "string",
|
|
104
|
+
description: "The unique identifier of the project",
|
|
105
|
+
},
|
|
106
|
+
testcaseId: {
|
|
107
|
+
type: "string",
|
|
108
|
+
description: "The unique identifier of the testcase",
|
|
109
|
+
},
|
|
110
|
+
organizationId: {
|
|
111
|
+
type: "number",
|
|
112
|
+
description: "The organization ID that owns the project",
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
required: ["projectId", "testcaseId", "organizationId"],
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const GET_TESTCASE_HISTORY_TOOL = {
|
|
119
|
+
name: "get_testcase_history",
|
|
120
|
+
description: "Get the complete history of changes made to a testcase. " +
|
|
121
|
+
"Returns a list of all modifications with timestamps, user information, and changed fields. " +
|
|
122
|
+
"Useful for tracking testcase evolution and audit trails.",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
projectId: {
|
|
127
|
+
type: "string",
|
|
128
|
+
description: "The unique identifier of the project",
|
|
129
|
+
},
|
|
130
|
+
testcaseId: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "The unique identifier of the testcase",
|
|
133
|
+
},
|
|
134
|
+
organizationId: {
|
|
135
|
+
type: "number",
|
|
136
|
+
description: "The organization ID that owns the project",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
required: ["projectId", "testcaseId", "organizationId"],
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
const GET_FOLDERS_TOOL = {
|
|
143
|
+
name: "get_folders",
|
|
144
|
+
description: "Get the folder/section structure of a project. " +
|
|
145
|
+
"Returns a hierarchical list of folders and sections used to organize testcases. " +
|
|
146
|
+
"Useful for understanding project organization and navigating testcase structure.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
organizationId: {
|
|
151
|
+
type: "number",
|
|
152
|
+
description: "The organization ID",
|
|
153
|
+
},
|
|
154
|
+
projectId: {
|
|
155
|
+
type: "string",
|
|
156
|
+
description: "The unique identifier of the project",
|
|
157
|
+
},
|
|
158
|
+
folder_id: {
|
|
159
|
+
type: "string",
|
|
160
|
+
description: "Optional: Filter by specific folder ID",
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
required: ["organizationId", "projectId"],
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
const GET_LABELS_TOOL = {
|
|
167
|
+
name: "get_labels",
|
|
168
|
+
description: "Get all labels/tags available in a project. " +
|
|
169
|
+
"Labels are used to categorize and filter testcases. " +
|
|
170
|
+
"Returns label names, colors, and usage counts.",
|
|
171
|
+
inputSchema: {
|
|
172
|
+
type: "object",
|
|
173
|
+
properties: {
|
|
174
|
+
projectId: {
|
|
175
|
+
type: "string",
|
|
176
|
+
description: "The unique identifier of the project",
|
|
177
|
+
},
|
|
178
|
+
organizationId: {
|
|
179
|
+
type: "number",
|
|
180
|
+
description: "The organization ID",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
required: ["projectId", "organizationId"],
|
|
184
|
+
},
|
|
185
|
+
};
|
|
186
|
+
const GET_ISSUES_TOOL = {
|
|
187
|
+
name: "get_issues",
|
|
188
|
+
description: "Get all issues/defects reported in a project. " +
|
|
189
|
+
"Returns a list of issues with their status, priority, and linked testcases. " +
|
|
190
|
+
"Useful for tracking bugs and defects found during testing.",
|
|
191
|
+
inputSchema: {
|
|
192
|
+
type: "object",
|
|
193
|
+
properties: {
|
|
194
|
+
projectId: {
|
|
195
|
+
type: "string",
|
|
196
|
+
description: "The unique identifier of the project",
|
|
197
|
+
},
|
|
198
|
+
organizationId: {
|
|
199
|
+
type: "number",
|
|
200
|
+
description: "The organization ID",
|
|
201
|
+
},
|
|
202
|
+
page: {
|
|
203
|
+
type: "number",
|
|
204
|
+
description: "Page number for pagination (default: 1)",
|
|
205
|
+
},
|
|
206
|
+
limit: {
|
|
207
|
+
type: "number",
|
|
208
|
+
description: "Number of items per page (default: 20)",
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
required: ["projectId", "organizationId"],
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
const GET_MY_PROJECTS_TOOL = {
|
|
215
|
+
name: "get_my_projects",
|
|
216
|
+
description: "Get all projects that the current user (PAT token owner) has access to across all organizations. " +
|
|
217
|
+
"Returns project details including name, ID, organization, and team members. " +
|
|
218
|
+
"Useful for discovering available projects and their basic information.",
|
|
219
|
+
inputSchema: {
|
|
220
|
+
type: "object",
|
|
221
|
+
properties: {
|
|
222
|
+
page: {
|
|
223
|
+
type: "number",
|
|
224
|
+
description: "Page number for pagination (default: 1)",
|
|
225
|
+
},
|
|
226
|
+
limit: {
|
|
227
|
+
type: "number",
|
|
228
|
+
description: "Number of items per page (default: 12)",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
required: [],
|
|
232
|
+
},
|
|
233
|
+
};
|
|
95
234
|
// Create server instance
|
|
96
235
|
const server = new Server({
|
|
97
236
|
name: "testkase-mcp-server",
|
|
@@ -104,7 +243,15 @@ const server = new Server({
|
|
|
104
243
|
// List available tools
|
|
105
244
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
106
245
|
return {
|
|
107
|
-
tools: [
|
|
246
|
+
tools: [
|
|
247
|
+
GET_TESTCASES_TOOL,
|
|
248
|
+
GET_TESTCASE_DETAIL_TOOL,
|
|
249
|
+
GET_TESTCASE_HISTORY_TOOL,
|
|
250
|
+
GET_FOLDERS_TOOL,
|
|
251
|
+
GET_LABELS_TOOL,
|
|
252
|
+
GET_ISSUES_TOOL,
|
|
253
|
+
GET_MY_PROJECTS_TOOL,
|
|
254
|
+
],
|
|
108
255
|
};
|
|
109
256
|
});
|
|
110
257
|
// Handle tool calls
|
|
@@ -114,6 +261,24 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
114
261
|
if (name === "get_testcases") {
|
|
115
262
|
return await handleGetTestcases(args);
|
|
116
263
|
}
|
|
264
|
+
else if (name === "get_testcase_detail") {
|
|
265
|
+
return await handleGetTestcaseDetail(args);
|
|
266
|
+
}
|
|
267
|
+
else if (name === "get_testcase_history") {
|
|
268
|
+
return await handleGetTestcaseHistory(args);
|
|
269
|
+
}
|
|
270
|
+
else if (name === "get_folders") {
|
|
271
|
+
return await handleGetFolders(args);
|
|
272
|
+
}
|
|
273
|
+
else if (name === "get_labels") {
|
|
274
|
+
return await handleGetLabels(args);
|
|
275
|
+
}
|
|
276
|
+
else if (name === "get_issues") {
|
|
277
|
+
return await handleGetIssues(args);
|
|
278
|
+
}
|
|
279
|
+
else if (name === "get_my_projects") {
|
|
280
|
+
return await handleGetMyProjects(args);
|
|
281
|
+
}
|
|
117
282
|
throw new Error(`Unknown tool: ${name}`);
|
|
118
283
|
}
|
|
119
284
|
catch (error) {
|
|
@@ -255,6 +420,176 @@ async function handleGetTestcases(args) {
|
|
|
255
420
|
throw error;
|
|
256
421
|
}
|
|
257
422
|
}
|
|
423
|
+
// Handler for get_testcase_detail tool
|
|
424
|
+
async function handleGetTestcaseDetail(args) {
|
|
425
|
+
validateAuth();
|
|
426
|
+
const queryParams = new URLSearchParams();
|
|
427
|
+
queryParams.append("organizationId", args.organizationId.toString());
|
|
428
|
+
const url = `${config.apiBaseUrl}/api/v1/projects/testcases/get-testcase-detail/${args.projectId}/${args.testcaseId}?${queryParams.toString()}`;
|
|
429
|
+
try {
|
|
430
|
+
const response = await axios.get(url, {
|
|
431
|
+
headers: {
|
|
432
|
+
"Content-Type": "application/json",
|
|
433
|
+
"Authorization": `Bearer ${config.patToken}`,
|
|
434
|
+
},
|
|
435
|
+
});
|
|
436
|
+
const data = response.data;
|
|
437
|
+
return formatResponse(data, `Testcase Detail: ${args.testcaseId}`);
|
|
438
|
+
}
|
|
439
|
+
catch (error) {
|
|
440
|
+
throw handleApiError(error);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// Handler for get_testcase_history tool
|
|
444
|
+
async function handleGetTestcaseHistory(args) {
|
|
445
|
+
validateAuth();
|
|
446
|
+
const queryParams = new URLSearchParams();
|
|
447
|
+
queryParams.append("organizationId", args.organizationId.toString());
|
|
448
|
+
const url = `${config.apiBaseUrl}/api/v1/projects/testcases/get-testcase-history/${args.projectId}/${args.testcaseId}?${queryParams.toString()}`;
|
|
449
|
+
try {
|
|
450
|
+
const response = await axios.get(url, {
|
|
451
|
+
headers: {
|
|
452
|
+
"Content-Type": "application/json",
|
|
453
|
+
"Authorization": `Bearer ${config.patToken}`,
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
const data = response.data;
|
|
457
|
+
return formatResponse(data, `Testcase History: ${args.testcaseId}`);
|
|
458
|
+
}
|
|
459
|
+
catch (error) {
|
|
460
|
+
throw handleApiError(error);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// Handler for get_folders tool
|
|
464
|
+
async function handleGetFolders(args) {
|
|
465
|
+
validateAuth();
|
|
466
|
+
const queryParams = new URLSearchParams();
|
|
467
|
+
queryParams.append("organizationId", args.organizationId.toString());
|
|
468
|
+
queryParams.append("projectId", args.projectId);
|
|
469
|
+
if (args.folder_id) {
|
|
470
|
+
queryParams.append("folder_id", args.folder_id);
|
|
471
|
+
}
|
|
472
|
+
const url = `${config.apiBaseUrl}/api/v1/folders/get-folders?${queryParams.toString()}`;
|
|
473
|
+
try {
|
|
474
|
+
const response = await axios.get(url, {
|
|
475
|
+
headers: {
|
|
476
|
+
"Content-Type": "application/json",
|
|
477
|
+
"Authorization": `Bearer ${config.patToken}`,
|
|
478
|
+
},
|
|
479
|
+
});
|
|
480
|
+
const data = response.data;
|
|
481
|
+
return formatResponse(data, `Folders for Project: ${args.projectId}`);
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
throw handleApiError(error);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
// Handler for get_labels tool
|
|
488
|
+
async function handleGetLabels(args) {
|
|
489
|
+
validateAuth();
|
|
490
|
+
const queryParams = new URLSearchParams();
|
|
491
|
+
queryParams.append("organizationId", args.organizationId.toString());
|
|
492
|
+
const url = `${config.apiBaseUrl}/api/v1/label/get-label/${args.projectId}?${queryParams.toString()}`;
|
|
493
|
+
try {
|
|
494
|
+
const response = await axios.get(url, {
|
|
495
|
+
headers: {
|
|
496
|
+
"Content-Type": "application/json",
|
|
497
|
+
"Authorization": `Bearer ${config.patToken}`,
|
|
498
|
+
},
|
|
499
|
+
});
|
|
500
|
+
const data = response.data;
|
|
501
|
+
return formatResponse(data, `Labels for Project: ${args.projectId}`);
|
|
502
|
+
}
|
|
503
|
+
catch (error) {
|
|
504
|
+
throw handleApiError(error);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
// Handler for get_issues tool
|
|
508
|
+
async function handleGetIssues(args) {
|
|
509
|
+
validateAuth();
|
|
510
|
+
const queryParams = new URLSearchParams();
|
|
511
|
+
queryParams.append("organizationId", args.organizationId.toString());
|
|
512
|
+
if (args.page)
|
|
513
|
+
queryParams.append("page", args.page.toString());
|
|
514
|
+
if (args.limit)
|
|
515
|
+
queryParams.append("limit", args.limit.toString());
|
|
516
|
+
const url = `${config.apiBaseUrl}/api/v1/issues/get-issues/${args.projectId}?${queryParams.toString()}`;
|
|
517
|
+
try {
|
|
518
|
+
const response = await axios.get(url, {
|
|
519
|
+
headers: {
|
|
520
|
+
"Content-Type": "application/json",
|
|
521
|
+
"Authorization": `Bearer ${config.patToken}`,
|
|
522
|
+
},
|
|
523
|
+
});
|
|
524
|
+
const data = response.data;
|
|
525
|
+
return formatResponse(data, `Issues for Project: ${args.projectId}`);
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
throw handleApiError(error);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
// Handler for get_my_projects tool
|
|
532
|
+
async function handleGetMyProjects(args) {
|
|
533
|
+
validateAuth();
|
|
534
|
+
const queryParams = new URLSearchParams();
|
|
535
|
+
if (args.page)
|
|
536
|
+
queryParams.append("page", args.page.toString());
|
|
537
|
+
if (args.limit)
|
|
538
|
+
queryParams.append("limit", args.limit.toString());
|
|
539
|
+
const url = `${config.apiBaseUrl}/api/v1/projects/user/my-projects?${queryParams.toString()}`;
|
|
540
|
+
try {
|
|
541
|
+
const response = await axios.get(url, {
|
|
542
|
+
headers: {
|
|
543
|
+
"Content-Type": "application/json",
|
|
544
|
+
"Authorization": `Bearer ${config.patToken}`,
|
|
545
|
+
},
|
|
546
|
+
});
|
|
547
|
+
const data = response.data;
|
|
548
|
+
return formatResponse(data, "My Projects");
|
|
549
|
+
}
|
|
550
|
+
catch (error) {
|
|
551
|
+
throw handleApiError(error);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
// Helper function to validate authentication
|
|
555
|
+
function validateAuth() {
|
|
556
|
+
if (!config.patToken) {
|
|
557
|
+
throw new Error("Authentication required. Please set TESTKASE_PAT_TOKEN environment variable. " +
|
|
558
|
+
"Generate a Personal Access Token (PAT) from your TestKase account settings.");
|
|
559
|
+
}
|
|
560
|
+
if (!config.patToken.startsWith("xyz_")) {
|
|
561
|
+
throw new Error("Invalid PAT token format. TestKase PAT tokens must start with 'xyz_' prefix. " +
|
|
562
|
+
"Please generate a valid PAT from your TestKase account settings.");
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
// Helper function to format API response
|
|
566
|
+
function formatResponse(data, title) {
|
|
567
|
+
let resultText = `# ${title}\n\n`;
|
|
568
|
+
resultText += "```json\n";
|
|
569
|
+
resultText += JSON.stringify(data, null, 2);
|
|
570
|
+
resultText += "\n```\n";
|
|
571
|
+
return {
|
|
572
|
+
content: [
|
|
573
|
+
{
|
|
574
|
+
type: "text",
|
|
575
|
+
text: resultText,
|
|
576
|
+
},
|
|
577
|
+
],
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
// Helper function to handle API errors
|
|
581
|
+
function handleApiError(error) {
|
|
582
|
+
if (axios.isAxiosError(error)) {
|
|
583
|
+
const axiosError = error;
|
|
584
|
+
let errorMessage = `API request failed: ${axiosError.message}`;
|
|
585
|
+
if (axiosError.response) {
|
|
586
|
+
errorMessage += `\nStatus: ${axiosError.response.status}`;
|
|
587
|
+
errorMessage += `\nResponse: ${JSON.stringify(axiosError.response.data)}`;
|
|
588
|
+
}
|
|
589
|
+
return new Error(errorMessage);
|
|
590
|
+
}
|
|
591
|
+
return error;
|
|
592
|
+
}
|
|
258
593
|
// Start the server
|
|
259
594
|
async function main() {
|
|
260
595
|
const transport = new StdioServerTransport();
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAqB,MAAM,OAAO,CAAC;AAQ1C,+CAA+C;AAC/C,MAAM,MAAM,GAAW;IACrB,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,4BAA4B;IAC7E,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;CACzC,CAAC;AAEF,mBAAmB;AACnB,MAAM,kBAAkB,GAAS;IAC/B,IAAI,EAAE,eAAe;IACrB,WAAW,EACT,mFAAmF;QACnF,qGAAqG;QACrG,mEAAmE;QACnE,0DAA0D;IAC5D,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV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AC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;AACxD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,52 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testkase/mcp-server",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.2",
|
|
4
|
+
"description": "MCP server for TestKase API - Get Testcases endpoint",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./build/index.js",
|
|
7
6
|
"bin": {
|
|
8
7
|
"testkase-mcp": "./build/index.js"
|
|
9
8
|
},
|
|
10
|
-
"files": [
|
|
11
|
-
"build/",
|
|
12
|
-
"src/",
|
|
13
|
-
"README.md",
|
|
14
|
-
"tsconfig.json"
|
|
15
|
-
],
|
|
16
9
|
"scripts": {
|
|
17
10
|
"build": "tsc",
|
|
18
11
|
"prepare": "npm run build",
|
|
19
|
-
"prepublishOnly": "npm run build",
|
|
20
12
|
"watch": "tsc --watch",
|
|
21
|
-
"start": "node build/index.js"
|
|
13
|
+
"start": "node build/index.js",
|
|
14
|
+
"test-config": "node build/test-config.js"
|
|
22
15
|
},
|
|
23
16
|
"keywords": [
|
|
24
17
|
"mcp",
|
|
25
|
-
"model-context-protocol",
|
|
26
18
|
"testcase",
|
|
27
|
-
"test-management",
|
|
28
19
|
"api",
|
|
29
|
-
"testkase"
|
|
30
|
-
"ai-agent",
|
|
31
|
-
"claude",
|
|
32
|
-
"copilot",
|
|
33
|
-
"qa",
|
|
34
|
-
"testing"
|
|
20
|
+
"testkase"
|
|
35
21
|
],
|
|
36
|
-
"author": "
|
|
37
|
-
"homepage": "https://github.com/SolvionIT/testkase-backend/tree/QA/mcp-server",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "https://github.com/SolvionIT/testkase-backend.git",
|
|
41
|
-
"directory": "mcp-server"
|
|
42
|
-
},
|
|
43
|
-
"bugs": {
|
|
44
|
-
"url": "https://github.com/SolvionIT/testkase-backend/issues"
|
|
45
|
-
},
|
|
22
|
+
"author": "",
|
|
46
23
|
"license": "MIT",
|
|
47
|
-
"publishConfig": {
|
|
48
|
-
"access": "public"
|
|
49
|
-
},
|
|
50
24
|
"dependencies": {
|
|
51
25
|
"@modelcontextprotocol/sdk": "^0.5.0",
|
|
52
26
|
"axios": "^1.6.0",
|
package/src/index.ts
DELETED
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
-
import {
|
|
6
|
-
CallToolRequestSchema,
|
|
7
|
-
ListToolsRequestSchema,
|
|
8
|
-
Tool,
|
|
9
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
-
import axios, { AxiosError } from "axios";
|
|
11
|
-
|
|
12
|
-
// Configuration interface
|
|
13
|
-
interface Config {
|
|
14
|
-
apiBaseUrl: string;
|
|
15
|
-
patToken?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Get configuration from environment variables
|
|
19
|
-
const config: Config = {
|
|
20
|
-
apiBaseUrl: process.env.TESTKASE_API_BASE_URL || "https://apiqa.testkase.com",
|
|
21
|
-
patToken: process.env.TESTKASE_PAT_TOKEN,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
// Tool definitions
|
|
25
|
-
const GET_TESTCASES_TOOL: Tool = {
|
|
26
|
-
name: "get_testcases",
|
|
27
|
-
description:
|
|
28
|
-
"Retrieve testcases from a project with optional filters, pagination, and search. " +
|
|
29
|
-
"Returns a list of testcases with their details including title, status, priority, owner, and more. " +
|
|
30
|
-
"Supports filtering by status, priority, dates, and other fields. " +
|
|
31
|
-
"Use this tool to query testcases for a specific project.",
|
|
32
|
-
inputSchema: {
|
|
33
|
-
type: "object",
|
|
34
|
-
properties: {
|
|
35
|
-
projectId: {
|
|
36
|
-
type: "string",
|
|
37
|
-
description: "The unique identifier of the project (UUID format)",
|
|
38
|
-
},
|
|
39
|
-
organizationId: {
|
|
40
|
-
type: "number",
|
|
41
|
-
description: "The organization ID that owns the project",
|
|
42
|
-
},
|
|
43
|
-
page: {
|
|
44
|
-
type: "number",
|
|
45
|
-
description: "Page number for pagination (default: 1)",
|
|
46
|
-
default: 1,
|
|
47
|
-
},
|
|
48
|
-
limit: {
|
|
49
|
-
type: "number",
|
|
50
|
-
description: "Number of items per page (default: 20)",
|
|
51
|
-
default: 20,
|
|
52
|
-
},
|
|
53
|
-
selectAll: {
|
|
54
|
-
type: "boolean",
|
|
55
|
-
description: "If true, returns all testcases without pagination",
|
|
56
|
-
default: false,
|
|
57
|
-
},
|
|
58
|
-
columns: {
|
|
59
|
-
type: "string",
|
|
60
|
-
description:
|
|
61
|
-
"Comma-separated list of columns to return. " +
|
|
62
|
-
"Example: 'id,title,priority,status,automated,updated_by,created_at,updated_at'",
|
|
63
|
-
},
|
|
64
|
-
filters: {
|
|
65
|
-
type: "string",
|
|
66
|
-
description:
|
|
67
|
-
"JSON string of filters to apply. " +
|
|
68
|
-
'Example: {"status":["active","in_progress"],"priority":["high","critical"]}',
|
|
69
|
-
},
|
|
70
|
-
search: {
|
|
71
|
-
type: "string",
|
|
72
|
-
description: "Search term to filter testcases by title or summary",
|
|
73
|
-
},
|
|
74
|
-
searchType: {
|
|
75
|
-
type: "string",
|
|
76
|
-
enum: ["normal", "ai_search"],
|
|
77
|
-
description:
|
|
78
|
-
"Type of search to perform: 'normal' for basic text search, 'ai_search' for semantic search",
|
|
79
|
-
default: "normal",
|
|
80
|
-
},
|
|
81
|
-
sortBy: {
|
|
82
|
-
type: "string",
|
|
83
|
-
description: "Field to sort by (default: 'updated_at')",
|
|
84
|
-
default: "updated_at",
|
|
85
|
-
},
|
|
86
|
-
sortOrder: {
|
|
87
|
-
type: "string",
|
|
88
|
-
enum: ["asc", "desc"],
|
|
89
|
-
description: "Sort order: 'asc' or 'desc' (default: 'desc')",
|
|
90
|
-
default: "desc",
|
|
91
|
-
},
|
|
92
|
-
create_start_date: {
|
|
93
|
-
type: "string",
|
|
94
|
-
description: "Filter by creation start date (ISO 8601 format: YYYY-MM-DD)",
|
|
95
|
-
},
|
|
96
|
-
create_end_date: {
|
|
97
|
-
type: "string",
|
|
98
|
-
description: "Filter by creation end date (ISO 8601 format: YYYY-MM-DD)",
|
|
99
|
-
},
|
|
100
|
-
updated_start_date: {
|
|
101
|
-
type: "string",
|
|
102
|
-
description: "Filter by update start date (ISO 8601 format: YYYY-MM-DD)",
|
|
103
|
-
},
|
|
104
|
-
updated_end_date: {
|
|
105
|
-
type: "string",
|
|
106
|
-
description: "Filter by update end date (ISO 8601 format: YYYY-MM-DD)",
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
required: ["projectId", "organizationId"],
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
// Create server instance
|
|
114
|
-
const server = new Server(
|
|
115
|
-
{
|
|
116
|
-
name: "testkase-mcp-server",
|
|
117
|
-
version: "1.0.0",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
capabilities: {
|
|
121
|
-
tools: {},
|
|
122
|
-
},
|
|
123
|
-
}
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
// List available tools
|
|
127
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
128
|
-
return {
|
|
129
|
-
tools: [GET_TESTCASES_TOOL],
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// Handle tool calls
|
|
134
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
135
|
-
const { name, arguments: args } = request.params;
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
if (name === "get_testcases") {
|
|
139
|
-
return await handleGetTestcases(args as any);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
throw new Error(`Unknown tool: ${name}`);
|
|
143
|
-
} catch (error) {
|
|
144
|
-
if (error instanceof Error) {
|
|
145
|
-
return {
|
|
146
|
-
content: [
|
|
147
|
-
{
|
|
148
|
-
type: "text",
|
|
149
|
-
text: `Error: ${error.message}`,
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
isError: true,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
throw error;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
// Handler for get_testcases tool
|
|
160
|
-
async function handleGetTestcases(args: {
|
|
161
|
-
projectId: string;
|
|
162
|
-
organizationId: number;
|
|
163
|
-
page?: number;
|
|
164
|
-
limit?: number;
|
|
165
|
-
selectAll?: boolean;
|
|
166
|
-
columns?: string;
|
|
167
|
-
filters?: string;
|
|
168
|
-
search?: string;
|
|
169
|
-
searchType?: string;
|
|
170
|
-
sortBy?: string;
|
|
171
|
-
sortOrder?: string;
|
|
172
|
-
create_start_date?: string;
|
|
173
|
-
create_end_date?: string;
|
|
174
|
-
updated_start_date?: string;
|
|
175
|
-
updated_end_date?: string;
|
|
176
|
-
}) {
|
|
177
|
-
// Validate required parameters
|
|
178
|
-
if (!args.projectId) {
|
|
179
|
-
throw new Error("projectId is required");
|
|
180
|
-
}
|
|
181
|
-
if (!args.organizationId) {
|
|
182
|
-
throw new Error("organizationId is required");
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Check for authentication
|
|
186
|
-
if (!config.patToken) {
|
|
187
|
-
throw new Error(
|
|
188
|
-
"Authentication required. Please set TESTKASE_PAT_TOKEN environment variable. " +
|
|
189
|
-
"Generate a Personal Access Token (PAT) from your TestKase account settings."
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Validate PAT token format
|
|
194
|
-
if (!config.patToken.startsWith("xyz_")) {
|
|
195
|
-
throw new Error(
|
|
196
|
-
"Invalid PAT token format. TestKase PAT tokens must start with 'xyz_' prefix. " +
|
|
197
|
-
"Please generate a valid PAT from your TestKase account settings."
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Build query parameters
|
|
202
|
-
const queryParams = new URLSearchParams();
|
|
203
|
-
queryParams.append("organizationId", args.organizationId.toString());
|
|
204
|
-
|
|
205
|
-
if (args.page !== undefined) queryParams.append("page", args.page.toString());
|
|
206
|
-
if (args.limit !== undefined) queryParams.append("limit", args.limit.toString());
|
|
207
|
-
if (args.selectAll !== undefined) queryParams.append("selectAll", args.selectAll.toString());
|
|
208
|
-
if (args.columns) queryParams.append("columns", args.columns);
|
|
209
|
-
if (args.filters) queryParams.append("filters", args.filters);
|
|
210
|
-
if (args.search) queryParams.append("search", args.search);
|
|
211
|
-
if (args.searchType) queryParams.append("searchType", args.searchType);
|
|
212
|
-
if (args.sortBy) queryParams.append("sortBy", args.sortBy);
|
|
213
|
-
if (args.sortOrder) queryParams.append("sortOrder", args.sortOrder);
|
|
214
|
-
if (args.create_start_date) queryParams.append("create_start_date", args.create_start_date);
|
|
215
|
-
if (args.create_end_date) queryParams.append("create_end_date", args.create_end_date);
|
|
216
|
-
if (args.updated_start_date) queryParams.append("updated_start_date", args.updated_start_date);
|
|
217
|
-
if (args.updated_end_date) queryParams.append("updated_end_date", args.updated_end_date);
|
|
218
|
-
|
|
219
|
-
// Construct API URL
|
|
220
|
-
const url = `${config.apiBaseUrl}/api/v1/projects/testcases/get-testcase/${args.projectId}?${queryParams.toString()}`;
|
|
221
|
-
|
|
222
|
-
// Prepare headers with PAT token
|
|
223
|
-
// The PAT token is sent as Bearer token and will be validated by TestKase's JwtAuthGuard
|
|
224
|
-
// which checks for 'xyz_' prefix and validates against the PAT database
|
|
225
|
-
const headers: Record<string, string> = {
|
|
226
|
-
"Content-Type": "application/json",
|
|
227
|
-
"Authorization": `Bearer ${config.patToken}`,
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
try {
|
|
231
|
-
// Make API request
|
|
232
|
-
const response = await axios.get(url, { headers });
|
|
233
|
-
|
|
234
|
-
// Format the response
|
|
235
|
-
const data = response.data;
|
|
236
|
-
let resultText = `# Testcases for Project ${args.projectId}\n\n`;
|
|
237
|
-
|
|
238
|
-
if (data.data && Array.isArray(data.data)) {
|
|
239
|
-
resultText += `**Total Results:** ${data.total || data.data.length}\n`;
|
|
240
|
-
if (data.page) resultText += `**Page:** ${data.page}\n`;
|
|
241
|
-
if (data.limit) resultText += `**Limit:** ${data.limit}\n`;
|
|
242
|
-
resultText += `\n## Testcases (${data.data.length} items)\n\n`;
|
|
243
|
-
|
|
244
|
-
data.data.forEach((testcase: any, index: number) => {
|
|
245
|
-
resultText += `### ${index + 1}. ${testcase.title || "Untitled"}\n`;
|
|
246
|
-
resultText += `- **ID:** ${testcase.id}\n`;
|
|
247
|
-
if (testcase.status) resultText += `- **Status:** ${testcase.status}\n`;
|
|
248
|
-
if (testcase.priority) resultText += `- **Priority:** ${testcase.priority}\n`;
|
|
249
|
-
if (testcase.automated !== undefined) resultText += `- **Automated:** ${testcase.automated}\n`;
|
|
250
|
-
if (testcase.summary) resultText += `- **Summary:** ${testcase.summary}\n`;
|
|
251
|
-
if (testcase.owner_id) resultText += `- **Owner ID:** ${testcase.owner_id}\n`;
|
|
252
|
-
if (testcase.folder_id) resultText += `- **Folder ID:** ${testcase.folder_id}\n`;
|
|
253
|
-
if (testcase.created_at) resultText += `- **Created:** ${testcase.created_at}\n`;
|
|
254
|
-
if (testcase.updated_at) resultText += `- **Updated:** ${testcase.updated_at}\n`;
|
|
255
|
-
if (testcase.labels && Array.isArray(testcase.labels) && testcase.labels.length > 0) {
|
|
256
|
-
resultText += `- **Labels:** ${testcase.labels.join(", ")}\n`;
|
|
257
|
-
}
|
|
258
|
-
if (testcase.features && Array.isArray(testcase.features) && testcase.features.length > 0) {
|
|
259
|
-
resultText += `- **Features:** ${testcase.features.join(", ")}\n`;
|
|
260
|
-
}
|
|
261
|
-
resultText += `\n`;
|
|
262
|
-
});
|
|
263
|
-
} else {
|
|
264
|
-
resultText += "No testcases found or unexpected response format.\n\n";
|
|
265
|
-
resultText += `**Raw Response:**\n\`\`\`json\n${JSON.stringify(data, null, 2)}\n\`\`\`\n`;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return {
|
|
269
|
-
content: [
|
|
270
|
-
{
|
|
271
|
-
type: "text",
|
|
272
|
-
text: resultText,
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
};
|
|
276
|
-
} catch (error) {
|
|
277
|
-
if (axios.isAxiosError(error)) {
|
|
278
|
-
const axiosError = error as AxiosError;
|
|
279
|
-
let errorMessage = `API request failed: ${axiosError.message}`;
|
|
280
|
-
|
|
281
|
-
if (axiosError.response) {
|
|
282
|
-
errorMessage += `\nStatus: ${axiosError.response.status}`;
|
|
283
|
-
errorMessage += `\nResponse: ${JSON.stringify(axiosError.response.data)}`;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
throw new Error(errorMessage);
|
|
287
|
-
}
|
|
288
|
-
throw error;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
// Start the server
|
|
293
|
-
async function main() {
|
|
294
|
-
const transport = new StdioServerTransport();
|
|
295
|
-
await server.connect(transport);
|
|
296
|
-
console.error("TestKase MCP Server running on stdio");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
main().catch((error) => {
|
|
300
|
-
console.error("Fatal error in main():", error);
|
|
301
|
-
process.exit(1);
|
|
302
|
-
});
|
package/src/test-config.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// Simple test script to verify MCP server configuration
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import * as dotenv from 'dotenv';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import { fileURLToPath } from 'url';
|
|
6
|
-
|
|
7
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
-
const __dirname = path.dirname(__filename);
|
|
9
|
-
|
|
10
|
-
// Load environment variables
|
|
11
|
-
dotenv.config({ path: path.join(__dirname, '..', '.env') });
|
|
12
|
-
|
|
13
|
-
const API_BASE_URL = process.env.TESTKASE_API_BASE_URL || 'http://localhost:3000';
|
|
14
|
-
const PAT_TOKEN = process.env.TESTKASE_PAT_TOKEN;
|
|
15
|
-
|
|
16
|
-
console.log('🔍 Testing TestKase MCP Server Configuration\n');
|
|
17
|
-
console.log('Configuration:');
|
|
18
|
-
console.log(` API Base URL: ${API_BASE_URL}`);
|
|
19
|
-
console.log(` PAT Token: ${PAT_TOKEN ? PAT_TOKEN.substring(0, 10) + '...' : 'NOT SET'}\n`);
|
|
20
|
-
|
|
21
|
-
if (!PAT_TOKEN) {
|
|
22
|
-
console.error('❌ Error: TESTKASE_PAT_TOKEN not set in .env file');
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (!PAT_TOKEN.startsWith('xyz_')) {
|
|
27
|
-
console.error('❌ Error: PAT token must start with "xyz_" prefix');
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
console.log('✅ PAT token format is valid\n');
|
|
32
|
-
|
|
33
|
-
// Test API connection
|
|
34
|
-
console.log('🔗 Testing API connection...');
|
|
35
|
-
|
|
36
|
-
async function testApiConnection() {
|
|
37
|
-
try {
|
|
38
|
-
// Try to hit a simple endpoint or the health check
|
|
39
|
-
const response = await axios.get(`${API_BASE_URL}/api/v1/projects/testcases/get-testcase/test-project?organizationId=1`, {
|
|
40
|
-
headers: {
|
|
41
|
-
'Authorization': `Bearer ${PAT_TOKEN}`,
|
|
42
|
-
'Content-Type': 'application/json',
|
|
43
|
-
},
|
|
44
|
-
validateStatus: () => true, // Accept any status code
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
console.log(`\n📊 API Response Status: ${response.status}`);
|
|
48
|
-
|
|
49
|
-
if (response.status === 200) {
|
|
50
|
-
console.log('✅ API connection successful!');
|
|
51
|
-
console.log('\n🎉 Your MCP server is configured correctly!');
|
|
52
|
-
console.log('\nNext steps:');
|
|
53
|
-
console.log('1. Start the MCP server: npm start');
|
|
54
|
-
console.log('2. Configure Claude Desktop with the config from claude_desktop_config.example.json');
|
|
55
|
-
console.log('3. Restart Claude Desktop');
|
|
56
|
-
console.log('4. Ask Claude to get testcases for your project');
|
|
57
|
-
} else if (response.status === 401) {
|
|
58
|
-
console.log('⚠️ Authentication failed - PAT token may be invalid, revoked, or expired');
|
|
59
|
-
console.log(' Please check:');
|
|
60
|
-
console.log(' - Token is correct and starts with xyz_');
|
|
61
|
-
console.log(' - Token has not been revoked in TestKase');
|
|
62
|
-
console.log(' - Token has not expired');
|
|
63
|
-
} else if (response.status === 404) {
|
|
64
|
-
console.log('⚠️ Test project not found (this is expected if you used a test project ID)');
|
|
65
|
-
console.log('✅ But authentication worked! Your PAT token is valid.');
|
|
66
|
-
console.log('\n🎉 Your MCP server is configured correctly!');
|
|
67
|
-
} else {
|
|
68
|
-
console.log(`⚠️ Unexpected response: ${response.status}`);
|
|
69
|
-
console.log(` Response: ${JSON.stringify(response.data, null, 2)}`);
|
|
70
|
-
}
|
|
71
|
-
} catch (error) {
|
|
72
|
-
if (axios.isAxiosError(error)) {
|
|
73
|
-
if (error.code === 'ECONNREFUSED') {
|
|
74
|
-
console.log('❌ Cannot connect to API server');
|
|
75
|
-
console.log(` Make sure TestKase backend is running at ${API_BASE_URL}`);
|
|
76
|
-
} else {
|
|
77
|
-
console.log('❌ API request failed:', error.message);
|
|
78
|
-
if (error.response) {
|
|
79
|
-
console.log(` Status: ${error.response.status}`);
|
|
80
|
-
console.log(` Response: ${JSON.stringify(error.response.data, null, 2)}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
} else {
|
|
84
|
-
console.log('❌ Unexpected error:', error);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
testApiConnection();
|
package/tsconfig.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "Node16",
|
|
6
|
-
"outDir": "./build",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"sourceMap": true
|
|
16
|
-
},
|
|
17
|
-
"include": ["src/**/*"],
|
|
18
|
-
"exclude": ["node_modules", "build"]
|
|
19
|
-
}
|