@alternative-path/qa-path-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 +23 -0
- package/QUICK_INSTALL.md +133 -0
- package/README.md +226 -0
- package/TOOLS_DOCUMENTATION.md +675 -0
- package/dist/__tests__/tools/module-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/module-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/module-tools.test.js +145 -0
- package/dist/__tests__/tools/module-tools.test.js.map +1 -0
- package/dist/__tests__/tools/project-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/project-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/project-tools.test.js +674 -0
- package/dist/__tests__/tools/project-tools.test.js.map +1 -0
- package/dist/__tests__/tools/query-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/query-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/query-tools.test.js +225 -0
- package/dist/__tests__/tools/query-tools.test.js.map +1 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.d.ts +2 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.js +553 -0
- package/dist/__tests__/tools/testgroup-launch-tools.test.js.map +1 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.d.ts +2 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.d.ts.map +1 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.js +240 -0
- package/dist/__tests__/utils/mcp-error-mapper.test.js.map +1 -0
- package/dist/__tests__/utils/mcp-response.test.d.ts +2 -0
- package/dist/__tests__/utils/mcp-response.test.d.ts.map +1 -0
- package/dist/__tests__/utils/mcp-response.test.js +72 -0
- package/dist/__tests__/utils/mcp-response.test.js.map +1 -0
- package/dist/agents/test-planner-context.d.ts +7 -0
- package/dist/agents/test-planner-context.d.ts.map +1 -0
- package/dist/agents/test-planner-context.js +283 -0
- package/dist/agents/test-planner-context.js.map +1 -0
- package/dist/agents/test-planner-prompt.d.ts +34 -0
- package/dist/agents/test-planner-prompt.d.ts.map +1 -0
- package/dist/agents/test-planner-prompt.js +82 -0
- package/dist/agents/test-planner-prompt.js.map +1 -0
- package/dist/api-client.d.ts +52 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +285 -0
- package/dist/api-client.js.map +1 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +7 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +175 -0
- package/dist/index.js.map +1 -0
- package/dist/services/project-context-service.d.ts +15 -0
- package/dist/services/project-context-service.d.ts.map +1 -0
- package/dist/services/project-context-service.js +36 -0
- package/dist/services/project-context-service.js.map +1 -0
- package/dist/tools/auth-tools.d.ts +16 -0
- package/dist/tools/auth-tools.d.ts.map +1 -0
- package/dist/tools/auth-tools.js +66 -0
- package/dist/tools/auth-tools.js.map +1 -0
- package/dist/tools/automation-tools.d.ts +28 -0
- package/dist/tools/automation-tools.d.ts.map +1 -0
- package/dist/tools/automation-tools.js +541 -0
- package/dist/tools/automation-tools.js.map +1 -0
- package/dist/tools/export-import-tools.d.ts +18 -0
- package/dist/tools/export-import-tools.d.ts.map +1 -0
- package/dist/tools/export-import-tools.js +61 -0
- package/dist/tools/export-import-tools.js.map +1 -0
- package/dist/tools/module-tools.d.ts +43 -0
- package/dist/tools/module-tools.d.ts.map +1 -0
- package/dist/tools/module-tools.js +289 -0
- package/dist/tools/module-tools.js.map +1 -0
- package/dist/tools/project-context-tools.d.ts +19 -0
- package/dist/tools/project-context-tools.d.ts.map +1 -0
- package/dist/tools/project-context-tools.js +133 -0
- package/dist/tools/project-context-tools.js.map +1 -0
- package/dist/tools/project-tools.d.ts +47 -0
- package/dist/tools/project-tools.d.ts.map +1 -0
- package/dist/tools/project-tools.js +362 -0
- package/dist/tools/project-tools.js.map +1 -0
- package/dist/tools/query-tools.d.ts +22 -0
- package/dist/tools/query-tools.d.ts.map +1 -0
- package/dist/tools/query-tools.js +127 -0
- package/dist/tools/query-tools.js.map +1 -0
- package/dist/tools/testcase-tools.d.ts +135 -0
- package/dist/tools/testcase-tools.d.ts.map +1 -0
- package/dist/tools/testcase-tools.js +845 -0
- package/dist/tools/testcase-tools.js.map +1 -0
- package/dist/tools/testgroup-launch-tools.d.ts +37 -0
- package/dist/tools/testgroup-launch-tools.d.ts.map +1 -0
- package/dist/tools/testgroup-launch-tools.js +727 -0
- package/dist/tools/testgroup-launch-tools.js.map +1 -0
- package/dist/utils/mcp-error-mapper.d.ts +27 -0
- package/dist/utils/mcp-error-mapper.d.ts.map +1 -0
- package/dist/utils/mcp-error-mapper.js +79 -0
- package/dist/utils/mcp-error-mapper.js.map +1 -0
- package/dist/utils/mcp-response.d.ts +26 -0
- package/dist/utils/mcp-response.d.ts.map +1 -0
- package/dist/utils/mcp-response.js +34 -0
- package/dist/utils/mcp-response.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { CookieJar } from "tough-cookie";
|
|
3
|
+
import { wrapper } from "axios-cookiejar-support";
|
|
4
|
+
import { API_URL, API_KEY } from "./constants.js";
|
|
5
|
+
export class ApiClient {
|
|
6
|
+
client;
|
|
7
|
+
loginClient; // Separate client for login to bypass interceptor
|
|
8
|
+
projectId;
|
|
9
|
+
cookieJar;
|
|
10
|
+
isAuthenticated = false;
|
|
11
|
+
userId; // Store user ID after login
|
|
12
|
+
/** When set, 401 responses trigger one retry via apiTokenLogin then re-request */
|
|
13
|
+
apiToken;
|
|
14
|
+
constructor(baseUrl, apiKey) {
|
|
15
|
+
this.apiToken = apiKey; // API token for api-token-login
|
|
16
|
+
this.cookieJar = new CookieJar();
|
|
17
|
+
// Use API root for all requests so paths like /project/getProjects resolve to /api/project/getProjects.
|
|
18
|
+
// If baseUrl is the auth path (e.g. .../api/auth), normalize to .../api.
|
|
19
|
+
const baseURL = baseUrl.replace(/\/auth\/?$/, "") || baseUrl;
|
|
20
|
+
// Create axios instance with cookie jar support (session cookies set by apiTokenLogin)
|
|
21
|
+
const baseAxiosConfig = {
|
|
22
|
+
baseURL,
|
|
23
|
+
timeout: 30000,
|
|
24
|
+
jar: this.cookieJar,
|
|
25
|
+
headers: {
|
|
26
|
+
"Content-Type": "application/json",
|
|
27
|
+
},
|
|
28
|
+
withCredentials: true, // Important for session-based auth
|
|
29
|
+
};
|
|
30
|
+
this.client = wrapper(axios.create(baseAxiosConfig));
|
|
31
|
+
// Create a separate client for login that doesn't have the error interceptor
|
|
32
|
+
// Login returns 403 for invalid credentials, which the interceptor would convert to "Permission denied"
|
|
33
|
+
this.loginClient = wrapper(axios.create(baseAxiosConfig));
|
|
34
|
+
// Helper function to get XSRF-TOKEN from cookie jar
|
|
35
|
+
const getXSRFToken = async (requestUrl) => {
|
|
36
|
+
try {
|
|
37
|
+
// Try multiple URL formats to find the cookie
|
|
38
|
+
const urlsToTry = [];
|
|
39
|
+
if (requestUrl) {
|
|
40
|
+
urlsToTry.push(requestUrl);
|
|
41
|
+
}
|
|
42
|
+
// Add base URL variations
|
|
43
|
+
urlsToTry.push(baseURL);
|
|
44
|
+
// Try protocol + host only
|
|
45
|
+
try {
|
|
46
|
+
const urlObj = new URL(baseURL);
|
|
47
|
+
urlsToTry.push(`${urlObj.protocol}//${urlObj.host}`);
|
|
48
|
+
urlsToTry.push(`${urlObj.protocol}//${urlObj.host}/`);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
// Ignore URL parsing errors
|
|
52
|
+
}
|
|
53
|
+
// Try each URL until we find the cookie
|
|
54
|
+
for (const url of urlsToTry) {
|
|
55
|
+
try {
|
|
56
|
+
const cookies = await this.cookieJar.getCookies(url);
|
|
57
|
+
const xsrfCookie = cookies.find((cookie) => cookie.key.toLowerCase() === "xsrf-token");
|
|
58
|
+
if (xsrfCookie) {
|
|
59
|
+
return xsrfCookie.value;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
// Continue to next URL
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// Request interceptor to add XSRF-TOKEN header and handle project ID
|
|
74
|
+
const requestInterceptor = async (config) => {
|
|
75
|
+
// Ensure headers object exists
|
|
76
|
+
if (!config.headers) {
|
|
77
|
+
config.headers = {};
|
|
78
|
+
}
|
|
79
|
+
// For POST/PUT/DELETE/PATCH requests, ensure CSRF token is available
|
|
80
|
+
const method = config.method?.toLowerCase();
|
|
81
|
+
if (method && !['get', 'head', 'options'].includes(method)) {
|
|
82
|
+
const requestUrl = config.url ? `${config.baseURL || baseURL}${config.url}` : baseURL;
|
|
83
|
+
let xsrfToken = await getXSRFToken(requestUrl);
|
|
84
|
+
if (!xsrfToken) {
|
|
85
|
+
try {
|
|
86
|
+
await this.client.get("/healthcheck");
|
|
87
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
88
|
+
xsrfToken = await getXSRFToken(requestUrl);
|
|
89
|
+
if (!xsrfToken) {
|
|
90
|
+
xsrfToken = await getXSRFToken(baseURL);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
// Ignore healthcheck errors
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (xsrfToken) {
|
|
98
|
+
config.headers["X-CSRF-Token"] = xsrfToken;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
console.warn(`[ApiClient] CSRF token not found for ${method.toUpperCase()} ${config.url}. Request may fail with CSRF_TOKEN_MISSING error.`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// For GET requests, try to get token but don't require it
|
|
106
|
+
const requestUrl = config.url ? `${config.baseURL || baseURL}${config.url}` : baseURL;
|
|
107
|
+
const xsrfToken = await getXSRFToken(requestUrl);
|
|
108
|
+
if (xsrfToken) {
|
|
109
|
+
config.headers["X-CSRF-Token"] = xsrfToken;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Check if x-project-id was explicitly set to null/undefined to remove it
|
|
113
|
+
if (config.headers["x-project-id"] === null || config.headers["x-project-id"] === undefined) {
|
|
114
|
+
delete config.headers["x-project-id"];
|
|
115
|
+
}
|
|
116
|
+
else if (this.projectId && !config.headers["x-project-id"]) {
|
|
117
|
+
// Only add project ID if it's not already set and projectId is configured
|
|
118
|
+
config.headers["x-project-id"] = this.projectId;
|
|
119
|
+
}
|
|
120
|
+
return config;
|
|
121
|
+
};
|
|
122
|
+
// Add request interceptor to both clients
|
|
123
|
+
this.client.interceptors.request.use(requestInterceptor);
|
|
124
|
+
this.loginClient.interceptors.request.use(requestInterceptor);
|
|
125
|
+
// Add response interceptor for error handling
|
|
126
|
+
this.client.interceptors.response.use((response) => response, (error) => {
|
|
127
|
+
if (error.response) {
|
|
128
|
+
const status = error.response.status;
|
|
129
|
+
const data = error.response.data;
|
|
130
|
+
let errorMessage;
|
|
131
|
+
if (status === 401) {
|
|
132
|
+
// One-time retry via api-token-login when API token is configured
|
|
133
|
+
const config = error.config;
|
|
134
|
+
if (this.apiToken && config && !config._401Retried) {
|
|
135
|
+
config._401Retried = true;
|
|
136
|
+
return this.apiTokenLogin(this.apiToken)
|
|
137
|
+
.then(() => this.client.request(config))
|
|
138
|
+
.catch(() => {
|
|
139
|
+
throw new Error("Authentication failed. Please check your API key (QA_PATH_API_KEY).");
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
throw new Error("Authentication failed. Please check your API key (QA_PATH_API_KEY).");
|
|
143
|
+
}
|
|
144
|
+
if (status === 403) {
|
|
145
|
+
errorMessage = `Permission denied: ${data?.message || "You don't have permission to perform this action"}`;
|
|
146
|
+
}
|
|
147
|
+
else if (status === 404) {
|
|
148
|
+
errorMessage = `Resource not found: ${data?.message || "The requested resource does not exist"}`;
|
|
149
|
+
}
|
|
150
|
+
else if (status >= 500) {
|
|
151
|
+
errorMessage = `Server error: ${data?.error || data?.message || "An internal server error occurred"}`;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
errorMessage = data?.error || data?.message || `Request failed with status ${status}`;
|
|
155
|
+
}
|
|
156
|
+
// Create error and attach original axios error structure
|
|
157
|
+
// This allows error mappers to extract status code and response data
|
|
158
|
+
const customError = new Error(errorMessage);
|
|
159
|
+
customError.response = error.response;
|
|
160
|
+
customError.status = status;
|
|
161
|
+
throw customError;
|
|
162
|
+
}
|
|
163
|
+
if (error.request) {
|
|
164
|
+
throw new Error(`Network error: Unable to connect to the API server. Please check your ${API_URL} and check.`);
|
|
165
|
+
}
|
|
166
|
+
throw error;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
setProjectId(projectId) {
|
|
170
|
+
this.projectId = projectId;
|
|
171
|
+
this.client.defaults.headers["x-project-id"] = projectId;
|
|
172
|
+
}
|
|
173
|
+
getProjectId() {
|
|
174
|
+
return this.projectId;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Log in using an API token (POST /api/auth/api-token-login).
|
|
178
|
+
* Session cookies are stored in the cookie jar; subsequent requests use them.
|
|
179
|
+
*/
|
|
180
|
+
async apiTokenLogin(token) {
|
|
181
|
+
const t = token?.trim();
|
|
182
|
+
if (!t) {
|
|
183
|
+
this.isAuthenticated = false;
|
|
184
|
+
throw new Error("API token is required for api-token-login.");
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const baseURL = this.loginClient.defaults.baseURL;
|
|
188
|
+
const origin = new URL(baseURL).origin;
|
|
189
|
+
await this.loginClient.get(`${origin}/api/healthcheck`);
|
|
190
|
+
const response = await this.loginClient.post("auth/api-token-login", undefined, {
|
|
191
|
+
headers: {
|
|
192
|
+
Authorization: `Bearer ${t}`,
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
this.isAuthenticated = true;
|
|
196
|
+
this.userId = response.data.data?.user?.id;
|
|
197
|
+
return response.data;
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
this.isAuthenticated = false;
|
|
201
|
+
if (error.response) {
|
|
202
|
+
const status = error.response.status;
|
|
203
|
+
const data = error.response.data;
|
|
204
|
+
if (status === 401) {
|
|
205
|
+
throw new Error(data?.message || `Invalid or expired token. Please check ${API_KEY}.`);
|
|
206
|
+
}
|
|
207
|
+
throw new Error(data?.message || data?.error || `api-token-login failed with status ${status}`);
|
|
208
|
+
}
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
getIsAuthenticated() {
|
|
213
|
+
return this.isAuthenticated;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get cookie header string for a given URL (and optionally the API base URL).
|
|
217
|
+
* Used to forward session cookies to the automation agent WebSocket.
|
|
218
|
+
*/
|
|
219
|
+
async getCookieStringForUrl(url) {
|
|
220
|
+
const urlsToTry = [url];
|
|
221
|
+
const baseUrl = this.client.defaults.baseURL;
|
|
222
|
+
if (baseUrl && !urlsToTry.includes(baseUrl)) {
|
|
223
|
+
urlsToTry.push(baseUrl);
|
|
224
|
+
try {
|
|
225
|
+
const u = new URL(baseUrl);
|
|
226
|
+
urlsToTry.push(`${u.protocol}//${u.host}`);
|
|
227
|
+
}
|
|
228
|
+
catch (_) { }
|
|
229
|
+
}
|
|
230
|
+
const seen = new Set();
|
|
231
|
+
const parts = [];
|
|
232
|
+
for (const u of urlsToTry) {
|
|
233
|
+
try {
|
|
234
|
+
const cookies = await this.cookieJar.getCookies(u);
|
|
235
|
+
if (Array.isArray(cookies)) {
|
|
236
|
+
for (const c of cookies) {
|
|
237
|
+
if (c && typeof c.key === "string" && !seen.has(c.key)) {
|
|
238
|
+
seen.add(c.key);
|
|
239
|
+
parts.push(`${c.key}=${c.value || ""}`);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch (_) {
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return parts.join("; ");
|
|
249
|
+
}
|
|
250
|
+
getUserId() {
|
|
251
|
+
return this.userId;
|
|
252
|
+
}
|
|
253
|
+
async get(url, config) {
|
|
254
|
+
const response = await this.client.get(url, config);
|
|
255
|
+
return response.data;
|
|
256
|
+
}
|
|
257
|
+
async post(url, data, config) {
|
|
258
|
+
const response = await this.client.post(url, data, config);
|
|
259
|
+
return response.data;
|
|
260
|
+
}
|
|
261
|
+
async put(url, data, config) {
|
|
262
|
+
const response = await this.client.put(url, data, config);
|
|
263
|
+
return response.data;
|
|
264
|
+
}
|
|
265
|
+
async patch(url, data, config) {
|
|
266
|
+
const response = await this.client.patch(url, data, config);
|
|
267
|
+
return response.data;
|
|
268
|
+
}
|
|
269
|
+
async delete(url, config) {
|
|
270
|
+
const response = await this.client.delete(url, config);
|
|
271
|
+
return response.data;
|
|
272
|
+
}
|
|
273
|
+
// Helper for file uploads
|
|
274
|
+
async postFormData(url, formData, config) {
|
|
275
|
+
const response = await this.client.post(url, formData, {
|
|
276
|
+
...config,
|
|
277
|
+
headers: {
|
|
278
|
+
...config?.headers,
|
|
279
|
+
"Content-Type": "multipart/form-data",
|
|
280
|
+
},
|
|
281
|
+
});
|
|
282
|
+
return response.data;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,OAAO,E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,IAAI,EAAE,MAAM,CAAC,CAAC;QAC9D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,GAAG,CAAU,GAAW,EAAE,IAAU,EAAE,MAAY;QACtD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,KAAK,CAAU,GAAW,EAAE,IAAU,EAAE,MAAY;QACxD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAI,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,MAAM,CAAU,GAAW,EAAE,MAAY;QAC7C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAI,GAAG,EAAE,MAAM,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED,0BAA0B;IAC1B,KAAK,CAAC,YAAY,CAChB,GAAW,EACX,QAAkB,EAClB,MAAY;QAEZ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAI,GAAG,EAAE,QAAQ,EAAE;YACxD,GAAG,MAAM;YACT,OAAO,EAAE;gBACP,GAAG,MAAM,EAAE,OAAO;gBAClB,cAAc,EAAE,qBAAqB;aACtC;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable names for QA Path MCP server.
|
|
3
|
+
* Only the required/primary vars are centralized; optional ones are inlined where used.
|
|
4
|
+
*/
|
|
5
|
+
export declare const API_URL: string;
|
|
6
|
+
export declare const API_KEY: string | undefined;
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,QAAkE,CAAC;AAEvF,eAAO,MAAM,OAAO,oBAA8B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment variable names for QA Path MCP server.
|
|
3
|
+
* Only the required/primary vars are centralized; optional ones are inlined where used.
|
|
4
|
+
*/
|
|
5
|
+
export const API_URL = process.env.QA_PATH_API_URL || "http://localhost:3000/api/auth";
|
|
6
|
+
export const API_KEY = process.env.QA_PATH_API_KEY;
|
|
7
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,gCAAgC,CAAC;AAEvF,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { ApiClient } from "./api-client.js";
|
|
6
|
+
import { getTestPlannerPromptDefinition, getTestPlannerMessages, X_TEST_PLANNER_NAME, } from "./agents/test-planner-prompt.js";
|
|
7
|
+
import { ModuleTools } from "./tools/module-tools.js";
|
|
8
|
+
import { TestCaseTools } from "./tools/testcase-tools.js";
|
|
9
|
+
import { ExportImportTools } from "./tools/export-import-tools.js";
|
|
10
|
+
import { ProjectTools } from "./tools/project-tools.js";
|
|
11
|
+
import { AuthTools } from "./tools/auth-tools.js";
|
|
12
|
+
import { AutomationTools } from "./tools/automation-tools.js";
|
|
13
|
+
import { TestGroupLaunchTools } from "./tools/testgroup-launch-tools.js";
|
|
14
|
+
import { QueryTools } from "./tools/query-tools.js";
|
|
15
|
+
import { ProjectContextTools } from "./tools/project-context-tools.js";
|
|
16
|
+
import { ProjectContextService } from "./services/project-context-service.js";
|
|
17
|
+
import { API_URL, API_KEY } from "./constants.js";
|
|
18
|
+
class QAPathServer {
|
|
19
|
+
server;
|
|
20
|
+
apiClient;
|
|
21
|
+
projectContext;
|
|
22
|
+
moduleTools;
|
|
23
|
+
testCaseTools;
|
|
24
|
+
exportImportTools;
|
|
25
|
+
projectTools;
|
|
26
|
+
authTools;
|
|
27
|
+
automationTools;
|
|
28
|
+
testGroupLaunchTools;
|
|
29
|
+
queryTools;
|
|
30
|
+
projectContextTools;
|
|
31
|
+
apiKey;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.server = new Server({
|
|
34
|
+
name: "qa-path",
|
|
35
|
+
version: "1.0.0",
|
|
36
|
+
}, {
|
|
37
|
+
capabilities: {
|
|
38
|
+
tools: {},
|
|
39
|
+
resources: {},
|
|
40
|
+
prompts: {},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const apiBaseUrl = API_URL;
|
|
44
|
+
this.apiKey = API_KEY;
|
|
45
|
+
if (!apiBaseUrl) {
|
|
46
|
+
throw new Error(`${API_URL} environment variable is required`);
|
|
47
|
+
}
|
|
48
|
+
// Initialize API client (project will be set via set_active_project or QA_PATH_PROJECT_ID)
|
|
49
|
+
this.apiClient = new ApiClient(apiBaseUrl, this.apiKey);
|
|
50
|
+
// Initialize project context service
|
|
51
|
+
this.projectContext = new ProjectContextService();
|
|
52
|
+
// Initialize tools (pass projectContext to tools that need it)
|
|
53
|
+
this.projectContextTools = new ProjectContextTools(this.apiClient, this.projectContext);
|
|
54
|
+
this.moduleTools = new ModuleTools(this.apiClient, this.projectContext);
|
|
55
|
+
this.testCaseTools = new TestCaseTools(this.apiClient, this.projectContext);
|
|
56
|
+
this.exportImportTools = new ExportImportTools(this.apiClient, this.projectContext);
|
|
57
|
+
this.projectTools = new ProjectTools(this.apiClient);
|
|
58
|
+
this.authTools = new AuthTools(this.apiClient);
|
|
59
|
+
this.automationTools = new AutomationTools(this.apiClient, this.projectContext);
|
|
60
|
+
this.testGroupLaunchTools = new TestGroupLaunchTools(this.apiClient, this.projectContext);
|
|
61
|
+
this.queryTools = new QueryTools(this.apiClient, this.projectContext);
|
|
62
|
+
this.setupHandlers();
|
|
63
|
+
}
|
|
64
|
+
setupHandlers() {
|
|
65
|
+
// List available tools
|
|
66
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
67
|
+
return {
|
|
68
|
+
tools: [
|
|
69
|
+
...this.authTools.getTools(),
|
|
70
|
+
...this.projectContextTools.getTools(),
|
|
71
|
+
...this.moduleTools.getTools(),
|
|
72
|
+
...this.testCaseTools.getTools(),
|
|
73
|
+
// ...this.exportImportTools.getTools(), // export tool commented out
|
|
74
|
+
...this.projectTools.getTools(),
|
|
75
|
+
...this.automationTools.getTools(),
|
|
76
|
+
...this.testGroupLaunchTools.getTools(),
|
|
77
|
+
...this.queryTools.getTools(),
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
// Handle tool calls
|
|
82
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
83
|
+
const { name, arguments: args } = request.params;
|
|
84
|
+
try {
|
|
85
|
+
// Route to appropriate tool handler
|
|
86
|
+
if (this.authTools.handles(name)) {
|
|
87
|
+
return await this.authTools.handle(name, args);
|
|
88
|
+
}
|
|
89
|
+
if (this.projectContextTools.handles(name)) {
|
|
90
|
+
return await this.projectContextTools.handle(name, args);
|
|
91
|
+
}
|
|
92
|
+
if (this.moduleTools.handles(name)) {
|
|
93
|
+
return await this.moduleTools.handle(name, args);
|
|
94
|
+
}
|
|
95
|
+
if (this.testCaseTools.handles(name)) {
|
|
96
|
+
return await this.testCaseTools.handle(name, args);
|
|
97
|
+
}
|
|
98
|
+
// if (this.exportImportTools.handles(name)) {
|
|
99
|
+
// return await this.exportImportTools.handle(name, args);
|
|
100
|
+
// }
|
|
101
|
+
if (this.projectTools.handles(name)) {
|
|
102
|
+
return await this.projectTools.handle(name, args);
|
|
103
|
+
}
|
|
104
|
+
if (this.automationTools.handles(name)) {
|
|
105
|
+
return await this.automationTools.handle(name, args);
|
|
106
|
+
}
|
|
107
|
+
if (this.testGroupLaunchTools.handles(name)) {
|
|
108
|
+
return await this.testGroupLaunchTools.handle(name, args);
|
|
109
|
+
}
|
|
110
|
+
if (this.queryTools.handles(name)) {
|
|
111
|
+
return await this.queryTools.handle(name, args);
|
|
112
|
+
}
|
|
113
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
// Format error message to be more actionable for AI
|
|
117
|
+
const errorMessage = error.message || String(error);
|
|
118
|
+
// If error contains ACTION_REQUIRED or WORKFLOW markers, preserve them
|
|
119
|
+
// These help the AI understand what steps to take
|
|
120
|
+
const formattedError = errorMessage.includes("ACTION_REQUIRED") || errorMessage.includes("WORKFLOW")
|
|
121
|
+
? errorMessage
|
|
122
|
+
: `Error: ${errorMessage}`;
|
|
123
|
+
return {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: "text",
|
|
127
|
+
text: formattedError,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
isError: true,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
// List resources (optional - for future use)
|
|
135
|
+
this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
136
|
+
return {
|
|
137
|
+
resources: [],
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
// List prompts (x-test-planner agent)
|
|
141
|
+
this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
142
|
+
return {
|
|
143
|
+
prompts: [getTestPlannerPromptDefinition()],
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
// Get prompt (x-test-planner agent)
|
|
147
|
+
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
148
|
+
const { name, arguments: args } = request.params;
|
|
149
|
+
if (name !== X_TEST_PLANNER_NAME) {
|
|
150
|
+
throw new Error(`Unknown prompt: ${name}`);
|
|
151
|
+
}
|
|
152
|
+
return getTestPlannerMessages(args);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async ensureAuth() {
|
|
156
|
+
if (!this.apiKey?.trim()) {
|
|
157
|
+
throw new Error(`${API_KEY} is required.`);
|
|
158
|
+
}
|
|
159
|
+
await this.apiClient.apiTokenLogin(this.apiKey);
|
|
160
|
+
console.error("QA-Path: API token login successful");
|
|
161
|
+
}
|
|
162
|
+
async run() {
|
|
163
|
+
await this.ensureAuth();
|
|
164
|
+
const transport = new StdioServerTransport();
|
|
165
|
+
await this.server.connect(transport);
|
|
166
|
+
console.error("QA-Path server running on stdio");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Start the server
|
|
170
|
+
const server = new QAPathServer();
|
|
171
|
+
server.run().catch((error) => {
|
|
172
|
+
console.error("Fatal error in QA-Path server:", error);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,E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,IAAI,KAAK,CAAC,mBAAmB,IAAI,EAAE,CAAC,CAAC;YAC7C,CAAC;YACD,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,UAAU;QACtB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,eAAe,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACnD,CAAC;CACF;AAED,mBAAmB;AACnB,MAAM,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;AAClC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;IACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for managing active project context
|
|
3
|
+
* Maintains the active project ID that persists for the lifetime of the MCP server process
|
|
4
|
+
*/
|
|
5
|
+
export declare class ProjectContextService {
|
|
6
|
+
private activeProjectId?;
|
|
7
|
+
setActiveProjectId(projectId: string): void;
|
|
8
|
+
getActiveProjectId(): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve project ID from args or active project
|
|
11
|
+
* Throws error if neither is available with actionable guidance for the AI
|
|
12
|
+
*/
|
|
13
|
+
resolveProjectId(args: any, toolName: string): string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=project-context-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-context-service.d.ts","sourceRoot":"","sources":["../../src/services/project-context-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,eAAe,CAAC,CAAS;IAEjC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI3C,kBAAkB,IAAI,MAAM,GAAG,SAAS;IAIxC;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAuBtD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for managing active project context
|
|
3
|
+
* Maintains the active project ID that persists for the lifetime of the MCP server process
|
|
4
|
+
*/
|
|
5
|
+
export class ProjectContextService {
|
|
6
|
+
activeProjectId;
|
|
7
|
+
setActiveProjectId(projectId) {
|
|
8
|
+
this.activeProjectId = projectId;
|
|
9
|
+
}
|
|
10
|
+
getActiveProjectId() {
|
|
11
|
+
return this.activeProjectId;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve project ID from args or active project
|
|
15
|
+
* Throws error if neither is available with actionable guidance for the AI
|
|
16
|
+
*/
|
|
17
|
+
resolveProjectId(args, toolName) {
|
|
18
|
+
const argProjectId = args?.projectId;
|
|
19
|
+
const activeProjectId = this.activeProjectId;
|
|
20
|
+
if (argProjectId) {
|
|
21
|
+
return argProjectId; // Explicit projectId takes precedence
|
|
22
|
+
}
|
|
23
|
+
if (activeProjectId) {
|
|
24
|
+
return activeProjectId; // Use active project
|
|
25
|
+
}
|
|
26
|
+
// Enhanced error message that guides the AI to ask the user
|
|
27
|
+
throw new Error(`PROJECT_ID_REQUIRED: A project ID is required to use ${toolName}. ` +
|
|
28
|
+
`ACTION_REQUIRED: You need to either:\n` +
|
|
29
|
+
`1. Ask the user which project they want to use, then call 'list_projects' to show available projects, ` +
|
|
30
|
+
` and once the user selects a project (by name), extract the projectId (UUID) from the list_projects response ` +
|
|
31
|
+
` and call 'set_active_project' with that projectId, OR\n` +
|
|
32
|
+
`2. If the user provides a projectId (UUID) directly, use it as the 'projectId' parameter in this tool call.\n` +
|
|
33
|
+
`WORKFLOW: The recommended flow is: list_projects → ask user to select (by name) → extract projectId from response → set_active_project → retry original operation.`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=project-context-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-context-service.js","sourceRoot":"","sources":["../../src/services/project-context-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IACxB,eAAe,CAAU;IAEjC,kBAAkB,CAAC,SAAiB;QAClC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,IAAS,EAAE,QAAgB;QAC1C,MAAM,YAAY,GAAG,IAAI,EAAE,SAAS,CAAC;QACrC,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAE7C,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,YAAY,CAAC,CAAC,sCAAsC;QAC7D,CAAC;QAED,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC,CAAC,qBAAqB;QAC/C,CAAC;QAED,4DAA4D;QAC5D,MAAM,IAAI,KAAK,CACb,wDAAwD,QAAQ,IAAI;YACpE,wCAAwC;YACxC,wGAAwG;YACxG,iHAAiH;YACjH,4DAA4D;YAC5D,+GAA+G;YAC/G,oKAAoK,CACrK,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { ApiClient } from "../api-client.js";
|
|
3
|
+
export declare class AuthTools {
|
|
4
|
+
private apiClient;
|
|
5
|
+
constructor(apiClient: ApiClient);
|
|
6
|
+
getTools(): Tool[];
|
|
7
|
+
handles(name: string): boolean;
|
|
8
|
+
handle(name: string, args: any): Promise<{
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
}>;
|
|
14
|
+
private checkAuthStatus;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=auth-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-tools.d.ts","sourceRoot":"","sources":["../../src/tools/auth-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAI7C,qBAAa,SAAS;IACR,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAExC,QAAQ,IAAI,IAAI,EAAE;IAclB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIxB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;;;;;;YAOtB,eAAe;CAoD9B"}
|