@smartbear/mcp 0.34.0 → 0.36.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 (61) hide show
  1. package/README.md +1 -1
  2. package/dist/bearq/tool/tasks/wait-for-task.js +3 -3
  3. package/dist/bugsnag/client.js +1 -1
  4. package/dist/bugsnag/tool/error/get-error.js +1 -1
  5. package/dist/bugsnag/tool/error/list-project-errors.js +1 -1
  6. package/dist/bugsnag/tool/error/update-error.js +1 -1
  7. package/dist/bugsnag/tool/event/get-event-details-from-dashboard-url.js +1 -1
  8. package/dist/bugsnag/tool/event/get-event.js +1 -1
  9. package/dist/bugsnag/tool/event/list-error-events.js +1 -1
  10. package/dist/bugsnag/tool/performance/get-network-endpoint-groupings.js +1 -1
  11. package/dist/bugsnag/tool/performance/get-span-group.js +1 -1
  12. package/dist/bugsnag/tool/performance/get-trace.js +1 -1
  13. package/dist/bugsnag/tool/performance/list-span-groups.js +1 -1
  14. package/dist/bugsnag/tool/performance/list-spans.js +1 -1
  15. package/dist/bugsnag/tool/performance/list-trace-fields.js +1 -1
  16. package/dist/bugsnag/tool/performance/set-network-endpoint-groupings.js +1 -1
  17. package/dist/bugsnag/tool/project/get-current-project.js +1 -1
  18. package/dist/bugsnag/tool/project/list-project-event-filters.js +1 -1
  19. package/dist/bugsnag/tool/project/list-projects.js +1 -1
  20. package/dist/bugsnag/tool/release/get-build.js +1 -1
  21. package/dist/bugsnag/tool/release/get-release.js +1 -1
  22. package/dist/bugsnag/tool/release/list-releases.js +1 -1
  23. package/dist/collaborator/client.js +10 -10
  24. package/dist/common/server.js +11 -32
  25. package/dist/common/transport-http.js +5 -5
  26. package/dist/common/transport-stdio.js +1 -1
  27. package/dist/common/zod-utils.js +2 -1
  28. package/dist/package.json.js +1 -1
  29. package/dist/pactflow/client/base.js +8 -4
  30. package/dist/pactflow/client/tools.js +2 -2
  31. package/dist/pactflow/client.js +4 -4
  32. package/dist/qmetry/client/ai-agent.js +106 -0
  33. package/dist/qmetry/client/api/client-api.js +8 -2
  34. package/dist/qmetry/client/handlers.js +5 -1
  35. package/dist/qmetry/client/tools/ai-agent-tools.js +120 -0
  36. package/dist/qmetry/client/tools/index.js +4 -1
  37. package/dist/qmetry/client.js +19 -2
  38. package/dist/qmetry/config/constants.js +5 -2
  39. package/dist/qmetry/config/rest-endpoints.js +5 -0
  40. package/dist/qmetry/types/ai-agent.js +38 -0
  41. package/dist/qmetry/types/common.js +9 -0
  42. package/dist/reflect/tool/recording/connect-to-session.js +2 -2
  43. package/dist/swagger/client/functional-testing-api.js +16 -0
  44. package/dist/swagger/client/functional-testing-tools.js +12 -2
  45. package/dist/swagger/client/functional-testing-types.js +42 -0
  46. package/dist/swagger/client/portal-types.js +1 -1
  47. package/dist/swagger/client.js +4 -1
  48. package/dist/zephyr/common/rest-api-schemas.js +3748 -3698
  49. package/dist/zephyr/tool/test-case/create-issue-link.js +4 -2
  50. package/dist/zephyr/tool/test-case/create-test-script.js +4 -2
  51. package/dist/zephyr/tool/test-case/create-test-steps.js +5 -1
  52. package/dist/zephyr/tool/test-case/get-test-steps.js +4 -2
  53. package/dist/zephyr/tool/test-case/update-test-case.js +3 -1
  54. package/dist/zephyr/tool/test-cycle/create-issue-link.js +4 -2
  55. package/dist/zephyr/tool/test-cycle/create-web-link.js +4 -2
  56. package/dist/zephyr/tool/test-cycle/update-test-cycle.js +5 -1
  57. package/dist/zephyr/tool/test-execution/create-issue-link.js +4 -2
  58. package/dist/zephyr/tool/test-execution/get-test-steps.js +4 -2
  59. package/dist/zephyr/tool/test-execution/update-test-execution.js +4 -2
  60. package/dist/zephyr/tool/test-execution/update-test-steps.js +4 -2
  61. package/package.json +7 -2
