@smartbear/mcp 0.10.0 → 0.11.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/README.md +10 -8
- package/dist/bugsnag/client/api/index.js +2 -0
- package/dist/bugsnag/client/filters.js +0 -6
- package/dist/bugsnag/client.js +234 -376
- package/dist/bugsnag/input-schemas.js +51 -0
- package/dist/collaborator/client.js +18 -5
- package/dist/common/cache.js +63 -0
- package/dist/common/client-registry.js +128 -0
- package/dist/common/register-clients.js +31 -0
- package/dist/common/server.js +30 -9
- package/dist/common/transport-http.js +377 -0
- package/dist/common/transport-stdio.js +43 -0
- package/dist/index.js +20 -70
- package/dist/pactflow/client.js +39 -19
- package/dist/qmetry/client.js +24 -9
- package/dist/reflect/client.js +10 -4
- package/dist/{api-hub → swagger}/client/api.js +2 -2
- package/dist/{api-hub → swagger}/client/configuration.js +1 -1
- package/dist/{api-hub → swagger}/client/index.js +2 -2
- package/dist/{api-hub → swagger}/client/tools.js +4 -4
- package/dist/{api-hub → swagger}/client.js +47 -35
- package/dist/swagger/config-utils.js +18 -0
- package/dist/zephyr/client.js +40 -8
- package/dist/zephyr/common/rest-api-schemas.js +79 -78
- package/dist/zephyr/tool/priority/get-priorities.js +43 -0
- package/dist/zephyr/tool/status/get-statuses.js +49 -0
- package/dist/zephyr/tool/test-case/get-test-case.js +39 -0
- package/dist/zephyr/tool/test-case/get-test-cases.js +64 -0
- package/dist/zephyr/tool/test-cycle/get-test-cycle.js +39 -0
- package/dist/zephyr/tool/test-cycle/get-test-cycles.js +2 -2
- package/dist/zephyr/tool/test-execution/get-test-execution.js +39 -0
- package/package.json +2 -2
- /package/dist/{api-hub → swagger}/client/portal-types.js +0 -0
- /package/dist/{api-hub → swagger}/client/registry-types.js +0 -0
- /package/dist/{api-hub → swagger}/client/user-management-types.js +0 -0
package/dist/reflect/client.js
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { MCP_SERVER_NAME, MCP_SERVER_VERSION } from "../common/info.js";
|
|
3
3
|
import { ToolError, } from "../common/types.js";
|
|
4
|
+
const ConfigurationSchema = z.object({
|
|
5
|
+
api_token: z.string().describe("Reflect API authentication token"),
|
|
6
|
+
});
|
|
4
7
|
// ReflectClient class implementing the Client interface
|
|
5
8
|
export class ReflectClient {
|
|
6
|
-
headers;
|
|
9
|
+
headers = {};
|
|
7
10
|
name = "Reflect";
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
toolPrefix = "reflect";
|
|
12
|
+
configPrefix = "Reflect";
|
|
13
|
+
config = ConfigurationSchema;
|
|
14
|
+
async configure(_server, config, _cache) {
|
|
10
15
|
this.headers = {
|
|
11
|
-
"X-API-KEY": `${
|
|
16
|
+
"X-API-KEY": `${config.api_token}`,
|
|
12
17
|
"Content-Type": "application/json",
|
|
13
18
|
"User-Agent": `${MCP_SERVER_NAME}/${MCP_SERVER_VERSION}`,
|
|
14
19
|
};
|
|
20
|
+
return true;
|
|
15
21
|
}
|
|
16
22
|
async listReflectSuites() {
|
|
17
23
|
const response = await fetch("https://api.reflect.run/v1/suites", {
|
|
@@ -7,7 +7,7 @@ import { ToolError } from "../../common/types.js";
|
|
|
7
7
|
// - group 3: name
|
|
8
8
|
// - group 4: version
|
|
9
9
|
const SWAGGER_URL_REGEX = /\/(apis|domains|templates)\/([^/]+)\/([^/]+)\/([^/]+)/;
|
|
10
|
-
export class
|
|
10
|
+
export class SwaggerAPI {
|
|
11
11
|
config;
|
|
12
12
|
headers;
|
|
13
13
|
constructor(config, userAgent) {
|
|
@@ -141,7 +141,7 @@ export class ApiHubAPI {
|
|
|
141
141
|
});
|
|
142
142
|
if (!response.ok) {
|
|
143
143
|
const errorText = await response.text().catch(() => "");
|
|
144
|
-
throw new ToolError(`
|
|
144
|
+
throw new ToolError(`Swagger deletePortal failed - status: ${response.status} ${response.statusText}${errorText ? ` - ${errorText}` : ""}`);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
async updatePortal(portalId, body) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { SwaggerAPI } from "./api.js";
|
|
2
|
+
export { SwaggerConfiguration, } from "./configuration.js";
|
|
3
3
|
export * from "./portal-types.js";
|
|
4
4
|
export * from "./registry-types.js";
|
|
5
5
|
export { TOOLS } from "./tools.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TOOLS
|
|
3
3
|
*
|
|
4
|
-
* Defines tool configurations for
|
|
4
|
+
* Defines tool configurations for Swagger operations.
|
|
5
5
|
* Each tool includes parameters, descriptions, and handler method names.
|
|
6
6
|
* This follows the pattern established in the pactflow module.
|
|
7
7
|
*/
|
|
@@ -11,13 +11,13 @@ import { OrganizationsQuerySchema } from "./user-management-types.js";
|
|
|
11
11
|
export const TOOLS = [
|
|
12
12
|
{
|
|
13
13
|
title: "List Portals",
|
|
14
|
-
summary: "Search for available portals within
|
|
14
|
+
summary: "Search for available portals within Swagger. Only portals where you have at least a designer role, either at the product level or organization level, are returned.",
|
|
15
15
|
parameters: [],
|
|
16
16
|
handler: "getPortals",
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
title: "Create Portal",
|
|
20
|
-
summary: "Create a new portal within
|
|
20
|
+
summary: "Create a new portal within Swagger.",
|
|
21
21
|
inputSchema: CreatePortalArgsSchema,
|
|
22
22
|
handler: "createPortal",
|
|
23
23
|
},
|
|
@@ -135,7 +135,7 @@ export const TOOLS = [
|
|
|
135
135
|
},
|
|
136
136
|
{
|
|
137
137
|
title: "Create or Update API",
|
|
138
|
-
summary: "Create a new API or update an existing API in SwaggerHub Registry for
|
|
138
|
+
summary: "Create a new API or update an existing API in SwaggerHub Registry for Swagger Studio. The API specification type (OpenAPI, AsyncAPI) is automatically detected from the definition content. APIs are always created with fixed values: version 1.0.0, private visibility, and automock disabled (these values cannot be changed). Returns HTTP 201 for creation, HTTP 200 for update. Response includes 'operation' field indicating whether it was a 'create' or 'update' operation along with API details and SwaggerHub URL.",
|
|
139
139
|
inputSchema: CreateApiParamsSchema,
|
|
140
140
|
handler: "createOrUpdateApi",
|
|
141
141
|
},
|
|
@@ -1,95 +1,107 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
import { MCP_SERVER_NAME, MCP_SERVER_VERSION } from "../common/info.js";
|
|
2
|
-
|
|
3
|
+
// Apply backward compatibility for API_HUB_API_KEY
|
|
4
|
+
import "./config-utils.js";
|
|
5
|
+
import { SwaggerAPI, SwaggerConfiguration, TOOLS, } from "./client/index.js";
|
|
6
|
+
const ConfigurationSchema = z.object({
|
|
7
|
+
api_key: z.string().describe("Swagger API key for authentication"),
|
|
8
|
+
});
|
|
3
9
|
// Tool definitions for API Hub API client
|
|
4
|
-
export class
|
|
5
|
-
config;
|
|
10
|
+
export class SwaggerClient {
|
|
6
11
|
api;
|
|
7
|
-
name = "
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
name = "Swagger";
|
|
13
|
+
toolPrefix = "swagger";
|
|
14
|
+
configPrefix = "Swagger";
|
|
15
|
+
config = ConfigurationSchema;
|
|
16
|
+
async configure(_server, config, _cache) {
|
|
17
|
+
this.api = new SwaggerAPI(new SwaggerConfiguration({ token: config.api_key }), `${MCP_SERVER_NAME}/${MCP_SERVER_VERSION}`);
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
getApi() {
|
|
21
|
+
if (!this.api)
|
|
22
|
+
throw new Error("Client not configured");
|
|
23
|
+
return this.api;
|
|
24
|
+
}
|
|
25
|
+
// Delegate API methods to the SwaggerAPI instance
|
|
14
26
|
async getPortals() {
|
|
15
|
-
return this.
|
|
27
|
+
return this.getApi().getPortals();
|
|
16
28
|
}
|
|
17
29
|
async createPortal(body) {
|
|
18
|
-
return this.
|
|
30
|
+
return this.getApi().createPortal(body);
|
|
19
31
|
}
|
|
20
32
|
async getPortal(args) {
|
|
21
|
-
return this.
|
|
33
|
+
return this.getApi().getPortal(args.portalId);
|
|
22
34
|
}
|
|
23
35
|
async deletePortal(args) {
|
|
24
|
-
return this.
|
|
36
|
+
return this.getApi().deletePortal(args.portalId);
|
|
25
37
|
}
|
|
26
38
|
async updatePortal(args) {
|
|
27
39
|
const { portalId, ...body } = args;
|
|
28
|
-
return this.
|
|
40
|
+
return this.getApi().updatePortal(portalId, body);
|
|
29
41
|
}
|
|
30
42
|
async getPortalProducts(args) {
|
|
31
|
-
return this.
|
|
43
|
+
return this.getApi().getPortalProducts(args.portalId);
|
|
32
44
|
}
|
|
33
45
|
async createPortalProduct(args) {
|
|
34
46
|
const { portalId, ...body } = args;
|
|
35
|
-
return this.
|
|
47
|
+
return this.getApi().createPortalProduct(portalId, body);
|
|
36
48
|
}
|
|
37
49
|
async getPortalProduct(args) {
|
|
38
|
-
return this.
|
|
50
|
+
return this.getApi().getPortalProduct(args.productId);
|
|
39
51
|
}
|
|
40
52
|
async deletePortalProduct(args) {
|
|
41
|
-
return this.
|
|
53
|
+
return this.getApi().deletePortalProduct(args.productId);
|
|
42
54
|
}
|
|
43
55
|
async updatePortalProduct(args) {
|
|
44
56
|
const { productId, ...body } = args;
|
|
45
|
-
return this.
|
|
57
|
+
return this.getApi().updatePortalProduct(productId, body);
|
|
46
58
|
}
|
|
47
59
|
async publishPortalProduct(args) {
|
|
48
60
|
const { productId, preview } = args;
|
|
49
|
-
return this.
|
|
61
|
+
return this.getApi().publishPortalProduct(productId, preview);
|
|
50
62
|
}
|
|
51
63
|
async getPortalProductSections(args) {
|
|
52
64
|
const { productId, ...params } = args;
|
|
53
|
-
return this.
|
|
65
|
+
return this.getApi().getPortalProductSections(productId, params);
|
|
54
66
|
}
|
|
55
67
|
async createTableOfContents(args) {
|
|
56
68
|
const { sectionId, ...body } = args;
|
|
57
|
-
return this.
|
|
69
|
+
return this.getApi().createTableOfContents(sectionId, body);
|
|
58
70
|
}
|
|
59
71
|
async getTableOfContents(args) {
|
|
60
|
-
return this.
|
|
72
|
+
return this.getApi().getTableOfContents(args);
|
|
61
73
|
}
|
|
62
74
|
async getDocument(args) {
|
|
63
|
-
return this.
|
|
75
|
+
return this.getApi().getDocument(args);
|
|
64
76
|
}
|
|
65
77
|
async updateDocument(args) {
|
|
66
|
-
return this.
|
|
78
|
+
return this.getApi().updateDocument(args);
|
|
67
79
|
}
|
|
68
80
|
async deleteDocument(args) {
|
|
69
|
-
return this.
|
|
81
|
+
return this.getApi().deleteDocument(args);
|
|
70
82
|
}
|
|
71
83
|
async deleteTableOfContents(args) {
|
|
72
|
-
return this.
|
|
84
|
+
return this.getApi().deleteTableOfContents(args);
|
|
73
85
|
}
|
|
74
86
|
// Registry API methods for SwaggerHub Design functionality
|
|
75
87
|
async searchApis(args = {}) {
|
|
76
|
-
return this.
|
|
88
|
+
return this.getApi().searchApis(args);
|
|
77
89
|
}
|
|
78
90
|
async getApiDefinition(args) {
|
|
79
|
-
return this.
|
|
91
|
+
return this.getApi().getApiDefinition(args);
|
|
80
92
|
}
|
|
81
93
|
async createOrUpdateApi(args) {
|
|
82
|
-
return this.
|
|
94
|
+
return this.getApi().createOrUpdateApi(args);
|
|
83
95
|
}
|
|
84
96
|
async createApiFromTemplate(args) {
|
|
85
|
-
return this.
|
|
97
|
+
return this.getApi().createApiFromTemplate(args);
|
|
86
98
|
}
|
|
87
99
|
// User Management API methods
|
|
88
100
|
async getOrganizations(args) {
|
|
89
|
-
return this.
|
|
101
|
+
return this.getApi().getOrganizations(args);
|
|
90
102
|
}
|
|
91
103
|
async scanStandardization(args) {
|
|
92
|
-
return this.
|
|
104
|
+
return this.getApi().scanStandardization(args);
|
|
93
105
|
}
|
|
94
106
|
registerTools(register, _getInput) {
|
|
95
107
|
TOOLS.forEach((tool) => {
|
|
@@ -99,7 +111,7 @@ export class ApiHubClient {
|
|
|
99
111
|
// Dynamic method invocation
|
|
100
112
|
const handlerFn = this[handler];
|
|
101
113
|
if (typeof handlerFn !== "function") {
|
|
102
|
-
throw new Error(`Handler '${handler}' not found on
|
|
114
|
+
throw new Error(`Handler '${handler}' not found on SwaggerClient`);
|
|
103
115
|
}
|
|
104
116
|
const result = await handlerFn.call(this, args);
|
|
105
117
|
// Use custom formatter if available, otherwise return JSON
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration utilities for Swagger client
|
|
3
|
+
* Handles backward compatibility with legacy environment variables
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Apply API_HUB_API_KEY fallback to SWAGGER_API_KEY if needed
|
|
7
|
+
* This modifies process.env to enable backward compatibility
|
|
8
|
+
* @deprecated API_HUB_API_KEY support - TODO: Remove after migration period (May 2026)
|
|
9
|
+
*/
|
|
10
|
+
export function applySwaggerApiKeyFallback() {
|
|
11
|
+
// If SWAGGER_API_KEY is not set but API_HUB_API_KEY is, use the legacy variable
|
|
12
|
+
if (!process.env.SWAGGER_API_KEY && process.env.API_HUB_API_KEY) {
|
|
13
|
+
console.warn("[Swagger] API_HUB_API_KEY is deprecated. Please use SWAGGER_API_KEY instead.");
|
|
14
|
+
process.env.SWAGGER_API_KEY = process.env.API_HUB_API_KEY;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// Apply the fallback immediately when this module is imported
|
|
18
|
+
applySwaggerApiKeyFallback();
|
package/dist/zephyr/client.js
CHANGED
|
@@ -1,22 +1,54 @@
|
|
|
1
|
+
import z from "zod";
|
|
1
2
|
import { ApiClient } from "./common/api-client.js";
|
|
3
|
+
import { GetPriorities } from "./tool/priority/get-priorities.js";
|
|
2
4
|
import { GetProject } from "./tool/project/get-project.js";
|
|
3
5
|
import { GetProjects } from "./tool/project/get-projects.js";
|
|
6
|
+
import { GetStatuses } from "./tool/status/get-statuses.js";
|
|
7
|
+
import { GetTestCase } from "./tool/test-case/get-test-case.js";
|
|
8
|
+
import { GetTestCases } from "./tool/test-case/get-test-cases.js";
|
|
9
|
+
import { GetTestCycle } from "./tool/test-cycle/get-test-cycle.js";
|
|
4
10
|
import { GetTestCycles } from "./tool/test-cycle/get-test-cycles.js";
|
|
11
|
+
import { GetTestExecution } from "./tool/test-execution/get-test-execution.js";
|
|
12
|
+
const BASE_URL_DEFAULT = "https://api.zephyrscale.smartbear.com/v2";
|
|
13
|
+
const ConfigurationSchema = z.object({
|
|
14
|
+
api_token: z.string().describe("Zephyr Scale API token for authentication"),
|
|
15
|
+
base_url: z
|
|
16
|
+
.string()
|
|
17
|
+
.url()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Zephyr Scale API base URL")
|
|
20
|
+
.default(BASE_URL_DEFAULT),
|
|
21
|
+
});
|
|
5
22
|
export class ZephyrClient {
|
|
6
23
|
apiClient;
|
|
7
24
|
name = "Zephyr";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
25
|
+
toolPrefix = "zephyr";
|
|
26
|
+
configPrefix = "Zephyr";
|
|
27
|
+
config = ConfigurationSchema;
|
|
28
|
+
async configure(_server, config, _cache) {
|
|
29
|
+
this.apiClient = new ApiClient(config.api_token, config.base_url || BASE_URL_DEFAULT);
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
getApiClient() {
|
|
33
|
+
if (!this.apiClient)
|
|
34
|
+
throw new Error("Client not configured");
|
|
35
|
+
return this.apiClient;
|
|
11
36
|
}
|
|
12
37
|
registerTools(register, _getInput) {
|
|
38
|
+
const apiClient = this.getApiClient();
|
|
13
39
|
const tools = [
|
|
14
|
-
new GetProjects(
|
|
15
|
-
new GetProject(
|
|
16
|
-
new GetTestCycles(
|
|
40
|
+
new GetProjects(apiClient),
|
|
41
|
+
new GetProject(apiClient),
|
|
42
|
+
new GetTestCycles(apiClient),
|
|
43
|
+
new GetTestCycle(apiClient),
|
|
44
|
+
new GetPriorities(apiClient),
|
|
45
|
+
new GetStatuses(apiClient),
|
|
46
|
+
new GetTestCases(apiClient),
|
|
47
|
+
new GetTestCase(apiClient),
|
|
48
|
+
new GetTestExecution(apiClient),
|
|
17
49
|
];
|
|
18
|
-
|
|
50
|
+
for (const tool of tools) {
|
|
19
51
|
register(tool.specification, tool.handle);
|
|
20
|
-
}
|
|
52
|
+
}
|
|
21
53
|
}
|
|
22
54
|
}
|