@qase/mcp-server 1.1.8 → 2.0.1
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/CHANGELOG.md +38 -0
- package/README.md +75 -542
- package/build/auth/client-context.d.ts +12 -0
- package/build/auth/client-context.d.ts.map +1 -0
- package/build/auth/client-context.js +12 -0
- package/build/auth/client-context.js.map +1 -0
- package/build/auth/jwks-verifier.d.ts +15 -0
- package/build/auth/jwks-verifier.d.ts.map +1 -0
- package/build/auth/jwks-verifier.js +31 -0
- package/build/auth/jwks-verifier.js.map +1 -0
- package/build/auth/mcp-guard.d.ts +15 -0
- package/build/auth/mcp-guard.d.ts.map +1 -0
- package/build/auth/mcp-guard.js +44 -0
- package/build/auth/mcp-guard.js.map +1 -0
- package/build/auth/oauth-config.d.ts +40 -0
- package/build/auth/oauth-config.d.ts.map +1 -0
- package/build/auth/oauth-config.js +34 -0
- package/build/auth/oauth-config.js.map +1 -0
- package/build/auth/proxy-provider.d.ts +31 -0
- package/build/auth/proxy-provider.d.ts.map +1 -0
- package/build/auth/proxy-provider.js +87 -0
- package/build/auth/proxy-provider.js.map +1 -0
- package/build/auth/token-type.d.ts +7 -0
- package/build/auth/token-type.d.ts.map +1 -0
- package/build/auth/token-type.js +10 -0
- package/build/auth/token-type.js.map +1 -0
- package/build/cache/circuit-breaker.d.ts +33 -0
- package/build/cache/circuit-breaker.d.ts.map +1 -0
- package/build/cache/circuit-breaker.js +68 -0
- package/build/cache/circuit-breaker.js.map +1 -0
- package/build/cache/index.d.ts +24 -0
- package/build/cache/index.d.ts.map +1 -0
- package/build/cache/index.js +86 -0
- package/build/cache/index.js.map +1 -0
- package/build/cache/keys.d.ts +25 -0
- package/build/cache/keys.d.ts.map +1 -0
- package/build/cache/keys.js +36 -0
- package/build/cache/keys.js.map +1 -0
- package/build/cache/layered.d.ts +31 -0
- package/build/cache/layered.d.ts.map +1 -0
- package/build/cache/layered.js +88 -0
- package/build/cache/layered.js.map +1 -0
- package/build/cache/memory.d.ts +32 -0
- package/build/cache/memory.d.ts.map +1 -0
- package/build/cache/memory.js +108 -0
- package/build/cache/memory.js.map +1 -0
- package/build/cache/metrics.d.ts +31 -0
- package/build/cache/metrics.d.ts.map +1 -0
- package/build/cache/metrics.js +95 -0
- package/build/cache/metrics.js.map +1 -0
- package/build/cache/prom-format.d.ts +7 -0
- package/build/cache/prom-format.d.ts.map +1 -0
- package/build/cache/prom-format.js +16 -0
- package/build/cache/prom-format.js.map +1 -0
- package/build/cache/redis-bus.d.ts +29 -0
- package/build/cache/redis-bus.d.ts.map +1 -0
- package/build/cache/redis-bus.js +50 -0
- package/build/cache/redis-bus.js.map +1 -0
- package/build/cache/redis.d.ts +32 -0
- package/build/cache/redis.d.ts.map +1 -0
- package/build/cache/redis.js +89 -0
- package/build/cache/redis.js.map +1 -0
- package/build/cache/types.d.ts +38 -0
- package/build/cache/types.d.ts.map +1 -0
- package/build/cache/types.js +2 -0
- package/build/cache/types.js.map +1 -0
- package/build/client/index.d.ts +10 -3
- package/build/client/index.d.ts.map +1 -1
- package/build/client/index.js +75 -50
- package/build/client/index.js.map +1 -1
- package/build/http/agent.d.ts +16 -0
- package/build/http/agent.d.ts.map +1 -0
- package/build/http/agent.js +16 -0
- package/build/http/agent.js.map +1 -0
- package/build/http/dedupe.d.ts +14 -0
- package/build/http/dedupe.d.ts.map +1 -0
- package/build/http/dedupe.js +69 -0
- package/build/http/dedupe.js.map +1 -0
- package/build/http/index.d.ts +6 -0
- package/build/http/index.d.ts.map +1 -0
- package/build/http/index.js +4 -0
- package/build/http/index.js.map +1 -0
- package/build/http/retry.d.ts +18 -0
- package/build/http/retry.d.ts.map +1 -0
- package/build/http/retry.js +52 -0
- package/build/http/retry.js.map +1 -0
- package/build/index.d.ts +1 -18
- package/build/index.d.ts.map +1 -1
- package/build/index.js +95 -63
- package/build/index.js.map +1 -1
- package/build/operations-v2/composites/ci-report.d.ts +2 -0
- package/build/operations-v2/composites/ci-report.d.ts.map +1 -0
- package/build/operations-v2/composites/ci-report.js +99 -0
- package/build/operations-v2/composites/ci-report.js.map +1 -0
- package/build/operations-v2/composites/regression-run.d.ts +2 -0
- package/build/operations-v2/composites/regression-run.d.ts.map +1 -0
- package/build/operations-v2/composites/regression-run.js +81 -0
- package/build/operations-v2/composites/regression-run.js.map +1 -0
- package/build/operations-v2/composites/triage-defect.d.ts +2 -0
- package/build/operations-v2/composites/triage-defect.d.ts.map +1 -0
- package/build/operations-v2/composites/triage-defect.js +67 -0
- package/build/operations-v2/composites/triage-defect.js.map +1 -0
- package/build/operations-v2/escape/api.d.ts +2 -0
- package/build/operations-v2/escape/api.d.ts.map +1 -0
- package/build/operations-v2/escape/api.js +34 -0
- package/build/operations-v2/escape/api.js.map +1 -0
- package/build/operations-v2/index.d.ts +21 -0
- package/build/operations-v2/index.d.ts.map +1 -0
- package/build/operations-v2/index.js +27 -0
- package/build/operations-v2/index.js.map +1 -0
- package/build/operations-v2/meta/discover.d.ts +9 -0
- package/build/operations-v2/meta/discover.d.ts.map +1 -0
- package/build/operations-v2/meta/discover.js +79 -0
- package/build/operations-v2/meta/discover.js.map +1 -0
- package/build/{operations/search.d.ts → operations-v2/qql/index.d.ts} +1 -1
- package/build/operations-v2/qql/index.d.ts.map +1 -0
- package/build/{operations/search.js → operations-v2/qql/index.js} +34 -9
- package/build/operations-v2/qql/index.js.map +1 -0
- package/build/operations-v2/read/get.d.ts +2 -0
- package/build/operations-v2/read/get.d.ts.map +1 -0
- package/build/operations-v2/read/get.js +115 -0
- package/build/operations-v2/read/get.js.map +1 -0
- package/build/operations-v2/read/project-context.d.ts +2 -0
- package/build/operations-v2/read/project-context.d.ts.map +1 -0
- package/build/operations-v2/read/project-context.js +102 -0
- package/build/operations-v2/read/project-context.js.map +1 -0
- package/build/operations-v2/write/attachments.d.ts +2 -0
- package/build/operations-v2/write/attachments.d.ts.map +1 -0
- package/build/operations-v2/write/attachments.js +58 -0
- package/build/operations-v2/write/attachments.js.map +1 -0
- package/build/operations-v2/write/case-fields.d.ts +206 -0
- package/build/operations-v2/write/case-fields.d.ts.map +1 -0
- package/build/operations-v2/write/case-fields.js +79 -0
- package/build/operations-v2/write/case-fields.js.map +1 -0
- package/build/operations-v2/write/cases-bulk.d.ts +2 -0
- package/build/operations-v2/write/cases-bulk.d.ts.map +1 -0
- package/build/operations-v2/write/cases-bulk.js +54 -0
- package/build/operations-v2/write/cases-bulk.js.map +1 -0
- package/build/operations-v2/write/cases.d.ts +2 -0
- package/build/operations-v2/write/cases.d.ts.map +1 -0
- package/build/operations-v2/write/cases.js +52 -0
- package/build/operations-v2/write/cases.js.map +1 -0
- package/build/operations-v2/write/defects.d.ts +2 -0
- package/build/operations-v2/write/defects.d.ts.map +1 -0
- package/build/operations-v2/write/defects.js +81 -0
- package/build/operations-v2/write/defects.js.map +1 -0
- package/build/operations-v2/write/environments.d.ts +2 -0
- package/build/operations-v2/write/environments.d.ts.map +1 -0
- package/build/operations-v2/write/environments.js +56 -0
- package/build/operations-v2/write/environments.js.map +1 -0
- package/build/operations-v2/write/external-issues.d.ts +2 -0
- package/build/operations-v2/write/external-issues.d.ts.map +1 -0
- package/build/operations-v2/write/external-issues.js +96 -0
- package/build/operations-v2/write/external-issues.js.map +1 -0
- package/build/operations-v2/write/milestones.d.ts +2 -0
- package/build/operations-v2/write/milestones.d.ts.map +1 -0
- package/build/operations-v2/write/milestones.js +56 -0
- package/build/operations-v2/write/milestones.js.map +1 -0
- package/build/operations-v2/write/plans.d.ts +2 -0
- package/build/operations-v2/write/plans.d.ts.map +1 -0
- package/build/operations-v2/write/plans.js +55 -0
- package/build/operations-v2/write/plans.js.map +1 -0
- package/build/operations-v2/write/results.d.ts +2 -0
- package/build/operations-v2/write/results.d.ts.map +1 -0
- package/build/operations-v2/write/results.js +72 -0
- package/build/operations-v2/write/results.js.map +1 -0
- package/build/operations-v2/write/runs.d.ts +2 -0
- package/build/operations-v2/write/runs.d.ts.map +1 -0
- package/build/operations-v2/write/runs.js +84 -0
- package/build/operations-v2/write/runs.js.map +1 -0
- package/build/operations-v2/write/shared-steps.d.ts +2 -0
- package/build/operations-v2/write/shared-steps.d.ts.map +1 -0
- package/build/operations-v2/write/shared-steps.js +60 -0
- package/build/operations-v2/write/shared-steps.js.map +1 -0
- package/build/operations-v2/write/suites.d.ts +2 -0
- package/build/operations-v2/write/suites.d.ts.map +1 -0
- package/build/operations-v2/write/suites.js +63 -0
- package/build/operations-v2/write/suites.js.map +1 -0
- package/build/prompts/index.d.ts +31 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +229 -0
- package/build/prompts/index.js.map +1 -0
- package/build/transports/sse.d.ts.map +1 -1
- package/build/transports/sse.js +6 -0
- package/build/transports/sse.js.map +1 -1
- package/build/transports/streamableHttp.d.ts +6 -1
- package/build/transports/streamableHttp.d.ts.map +1 -1
- package/build/transports/streamableHttp.js +128 -16
- package/build/transports/streamableHttp.js.map +1 -1
- package/build/utils/auth-context.d.ts +8 -0
- package/build/utils/auth-context.d.ts.map +1 -1
- package/build/utils/auth-context.js +18 -0
- package/build/utils/auth-context.js.map +1 -1
- package/build/utils/case-enums.d.ts +5 -3
- package/build/utils/case-enums.d.ts.map +1 -1
- package/build/utils/case-enums.js +77 -59
- package/build/utils/case-enums.js.map +1 -1
- package/build/utils/output-schemas.d.ts +16 -0
- package/build/utils/output-schemas.d.ts.map +1 -0
- package/build/utils/output-schemas.js +82 -0
- package/build/utils/output-schemas.js.map +1 -0
- package/build/utils/registry.d.ts +42 -9
- package/build/utils/registry.d.ts.map +1 -1
- package/build/utils/registry.js +64 -11
- package/build/utils/registry.js.map +1 -1
- package/build/utils/response-shape.d.ts +23 -0
- package/build/utils/response-shape.d.ts.map +1 -0
- package/build/utils/response-shape.js +73 -0
- package/build/utils/response-shape.js.map +1 -0
- package/build/utils/rich-response.d.ts +58 -0
- package/build/utils/rich-response.d.ts.map +1 -0
- package/build/utils/rich-response.js +93 -0
- package/build/utils/rich-response.js.map +1 -0
- package/build/utils/server-context.d.ts +65 -0
- package/build/utils/server-context.d.ts.map +1 -0
- package/build/utils/server-context.js +67 -0
- package/build/utils/server-context.js.map +1 -0
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/docs/connect.md +81 -0
- package/docs/migration.md +351 -0
- package/docs/self-run.md +270 -0
- package/docs/tools.md +111 -0
- package/docs/troubleshooting.md +144 -0
- package/package.json +11 -2
- package/server.json +8 -2
- package/build/operations/attachments.d.ts +0 -8
- package/build/operations/attachments.d.ts.map +0 -1
- package/build/operations/attachments.js +0 -146
- package/build/operations/attachments.js.map +0 -1
- package/build/operations/authors.d.ts +0 -8
- package/build/operations/authors.d.ts.map +0 -1
- package/build/operations/authors.js +0 -70
- package/build/operations/authors.js.map +0 -1
- package/build/operations/cases.d.ts +0 -8
- package/build/operations/cases.d.ts.map +0 -1
- package/build/operations/cases.js +0 -370
- package/build/operations/cases.js.map +0 -1
- package/build/operations/configurations.d.ts +0 -10
- package/build/operations/configurations.d.ts.map +0 -1
- package/build/operations/configurations.js +0 -125
- package/build/operations/configurations.js.map +0 -1
- package/build/operations/custom-fields.d.ts +0 -8
- package/build/operations/custom-fields.d.ts.map +0 -1
- package/build/operations/custom-fields.js +0 -172
- package/build/operations/custom-fields.js.map +0 -1
- package/build/operations/defects.d.ts +0 -8
- package/build/operations/defects.d.ts.map +0 -1
- package/build/operations/defects.js +0 -256
- package/build/operations/defects.js.map +0 -1
- package/build/operations/environments.d.ts +0 -8
- package/build/operations/environments.d.ts.map +0 -1
- package/build/operations/environments.js +0 -154
- package/build/operations/environments.js.map +0 -1
- package/build/operations/milestones.d.ts +0 -8
- package/build/operations/milestones.d.ts.map +0 -1
- package/build/operations/milestones.js +0 -155
- package/build/operations/milestones.js.map +0 -1
- package/build/operations/plans.d.ts +0 -8
- package/build/operations/plans.d.ts.map +0 -1
- package/build/operations/plans.js +0 -158
- package/build/operations/plans.js.map +0 -1
- package/build/operations/projects.d.ts +0 -8
- package/build/operations/projects.d.ts.map +0 -1
- package/build/operations/projects.js +0 -192
- package/build/operations/projects.js.map +0 -1
- package/build/operations/results.d.ts +0 -8
- package/build/operations/results.d.ts.map +0 -1
- package/build/operations/results.js +0 -214
- package/build/operations/results.js.map +0 -1
- package/build/operations/runs.d.ts +0 -8
- package/build/operations/runs.d.ts.map +0 -1
- package/build/operations/runs.js +0 -224
- package/build/operations/runs.js.map +0 -1
- package/build/operations/search.d.ts.map +0 -1
- package/build/operations/search.js.map +0 -1
- package/build/operations/shared-parameters.d.ts +0 -10
- package/build/operations/shared-parameters.d.ts.map +0 -1
- package/build/operations/shared-parameters.js +0 -93
- package/build/operations/shared-parameters.js.map +0 -1
- package/build/operations/shared-steps.d.ts +0 -8
- package/build/operations/shared-steps.d.ts.map +0 -1
- package/build/operations/shared-steps.js +0 -160
- package/build/operations/shared-steps.js.map +0 -1
- package/build/operations/suites.d.ts +0 -8
- package/build/operations/suites.d.ts.map +0 -1
- package/build/operations/suites.js +0 -169
- package/build/operations/suites.js.map +0 -1
- package/build/operations/system-fields.d.ts +0 -10
- package/build/operations/system-fields.d.ts.map +0 -1
- package/build/operations/system-fields.js +0 -47
- package/build/operations/system-fields.js.map +0 -1
- package/build/operations/users.d.ts +0 -10
- package/build/operations/users.d.ts.map +0 -1
- package/build/operations/users.js +0 -78
- package/build/operations/users.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursively strip `null`, `undefined`, empty arrays, and empty objects
|
|
3
|
+
* from API responses before sending them to the LLM.
|
|
4
|
+
*
|
|
5
|
+
* Zero, false, and empty strings are preserved — they carry signal (e.g.
|
|
6
|
+
* `"description": ""` is different from missing description when the user
|
|
7
|
+
* asked about it).
|
|
8
|
+
*
|
|
9
|
+
* Returns `undefined` only when the input itself is `null` or `undefined`.
|
|
10
|
+
* For objects that collapse to zero kept fields, returns `{}` (an empty
|
|
11
|
+
* object) — callers should test with `Object.keys(result).length === 0` if
|
|
12
|
+
* they want to detect collapse, not `result === undefined`. Arrays that
|
|
13
|
+
* become empty are returned as `[]`.
|
|
14
|
+
*/
|
|
15
|
+
export function compactResponse(value) {
|
|
16
|
+
if (value === null || value === undefined)
|
|
17
|
+
return undefined;
|
|
18
|
+
if (typeof value !== 'object')
|
|
19
|
+
return value;
|
|
20
|
+
if (Array.isArray(value)) {
|
|
21
|
+
const compactedItems = [];
|
|
22
|
+
for (const item of value) {
|
|
23
|
+
const c = compactResponse(item);
|
|
24
|
+
if (c !== undefined)
|
|
25
|
+
compactedItems.push(c);
|
|
26
|
+
}
|
|
27
|
+
return compactedItems;
|
|
28
|
+
}
|
|
29
|
+
const record = value;
|
|
30
|
+
const out = {};
|
|
31
|
+
let kept = 0;
|
|
32
|
+
for (const key of Object.keys(record)) {
|
|
33
|
+
const c = compactResponse(record[key]);
|
|
34
|
+
if (c === undefined)
|
|
35
|
+
continue;
|
|
36
|
+
if (Array.isArray(c) && c.length === 0)
|
|
37
|
+
continue;
|
|
38
|
+
if (isPlainObject(c) && Object.keys(c).length === 0)
|
|
39
|
+
continue;
|
|
40
|
+
out[key] = c;
|
|
41
|
+
kept += 1;
|
|
42
|
+
}
|
|
43
|
+
return kept === 0 ? {} : out;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Keep only the listed top-level fields on an object, or apply the same
|
|
47
|
+
* projection to each element of an array.
|
|
48
|
+
*
|
|
49
|
+
* Special case: `['*']` returns the input unchanged.
|
|
50
|
+
*/
|
|
51
|
+
export function projectFields(value, fields) {
|
|
52
|
+
if (fields.length === 1 && fields[0] === '*')
|
|
53
|
+
return value;
|
|
54
|
+
if (Array.isArray(value)) {
|
|
55
|
+
return value.map((item) => projectSingle(item, fields));
|
|
56
|
+
}
|
|
57
|
+
return projectSingle(value, fields);
|
|
58
|
+
}
|
|
59
|
+
function projectSingle(obj, fields) {
|
|
60
|
+
if (!isPlainObject(obj))
|
|
61
|
+
return obj;
|
|
62
|
+
const src = obj;
|
|
63
|
+
const out = {};
|
|
64
|
+
for (const f of fields) {
|
|
65
|
+
if (f in src)
|
|
66
|
+
out[f] = src[f];
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
function isPlainObject(v) {
|
|
71
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=response-shape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-shape.js","sourceRoot":"","sources":["../../src/utils/response-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,cAAc,GAAc,EAAE,CAAC;QACrC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,CAAC,KAAK,SAAS;gBAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC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,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Response Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helpers for building multi-block MCP tool responses with audience annotations.
|
|
5
|
+
* Tools that return RichToolResult bypass the default JSON.stringify wrapping
|
|
6
|
+
* and deliver content blocks directly to the client.
|
|
7
|
+
*
|
|
8
|
+
* - summaryBlock: human-readable markdown for the user (audience: ['user'])
|
|
9
|
+
* - dataBlock: structured JSON for the assistant (audience: ['assistant'])
|
|
10
|
+
*/
|
|
11
|
+
/** Symbol marker to distinguish rich results from plain handler returns */
|
|
12
|
+
declare const RICH_MARKER: unique symbol;
|
|
13
|
+
/** A single content block in a rich tool result */
|
|
14
|
+
export interface ContentBlock {
|
|
15
|
+
type: 'text';
|
|
16
|
+
text: string;
|
|
17
|
+
annotations?: {
|
|
18
|
+
audience?: Array<'user' | 'assistant'>;
|
|
19
|
+
priority?: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/** Pre-formatted tool result with multiple content blocks */
|
|
23
|
+
export interface RichToolResult {
|
|
24
|
+
[RICH_MARKER]: true;
|
|
25
|
+
content: ContentBlock[];
|
|
26
|
+
/** Machine-readable data for programmatic processing by MCP clients */
|
|
27
|
+
structuredContent?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Type guard: returns true if the value is a RichToolResult.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isRichResult(value: unknown): value is RichToolResult;
|
|
33
|
+
/**
|
|
34
|
+
* Build a rich tool result from content blocks.
|
|
35
|
+
* @param content - Content blocks for display
|
|
36
|
+
* @param structuredContent - Machine-readable data for programmatic client processing
|
|
37
|
+
*/
|
|
38
|
+
export declare function richResult(content: ContentBlock[], structuredContent?: Record<string, unknown>): RichToolResult;
|
|
39
|
+
/**
|
|
40
|
+
* Create a user-facing summary block (markdown).
|
|
41
|
+
* Shown to the user with highest priority.
|
|
42
|
+
*/
|
|
43
|
+
export declare function summaryBlock(text: string): ContentBlock;
|
|
44
|
+
/**
|
|
45
|
+
* Create an assistant-facing data block (JSON).
|
|
46
|
+
* Consumed by the LLM for further reasoning.
|
|
47
|
+
*/
|
|
48
|
+
export declare function dataBlock(data: unknown): ContentBlock;
|
|
49
|
+
/**
|
|
50
|
+
* Build a markdown table with properly padded columns.
|
|
51
|
+
*
|
|
52
|
+
* @param headers - Column header labels
|
|
53
|
+
* @param rows - Array of row data (same length as headers)
|
|
54
|
+
* @param align - Per-column alignment: 'l' (left, default), 'r' (right), 'c' (center)
|
|
55
|
+
*/
|
|
56
|
+
export declare function markdownTable(headers: string[], rows: string[][], align?: string[]): string;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=rich-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-response.d.ts","sourceRoot":"","sources":["../../src/utils/rich-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,QAAA,MAAM,WAAW,eAAiC,CAAC;AAEnD,mDAAmD;AACnD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE;QACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;QACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,6DAA6D;AAC7D,MAAM,WAAW,cAAc;IAC7B,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;IACpB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAMpE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,YAAY,EAAE,EACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC1C,cAAc,CAMhB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMvD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,CAMrD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAgC3F"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rich Response Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helpers for building multi-block MCP tool responses with audience annotations.
|
|
5
|
+
* Tools that return RichToolResult bypass the default JSON.stringify wrapping
|
|
6
|
+
* and deliver content blocks directly to the client.
|
|
7
|
+
*
|
|
8
|
+
* - summaryBlock: human-readable markdown for the user (audience: ['user'])
|
|
9
|
+
* - dataBlock: structured JSON for the assistant (audience: ['assistant'])
|
|
10
|
+
*/
|
|
11
|
+
/** Symbol marker to distinguish rich results from plain handler returns */
|
|
12
|
+
const RICH_MARKER = Symbol.for('qase.rich_result');
|
|
13
|
+
/**
|
|
14
|
+
* Type guard: returns true if the value is a RichToolResult.
|
|
15
|
+
*/
|
|
16
|
+
export function isRichResult(value) {
|
|
17
|
+
return (typeof value === 'object' &&
|
|
18
|
+
value !== null &&
|
|
19
|
+
value[RICH_MARKER] === true);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Build a rich tool result from content blocks.
|
|
23
|
+
* @param content - Content blocks for display
|
|
24
|
+
* @param structuredContent - Machine-readable data for programmatic client processing
|
|
25
|
+
*/
|
|
26
|
+
export function richResult(content, structuredContent) {
|
|
27
|
+
return {
|
|
28
|
+
[RICH_MARKER]: true,
|
|
29
|
+
content,
|
|
30
|
+
...(structuredContent && { structuredContent }),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a user-facing summary block (markdown).
|
|
35
|
+
* Shown to the user with highest priority.
|
|
36
|
+
*/
|
|
37
|
+
export function summaryBlock(text) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'text',
|
|
40
|
+
text,
|
|
41
|
+
annotations: { audience: ['user'], priority: 1 },
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create an assistant-facing data block (JSON).
|
|
46
|
+
* Consumed by the LLM for further reasoning.
|
|
47
|
+
*/
|
|
48
|
+
export function dataBlock(data) {
|
|
49
|
+
return {
|
|
50
|
+
type: 'text',
|
|
51
|
+
text: JSON.stringify(data),
|
|
52
|
+
annotations: { audience: ['assistant'], priority: 0 },
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build a markdown table with properly padded columns.
|
|
57
|
+
*
|
|
58
|
+
* @param headers - Column header labels
|
|
59
|
+
* @param rows - Array of row data (same length as headers)
|
|
60
|
+
* @param align - Per-column alignment: 'l' (left, default), 'r' (right), 'c' (center)
|
|
61
|
+
*/
|
|
62
|
+
export function markdownTable(headers, rows, align) {
|
|
63
|
+
// Compute max width per column
|
|
64
|
+
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)));
|
|
65
|
+
const pad = (s, w, a) => {
|
|
66
|
+
const gap = w - s.length;
|
|
67
|
+
if (gap <= 0)
|
|
68
|
+
return s;
|
|
69
|
+
if (a === 'r')
|
|
70
|
+
return ' '.repeat(gap) + s;
|
|
71
|
+
if (a === 'c')
|
|
72
|
+
return ' '.repeat(Math.floor(gap / 2)) + s + ' '.repeat(Math.ceil(gap / 2));
|
|
73
|
+
return s + ' '.repeat(gap);
|
|
74
|
+
};
|
|
75
|
+
const aligns = align ?? headers.map(() => 'l');
|
|
76
|
+
const headerRow = '| ' + headers.map((h, i) => pad(h, widths[i], aligns[i])).join(' | ') + ' |';
|
|
77
|
+
const sepRow = '| ' +
|
|
78
|
+
widths
|
|
79
|
+
.map((w, i) => {
|
|
80
|
+
const a = aligns[i];
|
|
81
|
+
const bar = '-'.repeat(w);
|
|
82
|
+
if (a === 'r')
|
|
83
|
+
return bar.slice(0, -1) + ':';
|
|
84
|
+
if (a === 'c')
|
|
85
|
+
return ':' + bar.slice(1, -1) + ':';
|
|
86
|
+
return bar;
|
|
87
|
+
})
|
|
88
|
+
.join(' | ') +
|
|
89
|
+
' |';
|
|
90
|
+
const dataRows = rows.map((r) => '| ' + r.map((c, i) => pad(c ?? '', widths[i], aligns[i])).join(' | ') + ' |');
|
|
91
|
+
return [headerRow, sepRow, ...dataRows].join('\n');
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=rich-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-response.js","sourceRoot":"","sources":["../../src/utils/rich-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2EAA2E;AAC3E,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAoBnD;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACb,KAAiC,CAAC,WAAW,CAAC,KAAK,IAAI,CACzD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CACxB,OAAuB,EACvB,iBAA2C;IAE3C,OAAO;QACL,CAAC,WAAW,CAAC,EAAE,IAAI;QACnB,OAAO;QACP,GAAG,CAAC,iBAAiB,IAAI,EAAE,iBAAiB,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YA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,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CACrF,CAAC;IAEF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Context
|
|
3
|
+
*
|
|
4
|
+
* Provides access to the MCP Server instance within tool handlers
|
|
5
|
+
* via AsyncLocalStorage, following the same pattern as auth-context.ts.
|
|
6
|
+
*
|
|
7
|
+
* This enables features that require server-level access (elicitation,
|
|
8
|
+
* tool list notifications) without passing the server through handler signatures.
|
|
9
|
+
*/
|
|
10
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
11
|
+
import type { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
12
|
+
/**
|
|
13
|
+
* Per-request server storage.
|
|
14
|
+
* Holds the Server instance for the current request context.
|
|
15
|
+
*/
|
|
16
|
+
export declare const serverStorage: AsyncLocalStorage<Server<{
|
|
17
|
+
method: string;
|
|
18
|
+
params?: {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
_meta?: {
|
|
21
|
+
[x: string]: unknown;
|
|
22
|
+
progressToken?: string | number | undefined;
|
|
23
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
24
|
+
taskId: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
method: string;
|
|
30
|
+
params?: {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
_meta?: {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
progressToken?: string | number | undefined;
|
|
35
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
36
|
+
taskId: string;
|
|
37
|
+
} | undefined;
|
|
38
|
+
} | undefined;
|
|
39
|
+
} | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
[x: string]: unknown;
|
|
42
|
+
_meta?: {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
progressToken?: string | number | undefined;
|
|
45
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
46
|
+
taskId: string;
|
|
47
|
+
} | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}>>;
|
|
50
|
+
/**
|
|
51
|
+
* Get the Server instance from the current async context.
|
|
52
|
+
* Returns undefined if called outside of a serverStorage.run() scope.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getServer(): Server | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Ask the user to confirm a destructive action via MCP elicitation.
|
|
57
|
+
*
|
|
58
|
+
* Graceful degradation:
|
|
59
|
+
* - No server in context → proceed (return true)
|
|
60
|
+
* - Client doesn't support elicitation → proceed
|
|
61
|
+
* - elicitInput() throws → proceed (log error)
|
|
62
|
+
* - User declines or cancels → return false
|
|
63
|
+
*/
|
|
64
|
+
export declare function confirmDestructiveAction(toolName: string, args: Record<string, unknown>): Promise<boolean>;
|
|
65
|
+
//# sourceMappingURL=server-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-context.d.ts","sourceRoot":"","sources":["../../src/utils/server-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAkC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAED;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC,CAmClB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server Context
|
|
3
|
+
*
|
|
4
|
+
* Provides access to the MCP Server instance within tool handlers
|
|
5
|
+
* via AsyncLocalStorage, following the same pattern as auth-context.ts.
|
|
6
|
+
*
|
|
7
|
+
* This enables features that require server-level access (elicitation,
|
|
8
|
+
* tool list notifications) without passing the server through handler signatures.
|
|
9
|
+
*/
|
|
10
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
11
|
+
/**
|
|
12
|
+
* Per-request server storage.
|
|
13
|
+
* Holds the Server instance for the current request context.
|
|
14
|
+
*/
|
|
15
|
+
export const serverStorage = new AsyncLocalStorage();
|
|
16
|
+
/**
|
|
17
|
+
* Get the Server instance from the current async context.
|
|
18
|
+
* Returns undefined if called outside of a serverStorage.run() scope.
|
|
19
|
+
*/
|
|
20
|
+
export function getServer() {
|
|
21
|
+
return serverStorage.getStore();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Ask the user to confirm a destructive action via MCP elicitation.
|
|
25
|
+
*
|
|
26
|
+
* Graceful degradation:
|
|
27
|
+
* - No server in context → proceed (return true)
|
|
28
|
+
* - Client doesn't support elicitation → proceed
|
|
29
|
+
* - elicitInput() throws → proceed (log error)
|
|
30
|
+
* - User declines or cancels → return false
|
|
31
|
+
*/
|
|
32
|
+
export async function confirmDestructiveAction(toolName, args) {
|
|
33
|
+
const server = getServer();
|
|
34
|
+
if (!server)
|
|
35
|
+
return true;
|
|
36
|
+
// Check if the client supports elicitation
|
|
37
|
+
const caps = server.getClientCapabilities();
|
|
38
|
+
if (!caps?.elicitation)
|
|
39
|
+
return true;
|
|
40
|
+
try {
|
|
41
|
+
const argsPreview = Object.entries(args)
|
|
42
|
+
.map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`)
|
|
43
|
+
.join('\n');
|
|
44
|
+
const result = await server.elicitInput({
|
|
45
|
+
message: `Confirm destructive action: ${toolName}\n\n${argsPreview}`,
|
|
46
|
+
requestedSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
confirm: {
|
|
50
|
+
type: 'boolean',
|
|
51
|
+
title: 'Confirm deletion',
|
|
52
|
+
description: 'This will permanently delete the resource. Proceed?',
|
|
53
|
+
default: false,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
required: ['confirm'],
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
return result.action === 'accept' && result.content?.confirm === true;
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
// Elicitation failed — graceful degradation: proceed without confirmation
|
|
63
|
+
console.error('[Server] Elicitation failed, proceeding without confirmation:', error);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=server-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-context.js","sourceRoot":"","sources":["../../src/utils/server-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAU,CAAC;AAE7D;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,QAAgB,EAChB,IAA6B;IAE7B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,2CAA2C;IAC3C,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;IAC5C,IAAI,CAAC,IAAI,EAAE,WAAW;QAAE,OAAO,IAAI,CAAC;IAEpC,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;aACrC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/C,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC;YACtC,OAAO,EAAE,+BAA+B,QAAQ,OAAO,WAAW,EAAE;YACpE,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,SAAS;wBACf,KAAK,EAAE,kBAAkB;wBACzB,WAAW,EAAE,qDAAqD;wBAClE,OAAO,EAAE,KAAK;qBACf;iBACF;gBACD,QAAQ,EAAE,CAAC,SAAS,CAAC;aACtB;SACF,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,0EAA0E;QAC1E,OAAO,CAAC,KAAK,CAAC,+DAA+D,EAAE,KAAK,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/build/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "2.0.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/version.js
CHANGED
package/docs/connect.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Connect to the hosted Qase MCP
|
|
2
|
+
|
|
3
|
+
The quickest way to use Qase — no install and no API token. Connect to the Qase-hosted MCP server at `https://mcp.qase.io/mcp` and sign in with your Qase account. Any MCP client that supports remote servers (OAuth 2.1) works; the client handles the OAuth flow for you — Claude, Cursor, Codex, and VS Code are shown below.
|
|
4
|
+
|
|
5
|
+
> **Note:** The hosted Qase MCP is available on the **Enterprise** plan in Qase. On other plans you'll be denied access when connecting — [run the server yourself](self-run.md) with your own API token instead.
|
|
6
|
+
|
|
7
|
+
Prefer to run the server yourself with your own `QASE_API_TOKEN`? See [Self-Run Guide (Local / stdio)](self-run.md).
|
|
8
|
+
|
|
9
|
+
## Claude
|
|
10
|
+
|
|
11
|
+
Qase publishes an official **Qase Test Management** connector in Claude's directory:
|
|
12
|
+
|
|
13
|
+
1. In Claude, open **Settings → Connectors** and find **Qase Test Management**.
|
|
14
|
+
2. Click **Connect** and complete the Qase sign-in when prompted.
|
|
15
|
+
|
|
16
|
+
## Cursor
|
|
17
|
+
|
|
18
|
+
Add the hosted server by URL in `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"qase": {
|
|
24
|
+
"url": "https://mcp.qase.io/mcp"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Cursor opens your browser to sign in to Qase; the tools appear once you've authorized.
|
|
31
|
+
|
|
32
|
+
## Codex
|
|
33
|
+
|
|
34
|
+
**ChatGPT / Codex app** — open **Settings → MCPs → Add server**, enter the URL `https://mcp.qase.io/mcp`, and click **Authenticate**.
|
|
35
|
+
|
|
36
|
+
**Codex CLI** — add to `~/.codex/config.toml`:
|
|
37
|
+
|
|
38
|
+
```toml
|
|
39
|
+
[mcp_servers.qase]
|
|
40
|
+
url = "https://mcp.qase.io/mcp"
|
|
41
|
+
auth = "oauth"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then run `codex mcp login qase` and complete the Qase sign-in in your browser.
|
|
45
|
+
|
|
46
|
+
> **Note:** Enter the URL exactly as shown — without surrounding quotes. A stray quote (or its encoded form, `%22`) in the server URL breaks OAuth; if a connection ever fails to authenticate, remove the server entry and re-add it, typing the URL by hand.
|
|
47
|
+
|
|
48
|
+
## VS Code
|
|
49
|
+
|
|
50
|
+
Add the hosted server to `.vscode/mcp.json` (workspace-scoped):
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"servers": {
|
|
55
|
+
"qase": {
|
|
56
|
+
"type": "http",
|
|
57
|
+
"url": "https://mcp.qase.io/mcp"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Or run **MCP: Add Server** from the Command Palette (`⇧⌘P` / `Ctrl+Shift+P`), choose **HTTP**, and enter the URL. VS Code opens your browser to sign in to Qase; the tools appear once you've authorized.
|
|
64
|
+
|
|
65
|
+
## Other remote clients
|
|
66
|
+
|
|
67
|
+
Any MCP client that supports remote (HTTP) servers with OAuth 2.1 can connect the same way — point it at:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
https://mcp.qase.io/mcp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
In every case the hosted server authenticates via your Qase login (OAuth) — no local installation or `QASE_API_TOKEN` needed.
|
|
74
|
+
|
|
75
|
+
## Active workspace
|
|
76
|
+
|
|
77
|
+
The connector operates on the workspace currently selected in your Qase UI. To work in a different workspace, just switch it in Qase — the connector automatically routes subsequent requests to the newly selected workspace, with no need to reconnect or re-authorize.
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
80
|
+
|
|
81
|
+
Connector not appearing, empty tool list, or OAuth sign-in failing? See [Troubleshooting](troubleshooting.md).
|