@smartbear/mcp 0.42.0 → 0.43.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 (47) hide show
  1. package/dist/bearq/api.js +16 -0
  2. package/dist/bearq/client.js +9 -1
  3. package/dist/bearq/tool/tasks/stop-task.js +6 -3
  4. package/dist/bearq/tool/workflows/get-workflow-run.js +31 -0
  5. package/dist/bearq/tool/workflows/list-workflows.js +28 -0
  6. package/dist/bearq/tool/workflows/run-workflow.js +57 -0
  7. package/dist/bearq/tool/workflows/stop-workflow-run.js +33 -0
  8. package/dist/common/transport-http.js +8 -1
  9. package/dist/package.json.js +1 -1
  10. package/dist/pactflow/client/admin-api.js +3 -8
  11. package/dist/pactflow/client/ai.js +34 -0
  12. package/dist/pactflow/client/contract-api.js +2 -0
  13. package/dist/pactflow/client/http-client.js +7 -2
  14. package/dist/pactflow/client/pacticipant-api.js +37 -0
  15. package/dist/pactflow/client/schemas/admin.js +799 -0
  16. package/dist/pactflow/client/schemas/common.js +201 -0
  17. package/dist/pactflow/client/schemas/contract.js +444 -0
  18. package/dist/pactflow/client/schemas/environment.js +94 -0
  19. package/dist/pactflow/client/schemas/output.js +55 -0
  20. package/dist/pactflow/client/schemas/pacticipant.js +290 -0
  21. package/dist/pactflow/client/schemas/webhook.js +164 -0
  22. package/dist/pactflow/client/tools.js +32 -1
  23. package/dist/pactflow/client.js +21 -3
  24. package/dist/qmetry/client/ai-agent.js +3 -0
  25. package/dist/qmetry/client/api/error-handler.js +7 -2
  26. package/dist/qmetry/client/auto-resolve.js +5 -0
  27. package/dist/qmetry/client/handlers.js +2 -1
  28. package/dist/qmetry/client/project.js +19 -1
  29. package/dist/qmetry/client/testsuite.js +207 -2
  30. package/dist/qmetry/client/tools/ai-agent-tools.js +13 -0
  31. package/dist/qmetry/client/tools/issue-tools.js +7 -3
  32. package/dist/qmetry/client/tools/project-tools.js +34 -1
  33. package/dist/qmetry/client/tools/testcase-tools.js +43 -296
  34. package/dist/qmetry/client/tools/testsuite-tools.js +49 -19
  35. package/dist/qmetry/client/udf.js +14 -2
  36. package/dist/qmetry/client.js +2 -1
  37. package/dist/qmetry/config/constants.js +1 -0
  38. package/dist/qmetry/config/rest-endpoints.js +2 -1
  39. package/dist/qmetry/types/ai-agent.js +3 -0
  40. package/dist/qmetry/types/common.js +40 -2
  41. package/dist/qmetry/types/udf.js +1 -20
  42. package/dist/swagger/client/portal-types.js +11 -5
  43. package/dist/swagger/client/registry-types.js +5 -4
  44. package/dist/swagger/client/tools.js +1 -1
  45. package/package.json +2 -2
  46. package/plugin/README.md +42 -0
  47. package/dist/pactflow/client/base.js +0 -488
@@ -0,0 +1,16 @@
1
+ async function toProblemDetail(res) {
2
+ try {
3
+ const body = await res.json();
4
+ return typeof body.detail === "string" && body.detail ? body.detail : null;
5
+ } catch {
6
+ return null;
7
+ }
8
+ }
9
+ async function problemSuffix(res) {
10
+ const detail = await toProblemDetail(res);
11
+ return detail ? ` — ${detail}` : "";
12
+ }
13
+ export {
14
+ problemSuffix,
15
+ toProblemDetail
16
+ };
@@ -14,6 +14,10 @@ import { RunTestCases } from "./tool/tasks/run-test-cases.js";
14
14
  import { RunTestsInFunctionalAreas } from "./tool/tasks/run-tests-in-functional-areas.js";
15
15
  import { StopTask } from "./tool/tasks/stop-task.js";
16
16
  import { WaitForTask } from "./tool/tasks/wait-for-task.js";