package/README.md CHANGED
@@ -57,7 +57,7 @@ See the [Remote MCP Servers guide](https://developer.smartbear.com/smartbear-mcp
57
57
 
58
58
  ## Prerequisites
59
59
 
60
- - Node.js 20+ and npm
60
+ - Node.js 22+ and npm
61
61
  - Access to SmartBear products (BugSnag, Reflect, Swagger, QMetry, QTM4J or Zephyr)
62
62
  - Valid API tokens for the products you want to integrate
63
63
 
@@ -21,7 +21,7 @@ class WaitForTask extends Tool {
21
21
  summary: "Blocks until a BearQ task reaches a terminal state (completed / failed / cancelled) or the stream times out, then returns the full ordered sequence of SSE events from the public API (metadata, activityLogEntries, and a terminal done or timeout event) verbatim. Blocks for the lifetime of the task — for a quick check use bearq_get_task_status instead.",
22
22
  inputSchema
23
23
  };
24
- handle = async (args, extra) => {
24
+ handle = async (args, ctx) => {
25
25
  const { taskId } = inputSchema.parse(args);
26
26
  const url = `${this.client.getBaseUrl()}/tasks/${taskId}/stream`;
27
27
  const res = await fetch(url, {
@@ -33,11 +33,11 @@ class WaitForTask extends Tool {
33
33
  );
34
34
  if (!res.body)
35
35
  throw new ToolError(`GET /tasks/${taskId}/stream: no response body`);
36
- const progressToken = extra?._meta?.progressToken;
36
+ const progressToken = ctx?.mcpReq?._meta?.progressToken;
37
37
  let progress = 0;
38
38
  const notify = async (event, data) => {
39
39
  if (progressToken === void 0) return;
40
- await extra.sendNotification({
40
+ await ctx.mcpReq?.notify({
41
41
  method: "notifications/progress",
42
42
  params: {
43
43
  progressToken,
@@ -337,7 +337,7 @@ class BugsnagClient {
337
337
  path: "{id}",
338
338
  description: "Retrieve a specific event by its ID."
339
339
  },
340
- async (uri, variables, _extra) => {
340
+ async (uri, variables, _ctx) => {
341
341
  return {
342
342
  contents: [
343
343
  {
@@ -42,7 +42,7 @@ class GetError extends Tool {
42
42
  "The URL provided in the response points should be shown to the user in all cases as it allows them to view the error in the dashboard and perform further analysis"
43
43
  ]
44
44
  };
45
- handle = async (args, _extra) => {
45
+ handle = async (args, _ctx) => {
46
46
  const params = inputSchema.parse(args);
47
47
  const project = await this.client.getInputProject(params.projectId);
48
48
  const errorDetails = (await this.client.errorsApi.viewErrorOnProject(project.id, params.errorId)).body;
@@ -69,7 +69,7 @@ class ListProjectErrors extends Tool {
69
69
  "Do not modify the next URL as this can cause incorrect results. The only other parameter that can be used with 'next' is 'per_page' to control the page size."
70
70
  ]
71
71
  };
72
- handle = async (args, _extra) => {
72
+ handle = async (args, _ctx) => {
73
73
  const params = inputSchema.parse(args);
74
74
  const project = await this.client.getInputProject(params.projectId);
75
75
  const filters = {
@@ -143,7 +143,7 @@ class UpdateError extends Tool {
143
143
  super(client);
144
144
  this.getInput = getInput;
145
145
  }
146
- handle = async (args, _extra) => {
146
+ handle = async (args, _ctx) => {
147
147
  const params = inputSchema.parse(args);
148
148
  const project = await this.client.getInputProject(params.projectId);
149
149
  if (params.operation === "snooze" && !params.reopenRules) {
@@ -31,7 +31,7 @@ class GetEventDetailsFromDashboardUrl extends Tool {
31
31
  "This is useful when users share BugSnag dashboard URLs and you need to extract the event data"
32
32
  ]
33
33
  };
34
- handle = async (args, _extra) => {
34
+ handle = async (args, _ctx) => {
35
35
  const params = inputSchema.parse(args);
36
36
  const url = new URL(params.link);
37
37
  const eventId = url.searchParams.get("event_id");
@@ -25,7 +25,7 @@ class GetEvent extends Tool {
25
25
  }
26
26
  ]
27
27
  };
28
- handle = async (args, _extra) => {
28
+ handle = async (args, _ctx) => {
29
29
  const params = inputSchema.parse(args);
30
30
  const project = await this.client.getInputProject(params.projectId);
31
31
  const response = await this.client.getEvent(params.eventId, project.id);
@@ -32,7 +32,7 @@ class ListErrorEvents extends Tool {
32
32
  }
33
33
  ]
34
34
  };
35
- handle = async (args, _extra) => {
35
+ handle = async (args, _ctx) => {
36
36
  const params = inputSchema.parse(args);
37
37
  const project = await this.client.getInputProject(params.projectId);
38
38
  const response = await this.client.errorsApi.listErrorEvents(
@@ -31,7 +31,7 @@ class GetNetworkEndpointGroupings extends Tool {
31
31
  readOnly: true,
32
32
  idempotent: true
33
33
  };
34
- handle = async (args, _extra) => {
34
+ handle = async (args, _ctx) => {
35
35
  const params = inputSchema.parse(args);
36
36
  const project = await this.client.getInputProject(params.projectId);
37
37
  const result = await this.client.projectApi.getProjectNetworkGroupingRuleset(project.id);
@@ -41,7 +41,7 @@ class GetSpanGroup extends Tool {
41
41
  "Statistics include p50, p75, p90, p95, p99 percentiles"
42
42
  ]
43
43
  };
44
- handle = async (args, _extra) => {
44
+ handle = async (args, _ctx) => {
45
45
  const params = inputSchema.parse(args);
46
46
  const project = await this.client.getInputProject(params.projectId);
47
47
  const spanGroupResults = await this.client.projectApi.getProjectSpanGroup(
@@ -50,7 +50,7 @@ class GetTrace extends Tool {
50
50
  "targetSpanId can be used to focus on a specific span in the trace"
51
51
  ]
52
52
  };
53
- handle = async (args, _extra) => {
53
+ handle = async (args, _ctx) => {
54
54
  const params = inputSchema.parse(args);
55
55
  const project = await this.client.getInputProject(params.projectId);
56
56
  if (!params.traceId || !params.from || !params.to) {
@@ -80,7 +80,7 @@ class ListSpanGroups extends Tool {
80
80
  "Use nextUrl for pagination"
81
81
  ]
82
82
  };
83
- handle = async (args, _extra) => {
83
+ handle = async (args, _ctx) => {
84
84
  const params = inputSchema.parse(args);
85
85
  const project = await this.client.getInputProject(params.projectId);
86
86
  const result = await this.client.projectApi.listProjectSpanGroups(
@@ -67,7 +67,7 @@ class ListSpans extends Tool {
67
67
  "Each span includes trace ID for further investigation"
68
68
  ]
69
69
  };
70
- handle = async (args, _extra) => {
70
+ handle = async (args, _ctx) => {
71
71
  const params = inputSchema.parse(args);
72
72
  const project = await this.client.getInputProject(params.projectId);
73
73
  const result = await this.client.projectApi.listSpansBySpanGroupId(
@@ -28,7 +28,7 @@ class ListTraceFields extends Tool {
28
28
  "Use these fields for filtering other performance queries"
29
29
  ]
30
30
  };
31
- handle = async (args, _extra) => {
31
+ handle = async (args, _ctx) => {
32
32
  const params = inputSchema.parse(args);
33
33
  const project = await this.client.getInputProject(params.projectId);
34
34
  const traceFields = await this.client.getProjectTraceFields(project);
@@ -65,7 +65,7 @@ class SetNetworkEndpointGroupings extends Tool {
65
65
  readOnly: false,
66
66
  idempotent: true
67
67
  };
68
- handle = async (args, _extra) => {
68
+ handle = async (args, _ctx) => {
69
69
  const params = inputSchema.parse(args);
70
70
  const project = await this.client.getInputProject(params.projectId);
71
71
  const result = await this.client.projectApi.updateProjectNetworkGroupingRuleset(
@@ -15,7 +15,7 @@ class GetCurrentProject extends Tool {
15
15
  "You might find a BugSnag API key in the user's code where they configure the BugSnag SDK that can be matched to a project 'apiKey' field from the project list"
16
16
  ]
17
17
  };
18
- handle = async (_args, _extra) => {
18
+ handle = async (_args, _ctx) => {
19
19
  const project = await this.client.getCurrentProject();
20
20
  if (!project) {
21
21
  throw new ToolError(
@@ -28,7 +28,7 @@ class ListProjectEventFilters extends Tool {
28
28
  "Look for display_id field in the response - these are the field names to use in filters"
29
29
  ]
30
30
  };
31
- handle = async (args, _extra) => {
31
+ handle = async (args, _ctx) => {
32
32
  const params = inputSchema.parse(args);
33
33
  const eventFilters = await this.client.getProjectEventFields(
34
34
  await this.client.getInputProject(params.projectId)
@@ -18,7 +18,7 @@ class ListProjects extends Tool {
18
18
  "Project IDs from this list can be used with other tools when no project API key is configured"
19
19
  ]
20
20
  };
21
- handle = async (args, _extra) => {
21
+ handle = async (args, _ctx) => {
22
22
  const params = inputSchema.parse(args);
23
23
  let projects = await this.client.getProjects();
24
24
  if (!projects || projects.length === 0) {
@@ -31,7 +31,7 @@ class GetBuild extends Tool {
31
31
  idempotent: true,
32
32
  outputDescription: "JSON object containing build details along with stability metrics such as user and session stability, and whether it meets project targets"
33
33
  };
34
- handle = async (args, _extra) => {
34
+ handle = async (args, _ctx) => {
35
35
  const params = inputSchema.parse(args);
36
36
  const project = await this.client.getInputProject(params.projectId);
37
37
  const response = await this.client.projectApi.getProjectReleaseById(
@@ -31,7 +31,7 @@ class GetRelease extends Tool {
31
31
  idempotent: true,
32
32
  outputDescription: "JSON object containing release details along with stability metrics such as user and session stability, and whether it meets project targets"
33
33
  };
34
- handle = async (args, _extra) => {
34
+ handle = async (args, _ctx) => {
35
35
  const params = inputSchema.parse(args);
36
36
  const project = await this.client.getInputProject(params.projectId);
37
37
  const releaseResponse = await this.client.projectApi.getReleaseGroup(
@@ -51,7 +51,7 @@ class ListReleases extends Tool {
51
51
  idempotent: true,
52
52
  outputDescription: "JSON array of release summary objects with metadata, with a URL to the next page if more results are available"
53
53
  };
54
- handle = async (args, _extra) => {
54
+ handle = async (args, _ctx) => {
55
55
  const params = inputSchema.parse(args);
56
56
  const project = await this.client.getInputProject(params.projectId);
57
57
  const response = await this.client.projectApi.listProjectReleaseGroups(
@@ -74,7 +74,7 @@ class CollaboratorClient {
74
74
  reviewId: z.string().describe("The Collaborator review ID to find.")
75
75
  })
76
76
  },
77
- async (args, _extra) => {
77
+ async (args, _ctx) => {
78
78
  const { reviewId } = args;
79
79
  const commands = [
80
80
  {
@@ -106,7 +106,7 @@ class CollaboratorClient {
106
106
  )
107
107
  })
108
108
  },
109
- async (args, _extra) => {
109
+ async (args, _ctx) => {
110
110
  const commandArgs = {};
111
111
  if (args.creator !== void 0) commandArgs.creator = args.creator;
112
112
  if (args.title !== void 0) commandArgs.title = args.title;
@@ -136,7 +136,7 @@ class CollaboratorClient {
136
136
  reason: z.string().describe("Reason for rejecting the review.")
137
137
  })
138
138
  },
139
- async (args, _extra) => {
139
+ async (args, _ctx) => {
140
140
  const { reviewId, reason } = args;
141
141
  const commands = [
142
142
  {
@@ -168,7 +168,7 @@ class CollaboratorClient {
168
168
  args: z.record(z.string(), z.any())
169
169
  })
170
170
  },
171
- async (params, _extra) => {
171
+ async (params, _ctx) => {
172
172
  const { action, args } = params;
173
173
  const commands = [{ command: `ReviewService.${action}`, args }];
174
174
  const result = await this.call(commands);
@@ -192,7 +192,7 @@ class CollaboratorClient {
192
192
  toDate: z.string().optional().describe('Maximal creation date in format "yyyy-MM-dd"')
193
193
  })
194
194
  },
195
- async (args, _extra) => {
195
+ async (args, _ctx) => {
196
196
  const reviewArgs = {};
197
197
  if (args.login !== void 0) reviewArgs.login = args.login;
198
198
  if (args.role !== void 0) reviewArgs.role = args.role;
@@ -230,7 +230,7 @@ class CollaboratorClient {
230
230
  )
231
231
  })
232
232
  },
233
- async (args, _extra) => {
233
+ async (args, _ctx) => {
234
234
  const { token, title, config, reviewTemplateId } = args;
235
235
  const commandArgs = { token, title, config };
236
236
  if (reviewTemplateId) commandArgs.reviewTemplateId = reviewTemplateId;
@@ -262,7 +262,7 @@ class CollaboratorClient {
262
262
  )
263
263
  })
264
264
  },
265
- async (args, _extra) => {
265
+ async (args, _ctx) => {
266
266
  const { id, title, config, reviewTemplateId } = args;
267
267
  const commandArgs = { id };
268
268
  if (title) commandArgs.title = title;
@@ -289,7 +289,7 @@ class CollaboratorClient {
289
289
  id: z.union([z.string(), z.number()]).describe("ID of the remote system Configuration to delete.")
290
290
  })
291
291
  },
292
- async (args, _extra) => {
292
+ async (args, _ctx) => {
293
293
  const commandArgs = {};
294
294
  if (args.id !== void 0)
295
295
  commandArgs.id = typeof args.id === "string" && !Number.isNaN(Number(args.id)) ? Number(args.id) : args.id;
@@ -316,7 +316,7 @@ class CollaboratorClient {
316
316
  )
317
317
  })
318
318
  },
319
- async (args, _extra) => {
319
+ async (args, _ctx) => {
320
320
  const commandArgs = {};
321
321
  if (args.id !== void 0)
322
322
  commandArgs.id = typeof args.id === "string" && !Number.isNaN(Number(args.id)) ? Number(args.id) : args.id;
@@ -343,7 +343,7 @@ class CollaboratorClient {
343
343
  )
344
344
  })
345
345
  },
346
- async (args, _extra) => {
346
+ async (args, _ctx) => {
347
347
  const commandArgs = {};
348
348
  if (args.id !== void 0)
349
349
  commandArgs.id = typeof args.id === "string" && !Number.isNaN(Number(args.id)) ? Number(args.id) : args.id;
@@ -1,5 +1,5 @@
1
- import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { ZodObject, ZodIntersection } from "zod";
1
+ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/server";
2
+ import { z, ZodObject } from "zod";
3
3
  import Bugsnag from "./bugsnag.js";
4
4
  import { CacheService } from "./cache.js";
5
5
  import { toClientIdentity } from "./client-identity.js";
@@ -111,22 +111,18 @@ class SmartBearMcpServer extends McpServer {
111
111
  {
112
112
  title: toolTitle,
113
113
  description: this.getDescription(params),
114
- inputSchema: params.inputSchema ? this.schemaToRawShape(params.inputSchema) : {},
115
- // Pass ZodObject-based schemas through as-is (rather than via schemaToRawShape)
116
- // so that z.looseObject()'s additionalProperties:true is preserved in the JSON
117
- // schema sent to clients — extracting `.shape` would rebuild a strict object and
118
- // cause "additional properties" validation errors on real API responses.
119
- outputSchema: params.outputSchema instanceof ZodObject ? params.outputSchema : this.schemaToRawShape(params.outputSchema),
114
+ inputSchema: params.inputSchema ?? z.object({}),
115
+ outputSchema: params.outputSchema,
120
116
  annotations: this.getAnnotations(toolTitle, params)
121
117
  },
122
- async (args, extra) => {
118
+ async (args, ctx) => {
123
119
  try {
124
120
  if (!client.isConfigured()) {
125
121
  throw new ToolError(
126
122
  `The tool is not configured - configuration options for ${client.name} are missing or invalid.`
127
123
  );
128
124
  }
129
- const result = await cb(args, extra);
125
+ const result = await cb(args, ctx);
130
126
  if (result) {
131
127
  this.validateCallbackResult(result, params);
132
128
  this.addStructuredContentAsText(result);
@@ -188,9 +184,9 @@ ${result.instructions}`
188
184
  title: this.getCapabilityTitle(client, params.title),
189
185
  description: params.description
190
186
  },
191
- async (url2, variables, extra) => {
187
+ async (url2, variables, ctx) => {
192
188
  try {
193
- return await cb(url2, variables, extra);
189
+ return await cb(url2, variables, ctx);
194
190
  } catch (e) {
195
191
  Bugsnag.notify(e, (event) => {
196
192
  event.addMetadata("app", {
@@ -213,11 +209,11 @@ ${result.instructions}`
213
209
  {
214
210
  title: this.getCapabilityTitle(client, params.title),
215
211
  description: params.description,
216
- argsSchema: this.schemaToRawShape(params.argsSchema) || {}
212
+ argsSchema: params.argsSchema
217
213
  },
218
- async (args, extra) => {
214
+ async (args, ctx) => {
219
215
  try {
220
- return await cb(args, extra);
216
+ return await cb(args, ctx);
221
217
  } catch (e) {
222
218
  Bugsnag.notify(e, (event) => {
223
219
  event.addMetadata("app", {
@@ -263,23 +259,6 @@ ${result.instructions}`
263
259
  };
264
260
  return annotations;
265
261
  }
266
- schemaToRawShape(schema) {
267
- if (schema) {
268
- if (schema instanceof ZodObject) {
269
- return schema.shape;
270
- }
271
- if (schema instanceof ZodIntersection) {
272
- const leftShape = this.schemaToRawShape(
273
- schema.def.left
274
- );
275
- const rightShape = this.schemaToRawShape(
276
- schema.def.right
277
- );
278
- return { ...leftShape, ...rightShape };
279
- }
280
- }
281
- return void 0;
282
- }
283
262
  getCapabilityTitle(client, title) {
284
263
  return `${client.name}: ${title}`;
285
264
  }
@@ -1,9 +1,9 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { createServer } from "node:http";
3
3
  import querystring from "node:querystring";
4
- import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
5
- import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
6
- import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
4
+ import { NodeStreamableHTTPServerTransport } from "@modelcontextprotocol/node";
5
+ import { isInitializeRequest } from "@modelcontextprotocol/server";
6
+ import { SSEServerTransport } from "@modelcontextprotocol/server-legacy/sse";
7
7
  import { clientRegistry } from "./client-registry.js";
8
8
  import { handleInitializeMessage } from "./initialize.js";
9
9
  import { withRequestContext, setRequestMcpClient } from "./request-context.js";
@@ -184,7 +184,7 @@ async function parseRequestBody(req) {
184
184
  }
185
185
  function getExistingTransport(sessionId, transports, res) {
186
186
  const existing = transports.get(sessionId);
187
- if (existing && existing.transport instanceof StreamableHTTPServerTransport) {
187
+ if (existing && existing.transport instanceof NodeStreamableHTTPServerTransport) {
188
188
  return existing.transport;
189
189
  }
190
190
  res.writeHead(400, { "Content-Type": "application/json" });
@@ -205,7 +205,7 @@ async function createNewTransport(req, res, transports) {
205
205
  if (!server) {
206
206
  return null;
207
207
  }
208
- const transport = new StreamableHTTPServerTransport({
208
+ const transport = new NodeStreamableHTTPServerTransport({
209
209
  sessionIdGenerator: () => randomUUID(),
210
210
  onsessioninitialized: (newSessionId) => {
211
211
  console.log(`[MCP] New session initialized: ${newSessionId}`);
@@ -1,5 +1,5 @@
1
1
  import { enableCompileCache } from "node:module";
2
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2
+ import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
3
3
  import { clientRegistry } from "./client-registry.js";
4
4
  import { USER_AGENT } from "./info.js";
5
5
  import { handleInitializeMessage } from "./initialize.js";
@@ -1,4 +1,4 @@
1
- import { ZodOptional, ZodDefault, ZodNullable, ZodRecord, ZodString, ZodNumber, ZodBoolean, ZodArray, ZodObject, ZodEnum, ZodLiteral, ZodUnion, ZodAny } from "zod";
1
+ import { ZodOptional, ZodDefault, ZodNullable, ZodRecord, ZodString, ZodStringFormat, ZodNumber, ZodBoolean, ZodArray, ZodObject, ZodEnum, ZodLiteral, ZodUnion, ZodAny } from "zod";
2
2
  function unwrapZodType(zodType) {
3
3
  if (zodType instanceof ZodOptional) {
4
4
  return zodType.unwrap();
@@ -55,6 +55,7 @@ function getReadableTypeName(zodType) {
55
55
  return `record<${getReadableTypeName(record.def.keyType)}, ${getReadableTypeName(record.def.valueType)}>`;
56
56
  }
57
57
  if (zodType instanceof ZodString) return "string";
58
+ if (zodType instanceof ZodStringFormat) return "string";
58
59
  if (zodType instanceof ZodNumber) return "number";
59
60
  if (zodType instanceof ZodBoolean) return "boolean";
60
61
  if (zodType instanceof ZodArray) return "array";
@@ -1,4 +1,4 @@
1
- const version = "0.34.0";
1
+ const version = "0.36.0";
2
2
  const config = { "mcpServerName": "SmartBear MCP Server" };
3
3
  const packageJson = {
4
4
  version,
@@ -107,9 +107,11 @@ const PublishProviderContractSchema = z.object({
107
107
  providerName: z.string().describe("Name of the provider application"),
108
108
  pacticipantVersionNumber: z.string().min(1).describe("Version number of the provider"),
109
109
  contract: z.object({
110
- content: z.string().describe("Base64-encoded OpenAPI specification content"),
111
- contentType: z.enum(["application/json", "application/yaml", "application/yml"]).describe("Content type of the OpenAPI spec"),
112
- specification: z.literal("oas").describe("Specification type (must be 'oas')"),
110
+ content: z.string().describe("Base64-encoded OpenAPI or AsyncAPI specification content"),
111
+ contentType: z.enum(["application/json", "application/yaml", "application/yml"]).describe("Content type of the spec"),
112
+ specification: z.enum(["oas", "asyncapi"]).describe(
113
+ "Specification type: 'oas' for OpenAPI or 'asyncapi' for AsyncAPI"
114
+ ),
113
115
  selfVerificationResults: z.object({
114
116
  success: z.boolean().describe("Whether self-verification passed"),
115
117
  content: z.string().optional().describe("Verification results content (e.g. test output)"),
@@ -122,7 +124,9 @@ const PublishProviderContractSchema = z.object({
122
124
  }).describe(
123
125
  "Results of self-verifying the provider against its own contract"
124
126
  )
125
- }).describe("Provider contract (OpenAPI spec) and verification details"),
127
+ }).describe(
128
+ "Provider contract (OpenAPI or AsyncAPI spec) and verification details"
129
+ ),
126
130
  tags: z.array(z.string()).optional().describe("Version tags"),
127
131
  branch: z.string().optional().describe("Branch name of the provider"),
128
132
  buildUrl: z.string().optional().describe("URL of the CI build")
@@ -308,8 +308,8 @@ const TOOLS = [
308
308
  {
309
309
  title: "Publish Provider Contract",
310
310
  toolset: "Contracts",
311
- summary: "Publish a provider OpenAPI contract and self-verification results to PactFlow (Bi-Directional Contract Testing).",
312
- purpose: "Upload an OpenAPI specification as a provider contract along with the results of running a tool (e.g. Dredd, Schemathesis) that verifies the provider implementation against the spec. This enables PactFlow to perform automated cross-contract verification without requiring the provider to run the consumer Pact tests.",
311
+ summary: "Publish a provider OpenAPI or AsyncAPI contract and self-verification results to PactFlow (Bi-Directional Contract Testing).",
312
+ purpose: "Upload an OpenAPI or AsyncAPI specification as a provider contract along with the results of running a tool (e.g. Dredd, Schemathesis) that verifies the provider implementation against the spec. This enables PactFlow to perform automated cross-contract verification without requiring the provider to run the consumer Pact tests.",
313
313
  inputSchema: PublishProviderContractSchema,
314
314
  handler: "publishProviderContract",
315
315
  readOnly: false,
@@ -672,10 +672,10 @@ class PactflowClient {
672
672
  });
673
673
  }
674
674
  /**
675
- * Publishes a provider OpenAPI contract and its self-verification results to PactFlow
676
- * for use in Bi-Directional Contract Testing.
675
+ * Publishes a provider OpenAPI or AsyncAPI contract and its self-verification results
676
+ * to PactFlow for use in Bi-Directional Contract Testing.
677
677
  *
678
- * @param params - `providerName`, version number, base64-encoded OpenAPI spec,
678
+ * @param params - `providerName`, version number, base64-encoded OpenAPI/AsyncAPI spec,
679
679
  * content type, and self-verification results.
680
680
  * @returns Publication result.
681
681
  * @throws ToolError if the request fails.
@@ -2085,7 +2085,7 @@ class PactflowClient {
2085
2085
  continue;
2086
2086
  }
2087
2087
  const { handler, clients: _, formatResponse, ...toolParams } = tool;
2088
- register(toolParams, async (args, _extra) => {
2088
+ register(toolParams, async (args, _ctx) => {
2089
2089
  const handler_fn = this[handler];
2090
2090
  if (typeof handler_fn !== "function") {
2091
2091
  throw new Error(`Handler '${handler}' not found on PactClient`);
@@ -0,0 +1,106 @@
1
+ import { QMETRY_PATHS } from "../config/rest-endpoints.js";
2
+ import { qmetryRequest } from "./api/client-api.js";
3
+ import { resolveDefaults } from "./utils.js";
4
+ async function getGateConfiguration(token, baseUrl, project, payload) {
5
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
6
+ baseUrl,
7
+ project
8
+ );
9
+ if (!payload.projectId || Number.isNaN(Number(payload.projectId))) {
10
+ throw new Error(
11
+ "[getGateConfiguration] Missing or invalid required parameter: 'projectId'. Must be a valid numeric project ID."
12
+ );
13
+ }
14
+ if (!payload.agentIdentifier) {
15
+ throw new Error(
16
+ "[getGateConfiguration] Missing or invalid required parameter: 'agentIdentifier'."
17
+ );
18
+ }
19
+ const path = `${QMETRY_PATHS.AI_AGENT.GET_GATE_CONFIG.replace(
20
+ ":projectId",
21
+ String(payload.projectId)
22
+ )}?agentIdentifier=${encodeURIComponent(payload.agentIdentifier)}`;
23
+ return qmetryRequest({
24
+ method: "GET",
25
+ path,
26
+ token,
27
+ baseUrl: resolvedBaseUrl,
28
+ project: resolvedProject
29
+ });
30
+ }
31
+ async function executeGateReport(token, baseUrl, project, payload) {
32
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
33
+ baseUrl,
34
+ project
35
+ );
36
+ if (!payload.reportName) {
37
+ throw new Error(
38
+ "[executeGateReport] Missing or invalid required parameter: 'reportName'."
39
+ );
40
+ }
41
+ if (!payload.gateIdentifier) {
42
+ throw new Error(
43
+ "[executeGateReport] Missing or invalid required parameter: 'gateIdentifier'."
44
+ );
45
+ }
46
+ if (!payload.projectId || Number.isNaN(Number(payload.projectId))) {
47
+ throw new Error(
48
+ "[executeGateReport] Missing or invalid required parameter: 'projectId'. Must be a valid numeric project ID."
49
+ );
50
+ }
51
+ const body = {
52
+ reportName: payload.reportName,
53
+ gateIdentifier: payload.gateIdentifier,
54
+ projectId: payload.projectId
55
+ };
56
+ if (payload.releaseId !== void 0) {
57
+ body.releaseId = payload.releaseId;
58
+ }
59
+ if (payload.cycleIds !== void 0) {
60
+ body.cycleIds = payload.cycleIds;
61
+ }
62
+ if (payload.page !== void 0) {
63
+ body.page = payload.page;
64
+ }
65
+ body.limit = payload.limit ?? 100;
66
+ return qmetryRequest({
67
+ method: "POST",
68
+ path: QMETRY_PATHS.AI_AGENT.EXECUTE_REPORT,
69
+ token,
70
+ baseUrl: resolvedBaseUrl,
71
+ project: resolvedProject,
72
+ body
73
+ });
74
+ }
75
+ async function exportHtmlReport(token, baseUrl, project, payload) {
76
+ const { resolvedBaseUrl, resolvedProject } = resolveDefaults(
77
+ baseUrl,
78
+ project
79
+ );
80
+ if (!payload.htmlContent) {
81
+ throw new Error(
82
+ "[exportHtmlReport] Missing required parameter: 'htmlContent'."
83
+ );
84
+ }
85
+ if (!payload.fileName) {
86
+ throw new Error(
87
+ "[exportHtmlReport] Missing required parameter: 'fileName'."
88
+ );
89
+ }
90
+ return qmetryRequest({
91
+ method: "POST",
92
+ path: QMETRY_PATHS.AI_AGENT.EXPORT_HTML_REPORT,
93
+ token,
94
+ baseUrl: resolvedBaseUrl,
95
+ project: resolvedProject,
96
+ body: {
97
+ htmlContent: payload.htmlContent,
98
+ fileName: payload.fileName
99
+ }
100
+ });
101
+ }
102
+ export {
103
+ executeGateReport,
104
+ exportHtmlReport,
105
+ getGateConfiguration
106
+ };