@smartbear/mcp 0.32.0 → 0.33.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.
@@ -1,5 +1,16 @@
1
1
  import { ZodURL } from "zod";
2
2
  import { fullyUnwrapZodType, isOptionalType } from "./zod-utils.js";
3
+ function cloneClient(entry) {
4
+ const withClone = entry;
5
+ if (typeof withClone.clone === "function") {
6
+ return withClone.clone();
7
+ }
8
+ const ctor = entry.constructor;
9
+ if (ctor && ctor !== Object && typeof ctor === "function") {
10
+ return new ctor();
11
+ }
12
+ return entry;
13
+ }
3
14
  class ClientRegistry {
4
15
  entries = [];
5
16
  enabledClients;
@@ -92,19 +103,20 @@ class ClientRegistry {
92
103
  async configure(server, getConfigValue, ignoreMissingRequiredConfigs = false) {
93
104
  let configuredCount = 0;
94
105
  entryLoop: for (const entry of this.getAll()) {
106
+ const client = cloneClient(entry);
95
107
  const config = {};
96
- for (const configKey of Object.keys(entry.config.shape)) {
97
- const value = getConfigValue(entry, configKey);
108
+ for (const configKey of Object.keys(client.config.shape)) {
109
+ const value = getConfigValue(client, configKey);
98
110
  if (value !== null) {
99
- this.validateAllowedEndpoint(entry.config.shape[configKey], value);
111
+ this.validateAllowedEndpoint(client.config.shape[configKey], value);
100
112
  config[configKey] = value;
101
- } else if (!ignoreMissingRequiredConfigs && !isOptionalType(entry.config.shape[configKey])) {
113
+ } else if (!ignoreMissingRequiredConfigs && !isOptionalType(client.config.shape[configKey])) {
102
114
  continue entryLoop;
103
115
  }
104
116
  }
105
- await entry.configure(server, config);
106
- if (entry.isConfigured()) {
107
- await server.addClient(entry);
117
+ await client.configure(server, config);
118
+ if (client.isConfigured()) {
119
+ await server.addClient(client);
108
120
  configuredCount++;
109
121
  }
110
122
  }
@@ -1,4 +1,4 @@
1
- const version = "0.32.0";
1
+ const version = "0.33.0";
2
2
  const config = { "mcpServerName": "SmartBear MCP Server" };
3
3
  const packageJson = {
4
4
  version,
@@ -47,6 +47,31 @@ class FunctionalTestingAPI {
47
47
  }
48
48
  return response;
49
49
  }
50
+ async createTest(args) {
51
+ const {
52
+ type: _type,
53
+ steps,
54
+ ...rest
55
+ } = args;
56
+ const sanitizedSteps = steps?.map((step) => {
57
+ const { type: _stepType, ...stepRest } = step;
58
+ return { ...stepRest, type: "api" };
59
+ });
60
+ const response = await this.ftFetch(
61
+ `tests`,
62
+ {
63
+ method: "POST",
64
+ headers: this.getFtHeaders(),
65
+ body: JSON.stringify({
66
+ ...rest,
67
+ type: "api",
68
+ steps: sanitizedSteps
69
+ })
70
+ },
71
+ errorMessageFor(`create Functional Testing test`)
72
+ );
73
+ return response.json();
74
+ }
50
75
  async listTests() {
51
76
  const response = await this.ftFetch(
52
77
  `tests`,
@@ -1,4 +1,4 @@
1
- import { RunFunctionalTestingTestParamsSchema, GetFunctionalTestingExecutionTestSchema, ListFunctionalTestingSuiteExecutionsSchema, CancelFunctionalTestingSuiteExecutionSchema, RunFunctionalTestingSuiteParamsSchema, GetFunctionalTestingSuiteExecutionSchema, GetFunctionalTestHistoryParamsSchema } from "./functional-testing-types.js";
1
+ import { CreateFunctionalTestingTestResponseSchema, CreateFunctionalTestingTestParamsSchema, RunFunctionalTestingTestParamsSchema, GetFunctionalTestingExecutionTestSchema, ListFunctionalTestingSuiteExecutionsSchema, CancelFunctionalTestingSuiteExecutionSchema, RunFunctionalTestingSuiteParamsSchema, GetFunctionalTestingSuiteExecutionSchema, GetFunctionalTestHistoryParamsSchema } from "./functional-testing-types.js";
2
2
  const FUNCTIONAL_TESTING_TOOLS = [
3
3
  {
4
4
  title: "List Tests",
@@ -8,10 +8,20 @@ const FUNCTIONAL_TESTING_TOOLS = [
8
8
  idempotent: true,
9
9
  readOnly: true
10
10
  },
11
+ {
12
+ title: "Create Test",
13
+ toolset: "Functional Testing",
14
+ summary: "Creates a new API test in your Swagger Functional Testing workspace. This tool only creates API tests (not browser or native-mobile tests). Use this when you need to programmatically create a test with a defined set of API request steps. Each step requires a URL and may specify an HTTP method (defaults to GET), request body, headers, and redirect handling. Returns the ID and the URL to definition of the newly created test; the ID can be used with `swagger_run_test` to run it.",
15
+ inputSchema: CreateFunctionalTestingTestParamsSchema,
16
+ outputSchema: CreateFunctionalTestingTestResponseSchema,
17
+ handler: "createFunctionalTestingTest",
18
+ idempotent: false,
19
+ readOnly: false
20
+ },
11
21
  {
12
22
  title: "Run Test",
13
23
  toolset: "Functional Testing",
14
- summary: "Runs a specific API test in your Swagger Functional Testing workspace. The execution is asynchronous — it returns an executionId, not the result directly. Use swagger_get_test_status with that executionId to track progress and retrieve the final result.",
24
+ summary: "Runs a specific API test in your Swagger Functional Testing workspace. The execution is asynchronous — it returns an executionId, not the result directly. Use `swagger_get_test_status` with that executionId to track progress and retrieve the final result.",
15
25
  inputSchema: RunFunctionalTestingTestParamsSchema,
16
26
  handler: "runFunctionalTestingTest",
17
27
  idempotent: false,
@@ -27,11 +27,40 @@ const GetFunctionalTestHistoryParamsSchema = z.object({
27
27
  limit: z.number().int().min(1).max(100).optional().describe("Number of most recent runs to return (default: 25, max: 100)"),
28
28
  offset: z.number().int().min(0).optional().describe("Pagination offset (default: 0)")
29
29
  });
30
+ const CreateFunctionalTestingTestHeaderSchema = z.object({
31
+ name: z.string().describe("Header name").trim().min(1),
32
+ value: z.string().describe("Header value")
33
+ });
34
+ const HTTP_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
35
+ const CreateFunctionalTestingTestStepSchema = z.object({
36
+ url: z.url().describe("URL for the API call"),
37
+ httpMethod: z.enum(HTTP_METHODS).describe("HTTP method for the API call (defaults to GET server-side)").optional(),
38
+ requestBody: z.string().describe("Request body").optional(),
39
+ requestHeaders: z.array(CreateFunctionalTestingTestHeaderSchema).describe("HTTP headers").optional(),
40
+ followRedirects: z.boolean().describe("Whether to follow redirects").optional(),
41
+ description: z.string().trim().describe("Human-readable label for this step").optional()
42
+ });
43
+ const CreateFunctionalTestingTestParamsSchema = z.object({
44
+ name: z.string().describe("Name for the new test").trim().min(1),
45
+ description: z.string().trim().describe("Optional description for the test").optional(),
46
+ steps: z.array(CreateFunctionalTestingTestStepSchema).describe("Test steps to include in the test").optional()
47
+ });
48
+ const CreateFunctionalTestingTestResponseSchema = z.object({
49
+ id: z.number().describe("ID of the newly created test"),
50
+ url: z.string().describe(
51
+ "Link to the created test definition in Swagger Functional Testing UI"
52
+ )
53
+ });
30
54
  export {
31
55
  CancelFunctionalTestingSuiteExecutionSchema,
56
+ CreateFunctionalTestingTestHeaderSchema,
57
+ CreateFunctionalTestingTestParamsSchema,
58
+ CreateFunctionalTestingTestResponseSchema,
59
+ CreateFunctionalTestingTestStepSchema,
32
60
  GetFunctionalTestHistoryParamsSchema,
33
61
  GetFunctionalTestingExecutionTestSchema,
34
62
  GetFunctionalTestingSuiteExecutionSchema,
63
+ HTTP_METHODS,
35
64
  ListFunctionalTestingSuiteExecutionsSchema,
36
65
  RunFunctionalTestingSuiteParamsSchema,
37
66
  RunFunctionalTestingTestParamsSchema
@@ -12,13 +12,13 @@ import { TOOLS } from "./client/tools.js";
12
12
  import "./client/user-management-types.js";
13
13
  const ConfigurationSchema = z.object({
14
14
  api_key: z.string().optional().describe("Swagger API key for authentication"),
15
- portal_base_path: z.string().optional().describe("Base path for Portal API requests (optional)"),
16
- registry_base_path: z.string().optional().describe("Base path for Registry API requests (optional)"),
17
- ui_base_path: z.string().optional().describe("Base URL for the SwaggerHub UI (optional)"),
15
+ portal_base_path: z.url().optional().describe("Base URL for Portal API requests (optional)"),
16
+ registry_base_path: z.url().optional().describe("Base path for Registry API requests (optional)"),
17
+ ui_base_path: z.url().optional().describe("Base URL for the SwaggerHub UI (optional)"),
18
18
  functional_testing_api_token: z.string().optional().describe(
19
19
  "Swagger Functional Testing API token. Leave empty to disable Functional Testing tools."
20
20
  ),
21
- functional_testing_base_path: z.string().optional().describe(
21
+ functional_testing_base_path: z.url().optional().describe(
22
22
  "Base URL for Swagger Functional Testing API requests (optional)"
23
23
  )
24
24
  });
@@ -172,6 +172,9 @@ class SwaggerClient {
172
172
  return this.getApi().standardizeApi(args);
173
173
  }
174
174
  // Functional Testing methods
175
+ async createFunctionalTestingTest(args) {
176
+ return this.withFunctionalTesting((ftApi) => ftApi.createTest(args));
177
+ }
175
178
  async listFunctionalTestingTests() {
176
179
  return this.withFunctionalTesting((ftApi) => ftApi.listTests());
177
180
  }
@@ -36,6 +36,7 @@ import { GetTestExecutions } from "./tool/test-execution/get-test-executions.js"
36
36
  import { GetTestExecutionSteps } from "./tool/test-execution/get-test-steps.js";
37
37
  import { UpdateTestExecution } from "./tool/test-execution/update-test-execution.js";
38
38
  import { UpdateTestExecutionSteps } from "./tool/test-execution/update-test-steps.js";
39
+ import { GetTestPlans } from "./tool/test-plan/get-test-plans.js";
39
40
  const BASE_URL_DEFAULT = "https://api.zephyrscale.smartbear.com/v2";
40
41
  const ConfigurationSchema = zod__default.object({
41
42
  api_token: zod__default.string().describe("Zephyr Scale API token for authentication"),
@@ -109,7 +110,8 @@ class ZephyrClient {
109
110
  new UpdateTestExecutionSteps(this),
110
111
  new GetTestExecutionSteps(this),
111
112
  new GetTestExecutionLinks(this),
112
- new GetTestExecutions$1(this)
113
+ new GetTestExecutions$1(this),
114
+ new GetTestPlans(this)
113
115
  ];
114
116
  for (const tool of tools) {
115
117
  register(tool.specification, tool.handle);