17
+ import { GetWorkflowRun } from "./tool/workflows/get-workflow-run.js";
18
+ import { ListWorkflows } from "./tool/workflows/list-workflows.js";
19
+ import { RunWorkflow } from "./tool/workflows/run-workflow.js";
20
+ import { StopWorkflowRun } from "./tool/workflows/stop-workflow-run.js";
17
21
  const ConfigurationSchema = z.object({
18
22
  api_token: z.string().describe("BearQ workspace API token (Bearer)."),
19
23
  api_base_url: z.string().optional().describe(
@@ -67,7 +71,11 @@ class BearQClient {
67
71
  new GetTaskStatus(this),
68
72
  new StopTask(this),
69
73
  new WaitForTask(this),
70
- new ListEnvironments(this)
74
+ new ListEnvironments(this),
75
+ new ListWorkflows(this),
76
+ new RunWorkflow(this),
77
+ new GetWorkflowRun(this),
78
+ new StopWorkflowRun(this)
71
79
  ];
72
80
  for (const tool of tools) {
73
81
  register(tool.specification, tool.handle);
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { Tool, ToolError } from "../../../common/tools.js";
3
+ import { problemSuffix } from "../../api.js";
3
4
  const inputSchema = z.object({
4
5
  taskId: z.number().int().positive().describe("BearQ task ID to cancel.")
5
6
  });
@@ -7,7 +8,7 @@ class StopTask extends Tool {
7
8
  specification = {
8
9
  title: "Stop Task",
9
10
  toolset: "Tasks",
10
- summary: "Cancels a running task.",
11
+ summary: "Cancels a pending or running task, returning { taskId, stopped: true }. The public API accepts a stop of an already-finished task as a success no-op, so this does not guarantee the task was running — check the task's status separately if that matters.",
11
12
  inputSchema
12
13
  };
13
14
  handle = async (args) => {
@@ -18,10 +19,12 @@ class StopTask extends Tool {
18
19
  });
19
20
  if (!res.ok)
20
21
  throw new ToolError(
21
- `DELETE /tasks/${taskId} failed: ${res.status} ${res.statusText}`
22
+ `DELETE /tasks/${taskId} failed: ${res.status} ${res.statusText}` + await problemSuffix(res)
22
23
  );
23
24
  return {
24
- content: [{ type: "text", text: JSON.stringify(await res.json()) }]
25
+ content: [
26
+ { type: "text", text: JSON.stringify({ taskId, stopped: true }) }
27
+ ]
25
28
  };
26
29
  };
27
30
  }
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ const inputSchema = z.object({
4
+ runId: z.number().int().positive().describe("BearQ workflow run ID.")
5
+ });
6
+ class GetWorkflowRun extends Tool {
7
+ specification = {
8
+ title: "Get Workflow Run",
9
+ toolset: "Workflows",
10
+ summary: "Retrieves a workflow run's current status, per-step progress, and stats (tasks, tests, discovery, ACUs). Returns immediately with whatever's available — does not block on the run completing.",
11
+ inputSchema,
12
+ readOnly: true
13
+ };
14
+ handle = async (args) => {
15
+ const { runId } = inputSchema.parse(args);
16
+ const res = await fetch(
17
+ `${this.client.getBaseUrl()}/workflow-runs/${runId}`,
18
+ { method: "GET", headers: this.client.getHeaders() }
19
+ );
20
+ if (!res.ok)
21
+ throw new ToolError(
22
+ `GET /workflow-runs/${runId} failed: ${res.status} ${res.statusText}`
23
+ );
24
+ return {
25
+ content: [{ type: "text", text: JSON.stringify(await res.json()) }]
26
+ };
27
+ };
28
+ }
29
+ export {
30
+ GetWorkflowRun
31
+ };
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ const inputSchema = z.object({});
4
+ class ListWorkflows extends Tool {
5
+ specification = {
6
+ title: "List Workflows",
7
+ toolset: "Workflows",
8
+ summary: "Lists the workflows in the workspace — each with its id, name, description, steps, and last run. Workspaces with more than 100 workflows are truncated; the response's totalCount says how many exist.",
9
+ inputSchema,
10
+ readOnly: true
11
+ };
12
+ handle = async (_args) => {
13
+ const res = await fetch(`${this.client.getBaseUrl()}/workflows?size=100`, {
14
+ method: "GET",
15
+ headers: this.client.getHeaders()
16
+ });
17
+ if (!res.ok)
18
+ throw new ToolError(
19
+ `GET /workflows failed: ${res.status} ${res.statusText}`
20
+ );
21
+ return {
22
+ content: [{ type: "text", text: JSON.stringify(await res.json()) }]
23
+ };
24
+ };
25
+ }
26
+ export {
27
+ ListWorkflows
28
+ };
@@ -0,0 +1,57 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ const inputSchema = z.object({
4
+ workflow: z.string().min(1).describe(
5
+ "Workflow to run: its name (case-insensitive) or its numeric workflow ID."
6
+ )
7
+ });
8
+ async function resolveWorkflowId(client, workflow) {
9
+ if (/^\d+$/.test(workflow)) return Number(workflow);
10
+ const names = [];
11
+ for (let page = 1; ; page++) {
12
+ const res = await fetch(
13
+ `${client.getBaseUrl()}/workflows?page=${page}&size=100`,
14
+ { method: "GET", headers: client.getHeaders() }
15
+ );
16
+ if (!res.ok)
17
+ throw new ToolError(
18
+ `GET /workflows failed: ${res.status} ${res.statusText}`
19
+ );
20
+ const body = await res.json();
21
+ const match = body.workflows.find(
22
+ (candidate) => candidate.name.toLowerCase() === workflow.toLowerCase().trim()
23
+ );
24
+ if (match) return match.id;
25
+ names.push(...body.workflows.map((candidate) => candidate.name));
26
+ if (body.workflows.length === 0 || names.length >= body.totalCount) break;
27
+ }
28
+ throw new ToolError(
29
+ `No BearQ workflow named "${workflow}". Available workflows: ${names.join(", ") || "(none)"}`
30
+ );
31
+ }
32
+ class RunWorkflow extends Tool {
33
+ specification = {
34
+ title: "Run Workflow",
35
+ toolset: "Workflows",
36
+ summary: "Starts a run of a BearQ workflow now and returns the run (id, status, timestamps). If a run of that workflow is already in flight, no new run is started and the in-flight run is returned with started: false. Poll the run's progress with bearq_get_workflow_run.",
37
+ inputSchema
38
+ };
39
+ handle = async (args) => {
40
+ const { workflow } = inputSchema.parse(args);
41
+ const workflowId = await resolveWorkflowId(this.client, workflow);
42
+ const res = await fetch(
43
+ `${this.client.getBaseUrl()}/workflows/${workflowId}/runs`,
44
+ { method: "POST", headers: this.client.getHeaders() }
45
+ );
46
+ if (!res.ok)
47
+ throw new ToolError(
48
+ `POST /workflows/${workflowId}/runs failed: ${res.status} ${res.statusText}`
49
+ );
50
+ return {
51
+ content: [{ type: "text", text: JSON.stringify(await res.json()) }]
52
+ };
53
+ };
54
+ }
55
+ export {
56
+ RunWorkflow
57
+ };
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ import { Tool, ToolError } from "../../../common/tools.js";
3
+ import { problemSuffix } from "../../api.js";
4
+ const inputSchema = z.object({
5
+ runId: z.number().int().positive().describe("BearQ workflow run ID to cancel.")
6
+ });
7
+ class StopWorkflowRun extends Tool {
8
+ specification = {
9
+ title: "Stop Workflow Run",
10
+ toolset: "Workflows",
11
+ summary: "Cancels a workflow run that is in flight, returning { runId, cancelled: true }. Fails with an error when the run has already finished or does not exist.",
12
+ inputSchema
13
+ };
14
+ handle = async (args) => {
15
+ const { runId } = inputSchema.parse(args);
16
+ const res = await fetch(
17
+ `${this.client.getBaseUrl()}/workflow-runs/${runId}`,
18
+ { method: "DELETE", headers: this.client.getHeaders() }
19
+ );
20
+ if (!res.ok)
21
+ throw new ToolError(
22
+ `DELETE /workflow-runs/${runId} failed: ${res.status} ${res.statusText}` + await problemSuffix(res)
23
+ );
24
+ return {
25
+ content: [
26
+ { type: "text", text: JSON.stringify({ runId, cancelled: true }) }
27
+ ]
28
+ };
29
+ };
30
+ }
31
+ export {
32
+ StopWorkflowRun
33
+ };
@@ -7,6 +7,7 @@ import { createMcpHandler, isLegacyRequest, isInitializeRequest } from "@modelco
7
7
  import { SSEServerTransport } from "@modelcontextprotocol/server-legacy/sse";
8
8
  import { initAnalytics, isToolsListRequest, trackToolsListed, createAnalyticsSession, flushAnalytics } from "./analytics.js";
9
9
  import { clientRegistry } from "./client-registry.js";
10
+ import { MCP_SERVER_VERSION } from "./info.js";
10
11
  import { extractModernClientMeta, handleInitializeMessage } from "./initialize.js";
11
12
  import { withRequestHeaders, withRequestContext, setRequestMcpClient, setModernRequestClient } from "./request-context.js";
12
13
  import { SmartBearMcpServer } from "./server.js";
@@ -20,7 +21,13 @@ const PROBE_HEADERS = {
20
21
  function handleHealthRequest(res) {
21
22
  res.writeHead(200, PROBE_HEADERS);
22
23
  res.end(
23
- JSON.stringify({ status: "ok", timestamp: (/* @__PURE__ */ new Date()).toISOString() })
24
+ JSON.stringify({
25
+ status: "ok",
26
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
27
+ version: MCP_SERVER_VERSION,
28
+ // No regional deployments exist yet; hardcoded until that lands.
29
+ region: null
30
+ })
24
31
  );
25
32
  }
26
33
  function handleReadyRequest(res, draining = isDraining) {
@@ -1,4 +1,4 @@
1
- const version = "0.42.0";
1
+ const version = "0.43.0";
2
2
  const config = { "mcpServerName": "SmartBear MCP Server" };
3
3
  const packageJson = {
4
4
  version,
@@ -205,10 +205,7 @@ class AdminApi {
205
205
  /**
206
206
  * Fully replaces the roles assigned to a user (admin).
207
207
  */
208
- async setUserRoles({
209
- userId,
210
- roles
211
- }) {
208
+ async setUserRoles({ userId, roles }) {
212
209
  return await this.http.fetch(
213
210
  `${this.http.baseUrl}/admin/users/${encodeURIComponent(userId)}/roles`,
214
211
  { method: "PUT", body: { roles }, errorContext: "Set User Roles" }
@@ -217,10 +214,7 @@ class AdminApi {
217
214
  /**
218
215
  * Grants a single additional role to a user without affecting their existing roles (admin).
219
216
  */
220
- async addRoleToUser({
221
- userId,
222
- roleId
223
- }) {
217
+ async addRoleToUser({ userId, roleId }) {
224
218
  return await this.http.fetch(
225
219
  `${this.http.baseUrl}/admin/users/${encodeURIComponent(userId)}/roles/${encodeURIComponent(roleId)}`,
226
220
  { method: "PUT", body: {}, errorContext: "Add Role to User" }
@@ -337,6 +331,7 @@ class AdminApi {
337
331
  {
338
332
  method: "PATCH",
339
333
  body: operations,
334
+ headers: { "Content-Type": "application/json-patch+json" },
340
335
  errorContext: "Patch Team Users"
341
336
  }
342
337
  );
@@ -132,17 +132,51 @@ z.object({
132
132
  ),
133
133
  aiEnabled: z.boolean()
134
134
  }).describe("Entitlements information.");
135
+ const GenerationOutputSchema = z.looseObject({
136
+ id: z.string().nullish(),
137
+ code: z.string().optional(),
138
+ language: z.string().optional(),
139
+ requiresPromptExecution: z.literal(true).optional(),
140
+ prompt: z.string().optional(),
141
+ instructions: z.string().optional()
142
+ });
143
+ const RefineOutputSchema = z.looseObject({
144
+ recommendations: z.array(
145
+ z.looseObject({
146
+ recommendation: z.string(),
147
+ diff: z.string().nullish(),
148
+ confidence: z.number().nullish()
149
+ })
150
+ ).optional(),
151
+ requiresPromptExecution: z.literal(true).optional(),
152
+ prompt: z.string().optional(),
153
+ instructions: z.string().optional()
154
+ });
155
+ const EntitlementsOutputSchema = z.looseObject({
156
+ aiEnabled: z.boolean().optional(),
157
+ organizationEntitlements: z.looseObject({}).optional(),
158
+ userEntitlements: z.looseObject({}).optional()
159
+ });
160
+ const AI_OUTPUT_SCHEMAS = {
161
+ generate: GenerationOutputSchema,
162
+ review: RefineOutputSchema,
163
+ checkAIEntitlements: EntitlementsOutputSchema
164
+ };
135
165
  export {
166
+ AI_OUTPUT_SCHEMAS,
136
167
  AiCreditsSchema,
137
168
  EndpointMatcherSchema,
169
+ EntitlementsOutputSchema,
138
170
  FileInputSchema,
139
171
  GenerationInputSchema,
140
172
  GenerationLanguages,
173
+ GenerationOutputSchema,
141
174
  HttpMethods,
142
175
  OpenAPISchema,
143
176
  OpenAPIWithMatcherSchema,
144
177
  OrganizationEntitlementsSchema,
145
178
  RefineInputSchema,
179
+ RefineOutputSchema,
146
180
  RemoteOpenAPIDocumentSchema,
147
181
  RequestResponsePairSchema,
148
182
  UserEntitlementsSchema
@@ -279,6 +279,7 @@ class ContractApi {
279
279
  `${this.http.baseUrl}/integrations`,
280
280
  {
281
281
  method: "GET",
282
+ headers: { Accept: "application/hal+json" },
282
283
  errorContext: "List Integrations"
283
284
  }
284
285
  );
@@ -304,6 +305,7 @@ class ContractApi {
304
305
  `${this.http.baseUrl}/integrations/team/${encodeURIComponent(teamId)}`,
305
306
  {
306
307
  method: "GET",
308
+ headers: { Accept: "application/hal+json" },
307
309
  errorContext: "Get Integrations by Team"
308
310
  }
309
311
  );
@@ -5,11 +5,16 @@ class HttpClient {
5
5
  this.getHeaders = getHeaders;
6
6
  }
7
7
  async fetch(url, options) {
8
- const { method = "GET", body, errorContext = "Request" } = options ?? {};
8
+ const {
9
+ method = "GET",
10
+ body,
11
+ headers,
12
+ errorContext = "Request"
13
+ } = options ?? {};
9
14
  try {
10
15
  const response = await fetch(url, {
11
16
  method,
12
- headers: this.getHeaders(),
17
+ headers: { ...this.getHeaders(), ...headers },
13
18
  ...body !== void 0 ? { body: JSON.stringify(body) } : {}
14
19
  });
15
20
  if (!response.ok) {
@@ -63,6 +63,41 @@ class PacticipantApi {
63
63
  { method: "GET", errorContext: "List Versions" }
64
64
  );
65
65
  }
66
+ /**
67
+ * Retrieves all versions of a pacticipant that have ever been deployed or released, with optional pagination.
68
+ */
69
+ async listDeployedOrReleasedVersions({
70
+ pacticipantName,
71
+ pageNumber,
72
+ pageSize
73
+ }) {
74
+ const queryParams = new URLSearchParams();
75
+ if (pageNumber) queryParams.set("page", String(pageNumber));
76
+ if (pageSize) queryParams.set("size", String(pageSize));
77
+ const qs = queryParams.toString();
78
+ return await this.http.fetch(
79
+ `${this.http.baseUrl}/pacticipants/${encodeURIComponent(pacticipantName)}/deployed-or-released/versions${qs ? `?${qs}` : ""}`,
80
+ { method: "GET", errorContext: "List Deployed or Released Versions" }
81
+ );
82
+ }
83
+ /**
84
+ * Retrieves the versions of a pacticipant associated with an environment, with optional pagination.
85
+ */
86
+ async listEnvironmentVersions({
87
+ pacticipantName,
88
+ environmentId,
89
+ pageNumber,
90
+ pageSize
91
+ }) {
92
+ const queryParams = new URLSearchParams();
93
+ if (pageNumber) queryParams.set("page", String(pageNumber));
94
+ if (pageSize) queryParams.set("size", String(pageSize));
95
+ const qs = queryParams.toString();
96
+ return await this.http.fetch(
97
+ `${this.http.baseUrl}/pacticipants/${encodeURIComponent(pacticipantName)}/environments/${encodeURIComponent(environmentId)}/versions${qs ? `?${qs}` : ""}`,
98
+ { method: "GET", errorContext: "List Environment Versions" }
99
+ );
100
+ }
66
101
  /**
67
102
  * Retrieves metadata for a specific version of a pacticipant.
68
103
  */
@@ -265,6 +300,8 @@ class PacticipantApi {
265
300
  getPacticipant: this.getPacticipant.bind(this),
266
301
  listBranches: this.listBranches.bind(this),
267
302
  listVersions: this.listVersions.bind(this),
303
+ listDeployedOrReleasedVersions: this.listDeployedOrReleasedVersions.bind(this),
304
+ listEnvironmentVersions: this.listEnvironmentVersions.bind(this),
268
305
  getVersion: this.getVersion.bind(this),
269
306
  getLatestVersion: this.getLatestVersion.bind(this),
270
307
  updatePacticipant: this.updatePacticipant.bind(this),