@smartbear/mcp 0.43.0 → 0.45.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/dist/bugsnag/client/api/Project.js +1 -1
- package/dist/bugsnag/client.js +14 -2
- package/dist/bugsnag/input-schemas.js +31 -13
- package/dist/bugsnag/tool/error/get-error.js +5 -4
- package/dist/bugsnag/tool/error/list-project-errors.js +7 -5
- package/dist/bugsnag/tool/error/update-error.js +7 -4
- package/dist/bugsnag/tool/event/get-event-details-from-dashboard-url.js +3 -2
- package/dist/bugsnag/tool/event/get-event.js +4 -0
- package/dist/bugsnag/tool/event/list-error-events.js +16 -4
- package/dist/bugsnag/tool/performance/get-span-group.js +1 -0
- package/dist/bugsnag/tool/performance/get-trace.js +13 -5
- package/dist/bugsnag/tool/performance/list-span-groups.js +7 -3
- package/dist/bugsnag/tool/performance/list-spans.js +5 -2
- package/dist/bugsnag/tool/performance/list-trace-fields.js +1 -1
- package/dist/bugsnag/tool/performance/set-network-endpoint-groupings.js +3 -2
- package/dist/bugsnag/tool/project/get-current-project.js +3 -3
- package/dist/bugsnag/tool/project/list-project-event-filters.js +3 -3
- package/dist/bugsnag/tool/project/list-projects.js +6 -3
- package/dist/bugsnag/tool/release/get-build.js +4 -1
- package/dist/bugsnag/tool/release/get-release.js +4 -1
- package/dist/bugsnag/tool/release/list-releases.js +5 -4
- package/dist/common/cache.js +21 -2
- package/dist/common/config-names.js +12 -0
- package/dist/common/info.js +2 -0
- package/dist/common/list-integrations.js +53 -0
- package/dist/common/server.js +65 -3
- package/dist/common/transport-http.js +206 -35
- package/dist/common/transport-stdio.js +1 -6
- package/dist/package.json.js +1 -1
- package/dist/zephyr/common/rest-api-schemas.js +12 -3
- package/dist/zephyr/tool/test-case/create-web-link.js +17 -2
- package/dist/zephyr/tool/test-case/get-test-cases.js +9 -0
- package/dist/zephyr/tool/test-cycle/create-web-link.js +18 -2
- package/package.json +3 -1
- package/src/pactflow/drift/README.md +91 -0
|
@@ -8,10 +8,21 @@ class CreateTestCaseWebLink extends Tool {
|
|
|
8
8
|
readOnly: false,
|
|
9
9
|
idempotent: false,
|
|
10
10
|
inputSchema: CreateTestCaseWebLinkBody.extend({
|
|
11
|
-
testCaseKey: CreateTestCaseWebLinkParams.shape.testCaseKey
|
|
11
|
+
testCaseKey: CreateTestCaseWebLinkParams.shape.testCaseKey,
|
|
12
|
+
description: CreateTestCaseWebLinkBody.shape.description.describe(
|
|
13
|
+
"The web link description, shown as the link text in Zephyr. Optional; defaults to the URL."
|
|
14
|
+
)
|
|
12
15
|
}),
|
|
13
16
|
outputSchema: CreateTestCaseWebLink201Response,
|
|
14
17
|
examples: [
|
|
18
|
+
{
|
|
19
|
+
description: "Add a web link 'https://www.atlassian.com' to test case SA-T1 without a description",
|
|
20
|
+
parameters: {
|
|
21
|
+
testCaseKey: "SA-T1",
|
|
22
|
+
url: "https://www.atlassian.com"
|
|
23
|
+
},
|
|
24
|
+
expectedOutput: "The newly created Web Link with its ID and self link; the URL is used as the link text"
|
|
25
|
+
},
|
|
15
26
|
{
|
|
16
27
|
description: "Create a web link for test case SA-T1 pointing to Atlassian's homepage",
|
|
17
28
|
parameters: {
|
|
@@ -37,7 +48,11 @@ class CreateTestCaseWebLink extends Tool {
|
|
|
37
48
|
testCaseKey: CreateTestCaseWebLinkParams.shape.testCaseKey
|
|
38
49
|
});
|
|
39
50
|
const parsed = fullInputSchema.parse(args);
|
|
40
|
-
const { testCaseKey,
|
|
51
|
+
const { testCaseKey, description, url } = parsed;
|
|
52
|
+
const body = {
|
|
53
|
+
url,
|
|
54
|
+
description: description?.trim() ? description : url
|
|
55
|
+
};
|
|
41
56
|
const response = await this.client.getApiClient().post(`/testcases/${testCaseKey}/links/weblinks`, body);
|
|
42
57
|
return {
|
|
43
58
|
structuredContent: response,
|
|
@@ -41,6 +41,15 @@ class GetTestCases extends Tool {
|
|
|
41
41
|
},
|
|
42
42
|
expectedOutput: "One Test Case from project PROJ with its details"
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
description: "Get Test Cases having name containing 'tool' from the project PROJ",
|
|
46
|
+
parameters: {
|
|
47
|
+
projectKey: "PROJ",
|
|
48
|
+
nameOrKey: "tool",
|
|
49
|
+
limit: 10
|
|
50
|
+
},
|
|
51
|
+
expectedOutput: "The first 10 Test Cases from project PROJ having 'tool' in the title"
|
|
52
|
+
},
|
|
44
53
|
{
|
|
45
54
|
description: "Get one Test Case from the folder with ID 123",
|
|
46
55
|
parameters: {
|
|
@@ -11,8 +11,20 @@ class CreateTestCycleWebLink extends Tool {
|
|
|
11
11
|
// a plain object instead of `allOf`, which older MCP clients don't understand.
|
|
12
12
|
inputSchema: CreateTestCycleWebLinkParams.extend(
|
|
13
13
|
CreateTestCycleWebLinkBody.partial().shape
|
|
14
|
-
)
|
|
14
|
+
).extend({
|
|
15
|
+
description: CreateTestCycleWebLinkBody.shape.description.describe(
|
|
16
|
+
"The web link description, shown as the link text in Zephyr. Optional; defaults to the URL."
|
|
17
|
+
)
|
|
18
|
+
}),
|
|
15
19
|
examples: [
|
|
20
|
+
{
|
|
21
|
+
description: "Add a web link 'https://www.atlassian.com' to test cycle 'SA-R15' without a description",
|
|
22
|
+
parameters: {
|
|
23
|
+
testCycleIdOrKey: "SA-R15",
|
|
24
|
+
url: "https://www.atlassian.com"
|
|
25
|
+
},
|
|
26
|
+
expectedOutput: "The newly created Web Link with its ID and self link; the URL is used as the link text"
|
|
27
|
+
},
|
|
16
28
|
{
|
|
17
29
|
description: "Create a link between the specified test cycle by Id '100001' and generic URL 'https://www.atlassian.com' with description 'Atlassian homepage'",
|
|
18
30
|
parameters: {
|
|
@@ -46,7 +58,11 @@ class CreateTestCycleWebLink extends Tool {
|
|
|
46
58
|
const parsed = CreateTestCycleWebLinkParams.and(
|
|
47
59
|
CreateTestCycleWebLinkBody
|
|
48
60
|
).parse(args);
|
|
49
|
-
const { testCycleIdOrKey,
|
|
61
|
+
const { testCycleIdOrKey, description, url } = parsed;
|
|
62
|
+
const body = {
|
|
63
|
+
url,
|
|
64
|
+
description: description?.trim() ? description : url
|
|
65
|
+
};
|
|
50
66
|
const response = await this.client.getApiClient().post(`/testcycles/${testCycleIdOrKey}/links/weblinks`, body);
|
|
51
67
|
return {
|
|
52
68
|
structuredContent: response,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartbear/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22"
|
|
6
6
|
},
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"test:coverage:ci": "vitest --coverage --reporter=verbose",
|
|
50
50
|
"test:run": "vitest run",
|
|
51
51
|
"test:pact": "vitest run --config vitest.pact.config.ts",
|
|
52
|
+
"test:drift": "node scripts/drift-verify.mjs",
|
|
53
|
+
"drift:generate": "node scripts/drift-generate-definition.mjs && biome format --write src/pactflow/drift",
|
|
52
54
|
"coverage:check": "vitest --coverage --reporter=verbose",
|
|
53
55
|
"bump": "node scripts/bump.js"
|
|
54
56
|
},
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Drift MCP plugin tests for the PactFlow integration
|
|
2
|
+
|
|
3
|
+
These tests verify the PactFlow tools (and prompt) that this server exposes, using the
|
|
4
|
+
[Drift MCP plugin](https://support.smartbear.com/swagger/contract-testing/docs/en/drift/plugins/mcp-plugin.html).
|
|
5
|
+
They sit alongside the Pact consumer tests (`npm run test:pact`), which cover the
|
|
6
|
+
server's calls to PactFlow APIs; these cover what the server offers to MCP clients.
|
|
7
|
+
|
|
8
|
+
| File | Purpose |
|
|
9
|
+
| --- | --- |
|
|
10
|
+
| `pactflow.mcp.yaml` | The MCP definition (contract) of the PactFlow tools and prompt. **Generated**, do not edit. |
|
|
11
|
+
| `pactflow.testcases.yaml` | Hand-written Drift test cases: the surface check (`drift/all`) and tool calls with content, tool-error and invalid-argument assertions. |
|
|
12
|
+
| `pactflow.tools.testcases.yaml` | **Generated**, do not edit. One call per remaining tool, with arguments built from its input schema, so every PactFlow tool is invoked and its result validated against its `outputSchema`. |
|
|
13
|
+
| `mock-pactflow.mjs` | Minimal mock of the PactFlow API the tools call. |
|
|
14
|
+
| `mock-fixtures.generated.json` | **Generated**, do not edit. Mock response bodies the generated calls assert on. |
|
|
15
|
+
|
|
16
|
+
## Running
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npm install -g @pactflow/drift@2610.0.0 # the version CI pins (DRIFT_VERSION in .github/workflows/drift.yml)
|
|
20
|
+
drift component install mcp --version 2610.0.0 # the MCP plugin is optional and in beta; keep it on the CLI's release
|
|
21
|
+
|
|
22
|
+
npm run build
|
|
23
|
+
export PACT_BROKER_BASE_URL=... PACT_BROKER_TOKEN=... # Drift authenticates with PactFlow
|
|
24
|
+
npm run test:drift
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`scripts/drift-verify.mjs` starts the mock, launches `node dist/index.js` over stdio
|
|
28
|
+
pointed at it, and runs `drift verify` with strict settings: a PactFlow tool or
|
|
29
|
+
description that differs from the definition fails the run.
|
|
30
|
+
|
|
31
|
+
## Publishing to PactFlow
|
|
32
|
+
|
|
33
|
+
CI (`.github/workflows/drift.yml`) publishes the definition and the Drift results as a
|
|
34
|
+
provider contract for `smartbear-mcp` (specification `mcp`) with
|
|
35
|
+
`scripts/ci/drift-publish-provider-contract`, even when the tests fail (the exit code is
|
|
36
|
+
passed through) and then fails the job. Publishing is skipped for forks and Dependabot,
|
|
37
|
+
which have no secrets. To publish by hand:
|
|
38
|
+
|
|
39
|
+
```sh
|
|
40
|
+
npm run test:drift -- --output-dir drift-results --generate-result
|
|
41
|
+
DRIFT_EXIT_CODE=$? GITHUB_SHA=<version> GITHUB_REF_NAME=<branch> \
|
|
42
|
+
scripts/ci/drift-publish-provider-contract # needs PACT_BROKER_BASE_URL / PACT_BROKER_TOKEN
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
PactFlow stores the `mcp` specification as published and does not compare it with consumer
|
|
46
|
+
contracts, so it cannot satisfy a can-i-deploy check; it is available through the API.
|
|
47
|
+
|
|
48
|
+
## When you change a PactFlow tool
|
|
49
|
+
|
|
50
|
+
Rebuild and regenerate the definition and the generated calls, then review the diff:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
npm run build && npm run drift:generate
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Generate it from a clean `npm ci` install: the advertised JSON Schema depends on the installed
|
|
57
|
+
`zod` and MCP SDK versions (a stale `node_modules` once produced a definition that failed in CI).
|
|
58
|
+
|
|
59
|
+
## Adding a test
|
|
60
|
+
|
|
61
|
+
Every tool already gets a generated call that asserts the response content (the mock bodies in `mock-fixtures.generated.json` are built from each tool's `outputSchema`). To assert more about one, add an operation to
|
|
62
|
+
`pactflow.testcases.yaml` (the generator then skips that tool) targeting `pactflow:tool/<tool name>`,
|
|
63
|
+
with inputs under `parameters.arguments`, and add any endpoint it needs to
|
|
64
|
+
`mock-pactflow.mjs` (unknown routes get an empty `200 {}`, so only tools that need
|
|
65
|
+
a specific body or status, such as 204 for deletes, have fixtures). Assert `expected.result.structuredContent` for results or
|
|
66
|
+
`expected.result.isError: true` for tool errors. Drift also validates each result
|
|
67
|
+
against the tool's `outputSchema` automatically.
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
- Running against a real PactFlow tenant instead of the mock? Drift tags operations for tools
|
|
72
|
+
with `destructiveHint: true` as `destructive`, but does not exclude them for you:
|
|
73
|
+
`npm run test:drift -- --tags '!destructive'`.
|
|
74
|
+
- This definition covers the whole PactFlow surface (every tool is invoked), unlike the
|
|
75
|
+
curated 22-tool definition in Drift's own `Examples/smartbear-mcp`, which governs only the
|
|
76
|
+
capabilities an agent is authorised to use.
|
|
77
|
+
- Drift's MCP plugin compares schemas shallowly (top-level `required`, the property names and
|
|
78
|
+
each property's `type`), so a tightened nested constraint is not caught by the surface check.
|
|
79
|
+
`execution.taskSupport` is not modelled. Results are checked against an `outputSchema` only
|
|
80
|
+
when a test invokes the tool, which is why every tool has a call.
|
|
81
|
+
- Invalid arguments come back as a tool error (`isError: true`); the MCP specification puts
|
|
82
|
+
schema violations in the JSON-RPC error channel (`-32602`). The tests assert the observed
|
|
83
|
+
behaviour and say so.
|
|
84
|
+
|
|
85
|
+
- Drift cannot authenticate to an MCP server, so tests use the stdio transport and give the
|
|
86
|
+
server its settings (pointing at the mock) through its own environment only.
|
|
87
|
+
- Drift itself authenticates with PactFlow on every run: set `PACT_BROKER_BASE_URL` and
|
|
88
|
+
`PACT_BROKER_TOKEN` (CI uses the repository secrets) or run `drift auth login` once.
|
|
89
|
+
Without either it stops with "Could not initialise the authentication config".
|
|
90
|
+
- The PactFlow AI tools are advertised only when PactFlow's AI entitlement check succeeds;
|
|
91
|
+
the mock enables it so the definition covers the full surface.
|