@smartbear/mcp 0.6.0 → 0.7.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.
Files changed (35) hide show
  1. package/README.md +20 -3
  2. package/dist/api-hub/client/api.js +253 -0
  3. package/dist/api-hub/client/configuration.js +27 -0
  4. package/dist/api-hub/client/index.js +5 -0
  5. package/dist/api-hub/client/portal-types.js +131 -0
  6. package/dist/api-hub/client/registry-types.js +55 -0
  7. package/dist/api-hub/client/tools.js +86 -0
  8. package/dist/api-hub/client.js +64 -404
  9. package/dist/bugsnag/client/api/CurrentUser.js +16 -10
  10. package/dist/bugsnag/client/api/Error.js +35 -35
  11. package/dist/bugsnag/client/api/Project.js +21 -9
  12. package/dist/bugsnag/client/api/base.js +7 -4
  13. package/dist/bugsnag/client/api/filters.js +9 -9
  14. package/dist/bugsnag/client.js +165 -140
  15. package/dist/common/info.js +1 -1
  16. package/dist/common/server.js +35 -27
  17. package/dist/index.js +11 -4
  18. package/dist/pactflow/client/ai.js +20 -20
  19. package/dist/pactflow/client/base.js +48 -13
  20. package/dist/pactflow/client/prompts.js +10 -12
  21. package/dist/pactflow/client/tools.js +10 -10
  22. package/dist/pactflow/client/utils.js +1 -1
  23. package/dist/pactflow/client.js +16 -9
  24. package/dist/qmetry/client/api/client-api.js +39 -0
  25. package/dist/qmetry/client/handlers.js +11 -0
  26. package/dist/qmetry/client/project.js +27 -0
  27. package/dist/qmetry/client/testcase.js +104 -0
  28. package/dist/qmetry/client/tools.js +222 -0
  29. package/dist/qmetry/client.js +95 -0
  30. package/dist/qmetry/config/constants.js +12 -0
  31. package/dist/qmetry/config/rest-endpoints.js +11 -0
  32. package/dist/qmetry/types/common.js +174 -0
  33. package/dist/qmetry/types/testcase.js +19 -0
  34. package/dist/reflect/client.js +14 -14
  35. package/package.json +6 -5
@@ -1,24 +1,24 @@
1
- import { BaseAPI } from './base.js';
2
- import { toQueryString } from './filters.js';
1
+ import { BaseAPI } from "./base.js";
2
+ import { toQueryString } from "./filters.js";
3
3
  export const ErrorOperations = [
4
- 'override_severity',
5
- 'assign',
6
- 'create_issue',
7
- 'link_issue',
8
- 'unlink_issue',
9
- 'open',
10
- 'snooze',
11
- 'fix',
12
- 'ignore',
13
- 'delete',
14
- 'discard',
15
- 'undiscard'
4
+ "override_severity",
5
+ "assign",
6
+ "create_issue",
7
+ "link_issue",
8
+ "unlink_issue",
9
+ "open",
10
+ "snooze",
11
+ "fix",
12
+ "ignore",
13
+ "delete",
14
+ "discard",
15
+ "undiscard",
16
16
  ];
17
17
  export const ReopenConditions = [
18
- 'occurs_after',
19
- 'n_occurrences_in_m_hours',
20
- 'n_additional_occurrences',
21
- 'n_additional_users'
18
+ "occurs_after",
19
+ "n_occurrences_in_m_hours",
20
+ "n_additional_occurrences",
21
+ "n_additional_users",
22
22
  ];
23
23
  // --- API Class ---
24
24
  export class ErrorAPI extends BaseAPI {
@@ -40,7 +40,7 @@ export class ErrorAPI extends BaseAPI {
40
40
  ? `/projects/${projectId}/errors/${errorId}?${params}`
41
41
  : `/projects/${projectId}/errors/${errorId}`;
42
42
  return (await this.request({
43
- method: 'GET',
43
+ method: "GET",
44
44
  url,
45
45
  }));
46
46
  }
@@ -58,7 +58,7 @@ export class ErrorAPI extends BaseAPI {
58
58
  ? `/errors/${errorId}/latest_event?${params}`
59
59
  : `/errors/${errorId}/latest_event`;
60
60
  return (await this.request({
61
- method: 'GET',
61
+ method: "GET",
62
62
  url,
63
63
  }));
64
64
  }
@@ -66,10 +66,10 @@ export class ErrorAPI extends BaseAPI {
66
66
  * List the Events on a Project
67
67
  * GET /projects/{project_id}/events
68
68
  */
69
- async listEventsOnProject(projectId, queryString = '') {
69
+ async listEventsOnProject(projectId, queryString = "") {
70
70
  const url = `/projects/${projectId}/events${queryString}`;
71
71
  return await this.request({
72
- method: 'GET',
72
+ method: "GET",
73
73
  url,
74
74
  });
75
75
  }
@@ -87,7 +87,7 @@ export class ErrorAPI extends BaseAPI {
87
87
  ? `/projects/${projectId}/events/${eventId}?${params}`
88
88
  : `/projects/${projectId}/events/${eventId}`;
89
89
  return (await this.request({
90
- method: 'GET',
90
+ method: "GET",
91
91
  url,
92
92
  }));
93
93
  }
@@ -101,7 +101,7 @@ export class ErrorAPI extends BaseAPI {
101
101
  if (options.next !== undefined) {
102
102
  const nextUrl = new URL(options.next);
103
103
  if (options.per_page !== undefined) {
104
- nextUrl.searchParams.set('per_page', options.per_page.toString());
104
+ nextUrl.searchParams.set("per_page", options.per_page.toString());
105
105
  }
106
106
  url = nextUrl.toString();
107
107
  }
@@ -116,23 +116,23 @@ export class ErrorAPI extends BaseAPI {
116
116
  }
117
117
  // Add pagination and sorting parameters
118
118
  if (options.base !== undefined) {
119
- params.append('base', options.base);
119
+ params.append("base", options.base);
120
120
  }
121
121
  if (options.sort !== undefined) {
122
- params.append('sort', options.sort);
122
+ params.append("sort", options.sort);
123
123
  }
124
124
  if (options.direction !== undefined) {
125
- params.append('direction', options.direction);
125
+ params.append("direction", options.direction);
126
126
  }
127
127
  if (options.per_page !== undefined) {
128
- params.append('per_page', options.per_page.toString());
128
+ params.append("per_page", options.per_page.toString());
129
129
  }
130
130
  if (params.size > 0) {
131
131
  url = `/projects/${projectId}/errors?${params}`;
132
132
  }
133
133
  }
134
134
  return (await this.request({
135
- method: 'GET',
135
+ method: "GET",
136
136
  url,
137
137
  }));
138
138
  }
@@ -150,7 +150,7 @@ export class ErrorAPI extends BaseAPI {
150
150
  ? `/projects/${projectId}/errors/${errorId}?${params}`
151
151
  : `/projects/${projectId}/errors/${errorId}`;
152
152
  return (await this.request({
153
- method: 'PATCH',
153
+ method: "PATCH",
154
154
  url,
155
155
  body: data,
156
156
  }));
@@ -168,21 +168,21 @@ export class ErrorAPI extends BaseAPI {
168
168
  });
169
169
  }
170
170
  if (options.summary_size !== undefined) {
171
- params.append('summary_size', options.summary_size.toString());
171
+ params.append("summary_size", options.summary_size.toString());
172
172
  }
173
173
  if (options.pivots && options.pivots.length > 0) {
174
- options.pivots.forEach(pivot => {
175
- params.append('pivots[]', pivot);
174
+ options.pivots.forEach((pivot) => {
175
+ params.append("pivots[]", pivot);
176
176
  });
177
177
  }
178
178
  if (options.per_page !== undefined) {
179
- params.append('per_page', options.per_page.toString());
179
+ params.append("per_page", options.per_page.toString());
180
180
  }
181
181
  const url = params.toString()
182
182
  ? `/projects/${projectId}/errors/${errorId}/pivots?${params}`
183
183
  : `/projects/${projectId}/errors/${errorId}/pivots`;
184
184
  return await this.request({
185
- method: 'GET',
185
+ method: "GET",
186
186
  url,
187
187
  });
188
188
  }
@@ -1,8 +1,18 @@
1
- import { BaseAPI, pickFieldsFromArray, pickFields } from "./base.js";
1
+ import { BaseAPI, pickFields, pickFieldsFromArray, } from "./base.js";
2
2
  // --- API Class ---
3
3
  export class ProjectAPI extends BaseAPI {
4
- static filterFields = ["errors_url", "events_url", "url", "html_url"];
5
- static eventFieldFields = ["custom", "display_id", "filter_options", "pivot_options"];
4
+ static filterFields = [
5
+ "errors_url",
6
+ "events_url",
7
+ "url",
8
+ "html_url",
9
+ ];
10
+ static eventFieldFields = [
11
+ "custom",
12
+ "display_id",
13
+ "filter_options",
14
+ "pivot_options",
15
+ ];
6
16
  static buildFields = [
7
17
  "id",
8
18
  "release_time",
@@ -46,13 +56,13 @@ export class ProjectAPI extends BaseAPI {
46
56
  async listProjectEventFields(projectId) {
47
57
  const url = `/projects/${projectId}/event_fields`;
48
58
  const data = await this.request({
49
- method: 'GET',
59
+ method: "GET",
50
60
  url,
51
61
  });
52
62
  // Only return allowed fields
53
63
  return {
54
64
  ...data,
55
- body: pickFieldsFromArray(data.body || [], ProjectAPI.eventFieldFields)
65
+ body: pickFieldsFromArray(data.body || [], ProjectAPI.eventFieldFields),
56
66
  };
57
67
  }
58
68
  /**
@@ -65,7 +75,7 @@ export class ProjectAPI extends BaseAPI {
65
75
  async createProject(organizationId, data) {
66
76
  const url = `/organizations/${organizationId}/projects`;
67
77
  return await this.request({
68
- method: 'POST',
78
+ method: "POST",
69
79
  url,
70
80
  body: data,
71
81
  });
@@ -92,7 +102,8 @@ export class ProjectAPI extends BaseAPI {
92
102
  * @returns A promise that resolves to an array of `ListReleasesResponse` objects.
93
103
  */
94
104
  async listBuilds(projectId, opts) {
95
- const url = opts.next_url ?? `/projects/${projectId}/releases${opts.release_stage ? `?release_stage=${opts.release_stage}` : ""}`;
105
+ const url = opts.next_url ??
106
+ `/projects/${projectId}/releases${opts.release_stage ? `?release_stage=${opts.release_stage}` : ""}`;
96
107
  const response = await this.request({
97
108
  method: "GET",
98
109
  url,
@@ -124,10 +135,11 @@ export class ProjectAPI extends BaseAPI {
124
135
  * @returns A promise that resolves to an array of `ReleaseSummaryResponse` objects.
125
136
  */
126
137
  async listReleases(projectId, opts) {
127
- const url = opts.next_url ?? `/projects/${projectId}/release_groups?release_stage_name=${opts.release_stage_name}&visible_only=${opts.visible_only}&top_only=true`;
138
+ const url = opts.next_url ??
139
+ `/projects/${projectId}/release_groups?release_stage_name=${opts.release_stage_name}&visible_only=${opts.visible_only}&top_only=true`;
128
140
  const response = await this.request({
129
141
  method: "GET",
130
- url
142
+ url,
131
143
  });
132
144
  return {
133
145
  ...response,
@@ -10,7 +10,7 @@ export function pickFields(obj, keys) {
10
10
  }
11
11
  // Utility to pick only allowed fields from an array of objects
12
12
  export function pickFieldsFromArray(arr, keys) {
13
- return arr.map(obj => pickFields(obj, keys));
13
+ return arr.map((obj) => pickFields(obj, keys));
14
14
  }
15
15
  // Utility to extract next URL path from Link header
16
16
  export function getNextUrlPathFromHeader(headers, basePath) {
@@ -28,7 +28,7 @@ export function getNextUrlPathFromHeader(headers, basePath) {
28
28
  // The MCP tools exposed use only the path for pagination
29
29
  // For making requests, we need to ensure the URL is absolute
30
30
  export function ensureFullUrl(url, basePath) {
31
- return url.startsWith('http') ? url : `${basePath}${url}`;
31
+ return url.startsWith("http") ? url : `${basePath}${url}`;
32
32
  }
33
33
  export class BaseAPI {
34
34
  configuration;
@@ -42,7 +42,7 @@ export class BaseAPI {
42
42
  ...this.configuration.headers,
43
43
  ...options.headers,
44
44
  };
45
- headers['Authorization'] = `token ${this.configuration.authToken}`;
45
+ headers.Authorization = `token ${this.configuration.authToken}`;
46
46
  const fetchOptions = {
47
47
  method: options.method,
48
48
  headers,
@@ -52,6 +52,9 @@ export class BaseAPI {
52
52
  let nextUrl = options.url;
53
53
  let apiResponse;
54
54
  do {
55
+ if (!this.configuration.basePath) {
56
+ throw new Error("Base path is not configured for API requests");
57
+ }
55
58
  nextUrl = ensureFullUrl(nextUrl, this.configuration.basePath);
56
59
  const response = await fetch(nextUrl, fetchOptions);
57
60
  if (!response.ok) {
@@ -60,7 +63,7 @@ export class BaseAPI {
60
63
  }
61
64
  apiResponse = {
62
65
  status: response.status,
63
- headers: response.headers
66
+ headers: response.headers,
64
67
  };
65
68
  const data = await response.json();
66
69
  if (paginate) {
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { z } from "zod";
8
8
  export const FilterValueSchema = z.object({
9
- type: z.enum(['eq', 'ne', 'empty']),
9
+ type: z.enum(["eq", "ne", "empty"]),
10
10
  value: z.union([z.string(), z.boolean(), z.number()]),
11
11
  });
12
12
  export const FilterObjectSchema = z.record(z.array(FilterValueSchema));
@@ -18,7 +18,7 @@ export const FilterObjectSchema = z.record(z.array(FilterValueSchema));
18
18
  */
19
19
  export function equals(value) {
20
20
  return {
21
- type: 'eq',
21
+ type: "eq",
22
22
  value,
23
23
  };
24
24
  }
@@ -30,7 +30,7 @@ export function equals(value) {
30
30
  */
31
31
  export function notEquals(value) {
32
32
  return {
33
- type: 'ne',
33
+ type: "ne",
34
34
  value,
35
35
  };
36
36
  }
@@ -42,7 +42,7 @@ export function notEquals(value) {
42
42
  */
43
43
  export function empty(isEmpty) {
44
44
  return {
45
- type: 'empty',
45
+ type: "empty",
46
46
  value: isEmpty.toString(),
47
47
  };
48
48
  }
@@ -55,7 +55,7 @@ export function empty(isEmpty) {
55
55
  */
56
56
  export function relativeTime(value, unit) {
57
57
  return {
58
- type: 'eq',
58
+ type: "eq",
59
59
  value: `${value}${unit}`,
60
60
  };
61
61
  }
@@ -67,7 +67,7 @@ export function relativeTime(value, unit) {
67
67
  */
68
68
  export function isoTime(date) {
69
69
  return {
70
- type: 'eq',
70
+ type: "eq",
71
71
  value: date.toISOString(),
72
72
  };
73
73
  }
@@ -128,8 +128,8 @@ export function addFilter(filters, field, filterValue) {
128
128
  * @returns The updated FilterObject for chaining
129
129
  */
130
130
  export function addTimeRange(filters, since, before) {
131
- addFilter(filters, 'event.since', isoTime(since));
132
- addFilter(filters, 'event.before', isoTime(before));
131
+ addFilter(filters, "event.since", isoTime(since));
132
+ addFilter(filters, "event.before", isoTime(before));
133
133
  return filters;
134
134
  }
135
135
  /**
@@ -141,7 +141,7 @@ export function addTimeRange(filters, since, before) {
141
141
  * @returns The updated FilterObject for chaining
142
142
  */
143
143
  export function addRelativeTimeRange(filters, amount, unit) {
144
- addFilter(filters, 'event.since', relativeTime(amount, unit));
144
+ addFilter(filters, "event.since", relativeTime(amount, unit));
145
145
  return filters;
146
146
  }
147
147
  /**