@qase/mcp-server 2.7.5 → 3.0.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/CHANGELOG.md +46 -0
- package/README.md +4 -4
- package/build/auth/mcp-guard.d.ts.map +1 -1
- package/build/auth/mcp-guard.js +1 -1
- package/build/auth/mcp-guard.js.map +1 -1
- package/build/cache/metrics.js +2 -0
- package/build/cache/metrics.js.map +1 -1
- package/build/index.js +27 -5
- package/build/index.js.map +1 -1
- package/build/operations-v2/composites/ci-report.js +3 -5
- package/build/operations-v2/composites/ci-report.js.map +1 -1
- package/build/operations-v2/composites/regression-run.js +2 -1
- package/build/operations-v2/composites/regression-run.js.map +1 -1
- package/build/operations-v2/composites/triage-defect.js +5 -7
- package/build/operations-v2/composites/triage-defect.js.map +1 -1
- package/build/operations-v2/escape/api.js +11 -4
- package/build/operations-v2/escape/api.js.map +1 -1
- package/build/operations-v2/index.d.ts +1 -0
- package/build/operations-v2/index.d.ts.map +1 -1
- package/build/operations-v2/index.js +1 -0
- package/build/operations-v2/index.js.map +1 -1
- package/build/operations-v2/meta/discover.d.ts +5 -4
- package/build/operations-v2/meta/discover.d.ts.map +1 -1
- package/build/operations-v2/meta/discover.js +13 -32
- package/build/operations-v2/meta/discover.js.map +1 -1
- package/build/operations-v2/meta/tool-help.d.ts +10 -0
- package/build/operations-v2/meta/tool-help.d.ts.map +1 -0
- package/build/operations-v2/meta/tool-help.js +42 -0
- package/build/operations-v2/meta/tool-help.js.map +1 -0
- package/build/operations-v2/qql/index.js +15 -9
- package/build/operations-v2/qql/index.js.map +1 -1
- package/build/operations-v2/read/get.js +2 -1
- package/build/operations-v2/read/get.js.map +1 -1
- package/build/operations-v2/read/project-context.js +5 -6
- package/build/operations-v2/read/project-context.js.map +1 -1
- package/build/operations-v2/write/attachments.js +16 -21
- package/build/operations-v2/write/attachments.js.map +1 -1
- package/build/operations-v2/write/case-fields.d.ts +26 -215
- package/build/operations-v2/write/case-fields.d.ts.map +1 -1
- package/build/operations-v2/write/case-fields.js +28 -24
- package/build/operations-v2/write/case-fields.js.map +1 -1
- package/build/operations-v2/write/cases-bulk.js +2 -1
- package/build/operations-v2/write/cases-bulk.js.map +1 -1
- package/build/operations-v2/write/cases.js +4 -3
- package/build/operations-v2/write/cases.js.map +1 -1
- package/build/operations-v2/write/custom-fields.js +13 -10
- package/build/operations-v2/write/custom-fields.js.map +1 -1
- package/build/operations-v2/write/defects.js +7 -9
- package/build/operations-v2/write/defects.js.map +1 -1
- package/build/operations-v2/write/environments.js +5 -5
- package/build/operations-v2/write/environments.js.map +1 -1
- package/build/operations-v2/write/external-issues.js +2 -2
- package/build/operations-v2/write/external-issues.js.map +1 -1
- package/build/operations-v2/write/milestones.js +6 -6
- package/build/operations-v2/write/milestones.js.map +1 -1
- package/build/operations-v2/write/plans.js +5 -5
- package/build/operations-v2/write/plans.js.map +1 -1
- package/build/operations-v2/write/projects.js +6 -6
- package/build/operations-v2/write/projects.js.map +1 -1
- package/build/operations-v2/write/results.js +7 -12
- package/build/operations-v2/write/results.js.map +1 -1
- package/build/operations-v2/write/reviews.js +18 -18
- package/build/operations-v2/write/reviews.js.map +1 -1
- package/build/operations-v2/write/runs.js +8 -6
- package/build/operations-v2/write/runs.js.map +1 -1
- package/build/operations-v2/write/shared-steps.js +5 -8
- package/build/operations-v2/write/shared-steps.js.map +1 -1
- package/build/operations-v2/write/suites.js +4 -3
- package/build/operations-v2/write/suites.js.map +1 -1
- package/build/server-instructions.d.ts +1 -1
- package/build/server-instructions.d.ts.map +1 -1
- package/build/server-instructions.js +4 -4
- package/build/server.d.ts.map +1 -1
- package/build/server.js +154 -104
- package/build/server.js.map +1 -1
- package/build/transports/body-limit.d.ts +9 -17
- package/build/transports/body-limit.d.ts.map +1 -1
- package/build/transports/body-limit.js +18 -2
- package/build/transports/body-limit.js.map +1 -1
- package/build/transports/rate-limit.d.ts +1 -1
- package/build/transports/rate-limit.js +1 -1
- package/build/transports/sse.js +1 -1
- package/build/transports/sse.js.map +1 -1
- package/build/transports/streamableHttp.d.ts.map +1 -1
- package/build/transports/streamableHttp.js +83 -171
- package/build/transports/streamableHttp.js.map +1 -1
- package/build/utils/auth-context.d.ts +30 -0
- package/build/utils/auth-context.d.ts.map +1 -1
- package/build/utils/auth-context.js +33 -0
- package/build/utils/auth-context.js.map +1 -1
- package/build/utils/protocol-telemetry.d.ts +62 -0
- package/build/utils/protocol-telemetry.d.ts.map +1 -0
- package/build/utils/protocol-telemetry.js +123 -0
- package/build/utils/protocol-telemetry.js.map +1 -0
- package/build/utils/registry.d.ts +28 -34
- package/build/utils/registry.d.ts.map +1 -1
- package/build/utils/registry.js +107 -102
- package/build/utils/registry.js.map +1 -1
- package/build/utils/request-state.d.ts +71 -0
- package/build/utils/request-state.d.ts.map +1 -0
- package/build/utils/request-state.js +108 -0
- package/build/utils/request-state.js.map +1 -0
- package/build/utils/server-context.d.ts +53 -16
- package/build/utils/server-context.d.ts.map +1 -1
- package/build/utils/server-context.js +147 -39
- package/build/utils/server-context.js.map +1 -1
- package/build/utils/validation.d.ts +12 -25
- package/build/utils/validation.d.ts.map +1 -1
- package/build/utils/validation.js +2 -2
- package/build/utils/validation.js.map +1 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/docs/self-run.md +40 -3
- package/docs/tools.md +54 -60
- package/docs/troubleshooting.md +29 -8
- package/package.json +8 -9
- package/server.json +2 -2
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server Context
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Per-request context for code that sits too far below a request handler to be
|
|
5
|
+
* passed it, carried through AsyncLocalStorage the same way auth-context.ts
|
|
6
|
+
* carries the caller's subject.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* Two stores live here: the MCP `Server` instance (for server-level features)
|
|
9
|
+
* and the handler's own `ServerContext`, which is what the destructive-action
|
|
10
|
+
* gate needs — it reads the retry's answers, the verified request state, and
|
|
11
|
+
* the protocol era off it.
|
|
9
12
|
*/
|
|
10
13
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
11
|
-
import type { Server,
|
|
14
|
+
import type { InputRequiredResult, Server, ServerContext } from '@modelcontextprotocol/server';
|
|
12
15
|
/**
|
|
13
16
|
* Per-request server storage.
|
|
14
17
|
* Holds the Server instance for the current request context.
|
|
@@ -19,14 +22,45 @@ export declare const serverStorage: AsyncLocalStorage<Server>;
|
|
|
19
22
|
* Returns undefined if called outside of a serverStorage.run() scope.
|
|
20
23
|
*/
|
|
21
24
|
export declare function getServer(): Server | undefined;
|
|
25
|
+
/** Per-request handler context, for code too far below the handler to be passed it. */
|
|
26
|
+
export declare const requestContextStorage: AsyncLocalStorage<ServerContext>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the current request's handler context.
|
|
29
|
+
* Returns undefined if called outside of a requestContextStorage.run() scope.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getRequestContext(): ServerContext | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Thrown by the destructive-action gate to hand an input-required result up to
|
|
34
|
+
* the `tools/call` handler.
|
|
35
|
+
*
|
|
36
|
+
* Multi-round-trip works by RETURNING the request, but the gate is called from
|
|
37
|
+
* inside plain tool handlers (`(args) => Promise<R>`) several frames below the
|
|
38
|
+
* handler that does the returning — see src/operations-v2/escape/api.ts. An
|
|
39
|
+
* exception is the only way up that does not change every handler's signature.
|
|
40
|
+
*/
|
|
41
|
+
export declare class InputRequiredSignal extends Error {
|
|
42
|
+
readonly result: InputRequiredResult;
|
|
43
|
+
constructor(result: InputRequiredResult);
|
|
44
|
+
}
|
|
22
45
|
/** Why a destructive action was refused. */
|
|
23
46
|
export type RefusalReason =
|
|
24
|
-
/** The client
|
|
47
|
+
/** The client speaks an era on which this server cannot ask at all. */
|
|
25
48
|
'unsupported'
|
|
26
|
-
/** The
|
|
49
|
+
/** The client speaks the right era but never said it can show a prompt. */
|
|
50
|
+
| 'incapable'
|
|
51
|
+
/** The prompt was sent but no usable answer came back for this action. */
|
|
27
52
|
| 'undeliverable'
|
|
28
53
|
/** The human saw the prompt and said no. */
|
|
29
|
-
| 'declined'
|
|
54
|
+
| 'declined'
|
|
55
|
+
/**
|
|
56
|
+
* The client dropped the prompt instead of answering it.
|
|
57
|
+
*
|
|
58
|
+
* Kept apart from `declined` deliberately. Reporting a cancel as a refusal
|
|
59
|
+
* tells somebody they said no to a question they were never shown — which
|
|
60
|
+
* is exactly how this reached us: a tester was told they had declined a run
|
|
61
|
+
* deletion they had never been asked about.
|
|
62
|
+
*/
|
|
63
|
+
| 'cancelled';
|
|
30
64
|
/** Outcome of the destructive-action gate. */
|
|
31
65
|
export type DestructiveConfirmation = {
|
|
32
66
|
allowed: true;
|
|
@@ -35,17 +69,20 @@ export type DestructiveConfirmation = {
|
|
|
35
69
|
reason: RefusalReason;
|
|
36
70
|
};
|
|
37
71
|
/**
|
|
38
|
-
* Ask the user to confirm a destructive action
|
|
72
|
+
* Ask the user to confirm a destructive action, across a round trip.
|
|
39
73
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
74
|
+
* On the first round there is no answer, so the gate signals an input-required
|
|
75
|
+
* result and the `tools/call` handler returns it; the client collects the
|
|
76
|
+
* answer and retries the same call carrying it. On the retry the answer is
|
|
77
|
+
* read straight off the request.
|
|
43
78
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
79
|
+
* Fail-closed: the action proceeds only on an explicit accept whose signed
|
|
80
|
+
* state names this very call — this tool, with these arguments. No request
|
|
81
|
+
* context, a client on a protocol revision this server cannot ask, a decline,
|
|
82
|
+
* a cancel, an answer belonging to some other confirmation — all refuse, and
|
|
83
|
+
* name the reason so the caller can say what happened.
|
|
47
84
|
*/
|
|
48
|
-
export declare function confirmDestructiveAction(toolName: string, args: Record<string, unknown
|
|
85
|
+
export declare function confirmDestructiveAction(toolName: string, args: Record<string, unknown>): Promise<DestructiveConfirmation>;
|
|
49
86
|
/** Human-readable explanation for a refused destructive action. */
|
|
50
87
|
export declare function describeRefusal(toolName: string, reason: RefusalReason): string;
|
|
51
88
|
//# sourceMappingURL=server-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-context.d.ts","sourceRoot":"","sources":["../../src/utils/server-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server-context.d.ts","sourceRoot":"","sources":["../../src/utils/server-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMhD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG/F;;;GAGG;AACH,eAAO,MAAM,aAAa,2BAAkC,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAED,uFAAuF;AACvF,eAAO,MAAM,qBAAqB,kCAAyC,CAAC;AAE5E;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,GAAG,SAAS,CAE7D;AAKD;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAChC,QAAQ,CAAC,MAAM,EAAE,mBAAmB;gBAA3B,MAAM,EAAE,mBAAmB;CAIjD;AAED,4CAA4C;AAC5C,MAAM,MAAM,aAAa;AACvB,uEAAuE;AACrE,aAAa;AACf,2EAA2E;GACzE,WAAW;AACb,0EAA0E;GACxE,eAAe;AACjB,4CAA4C;GAC1C,UAAU;AACZ;;;;;;;GAOG;GACD,WAAW,CAAC;AAEhB,8CAA8C;AAC9C,MAAM,MAAM,uBAAuB,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC;AAkBpG;;;;;;;;;;;;;GAaG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,uBAAuB,CAAC,CA6ElC;AAED,mEAAmE;AACnE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,CAoC/E"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Server Context
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Per-request context for code that sits too far below a request handler to be
|
|
5
|
+
* passed it, carried through AsyncLocalStorage the same way auth-context.ts
|
|
6
|
+
* carries the caller's subject.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
8
|
+
* Two stores live here: the MCP `Server` instance (for server-level features)
|
|
9
|
+
* and the handler's own `ServerContext`, which is what the destructive-action
|
|
10
|
+
* gate needs — it reads the retry's answers, the verified request state, and
|
|
11
|
+
* the protocol era off it.
|
|
9
12
|
*/
|
|
10
13
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
14
|
+
import { CLIENT_CAPABILITIES_META_KEY, inputRequired, inputResponse, } from '@modelcontextprotocol/server';
|
|
15
|
+
import { digestArguments, getRequestStateCodec } from './request-state.js';
|
|
11
16
|
/**
|
|
12
17
|
* Per-request server storage.
|
|
13
18
|
* Holds the Server instance for the current request context.
|
|
@@ -20,59 +25,162 @@ export const serverStorage = new AsyncLocalStorage();
|
|
|
20
25
|
export function getServer() {
|
|
21
26
|
return serverStorage.getStore();
|
|
22
27
|
}
|
|
28
|
+
/** Per-request handler context, for code too far below the handler to be passed it. */
|
|
29
|
+
export const requestContextStorage = new AsyncLocalStorage();
|
|
30
|
+
/**
|
|
31
|
+
* Get the current request's handler context.
|
|
32
|
+
* Returns undefined if called outside of a requestContextStorage.run() scope.
|
|
33
|
+
*/
|
|
34
|
+
export function getRequestContext() {
|
|
35
|
+
return requestContextStorage.getStore();
|
|
36
|
+
}
|
|
37
|
+
/** The key the confirmation request and its answer are correlated by. */
|
|
38
|
+
const CONFIRM_KEY = 'confirm';
|
|
39
|
+
/**
|
|
40
|
+
* Thrown by the destructive-action gate to hand an input-required result up to
|
|
41
|
+
* the `tools/call` handler.
|
|
42
|
+
*
|
|
43
|
+
* Multi-round-trip works by RETURNING the request, but the gate is called from
|
|
44
|
+
* inside plain tool handlers (`(args) => Promise<R>`) several frames below the
|
|
45
|
+
* handler that does the returning — see src/operations-v2/escape/api.ts. An
|
|
46
|
+
* exception is the only way up that does not change every handler's signature.
|
|
47
|
+
*/
|
|
48
|
+
export class InputRequiredSignal extends Error {
|
|
49
|
+
result;
|
|
50
|
+
constructor(result) {
|
|
51
|
+
super('input required');
|
|
52
|
+
this.result = result;
|
|
53
|
+
this.name = 'InputRequiredSignal';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
23
56
|
const REFUSED_UNSUPPORTED = { allowed: false, reason: 'unsupported' };
|
|
57
|
+
const REFUSED_INCAPABLE = { allowed: false, reason: 'incapable' };
|
|
24
58
|
/**
|
|
25
|
-
*
|
|
59
|
+
* Whether a 2026 request's own envelope says the client can be shown a form.
|
|
26
60
|
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
61
|
+
* The capability is per request, not per connection: the SDK refuses to send
|
|
62
|
+
* an input request a client never declared it can handle, and does so by
|
|
63
|
+
* throwing. Reading the same declaration ourselves turns that into an answer
|
|
64
|
+
* the caller can act on instead of an exception from inside the transport.
|
|
65
|
+
*/
|
|
66
|
+
function clientCanBeAsked(envelope) {
|
|
67
|
+
const declared = envelope[CLIENT_CAPABILITIES_META_KEY];
|
|
68
|
+
return declared?.elicitation !== undefined;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Ask the user to confirm a destructive action, across a round trip.
|
|
30
72
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
73
|
+
* On the first round there is no answer, so the gate signals an input-required
|
|
74
|
+
* result and the `tools/call` handler returns it; the client collects the
|
|
75
|
+
* answer and retries the same call carrying it. On the retry the answer is
|
|
76
|
+
* read straight off the request.
|
|
77
|
+
*
|
|
78
|
+
* Fail-closed: the action proceeds only on an explicit accept whose signed
|
|
79
|
+
* state names this very call — this tool, with these arguments. No request
|
|
80
|
+
* context, a client on a protocol revision this server cannot ask, a decline,
|
|
81
|
+
* a cancel, an answer belonging to some other confirmation — all refuse, and
|
|
82
|
+
* name the reason so the caller can say what happened.
|
|
34
83
|
*/
|
|
35
|
-
export async function confirmDestructiveAction(toolName, args
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
38
|
-
return REFUSED_UNSUPPORTED;
|
|
39
|
-
// Check if the client supports elicitation
|
|
40
|
-
const caps = server.getClientCapabilities();
|
|
41
|
-
if (!caps?.elicitation)
|
|
84
|
+
export async function confirmDestructiveAction(toolName, args) {
|
|
85
|
+
const ctx = getRequestContext();
|
|
86
|
+
if (!ctx)
|
|
42
87
|
return REFUSED_UNSUPPORTED;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
88
|
+
// Round two: the client came back with an answer. `inputResponse` is what
|
|
89
|
+
// separates a refusal from a missing answer — `acceptedContent` reads both
|
|
90
|
+
// as "nothing", which would send a decline round the loop again until it hit
|
|
91
|
+
// the client's maxRounds.
|
|
92
|
+
const answer = inputResponse(ctx.mcpReq.inputResponses, CONFIRM_KEY);
|
|
93
|
+
if (answer.kind === 'elicit') {
|
|
94
|
+
// The state was already verified by the seam before this handler ran — it
|
|
95
|
+
// is this process's own, for this caller, unexpired. What is left is that
|
|
96
|
+
// the answer belongs to THIS call: the same tool, and the same arguments
|
|
97
|
+
// the human was shown. Neither alone is enough. Without the tool, one
|
|
98
|
+
// confirmation would open every destructive tool; without the arguments,
|
|
99
|
+
// one confirmed deletion would authorise every other deletion by the same
|
|
100
|
+
// tool until the state expired.
|
|
101
|
+
//
|
|
102
|
+
// A plain string comparison, not `timingSafeEqual`: both operands are
|
|
103
|
+
// public values derived from arguments the caller itself sent, and the one
|
|
104
|
+
// from the wire is already integrity-proven, so there is no secret for a
|
|
105
|
+
// timing difference to leak. `timingSafeEqual` would also throw on a
|
|
106
|
+
// length mismatch, which is a shape this has to answer rather than crash.
|
|
107
|
+
const state = ctx.mcpReq.requestState();
|
|
108
|
+
if (state?.tool !== toolName || state.arguments !== digestArguments(args)) {
|
|
109
|
+
// Not a decline: the human never saw these arguments, so nobody said no
|
|
110
|
+
// — and nobody said yes either. Unconfirmed, nothing deleted.
|
|
111
|
+
return { allowed: false, reason: 'undeliverable' };
|
|
112
|
+
}
|
|
113
|
+
if (answer.action === 'accept')
|
|
114
|
+
return { allowed: true };
|
|
115
|
+
// `cancel` is the client dropping the question, `decline` is a person
|
|
116
|
+
// answering it. Only one of them is somebody saying no.
|
|
117
|
+
return { allowed: false, reason: answer.action === 'cancel' ? 'cancelled' : 'declined' };
|
|
118
|
+
}
|
|
119
|
+
// Round one. A 2025-era request carries no per-request envelope. On a
|
|
120
|
+
// stateless leg that is the end of it: the per-request instance never saw an
|
|
121
|
+
// `initialize`, so nothing says the client could answer and there is no
|
|
122
|
+
// connection to ask on — refuse, do not ask.
|
|
123
|
+
//
|
|
124
|
+
// A legacy connection that is still stateful (the SSE transport, and a stdio
|
|
125
|
+
// connection that negotiated 2025) is the exception: that instance DID see
|
|
126
|
+
// `initialize`, and the SDK's own legacy shim fulfils the same
|
|
127
|
+
// input-required return by sending a real `elicitation/create` on it and
|
|
128
|
+
// re-entering this handler with the answer. Declared capabilities are what
|
|
129
|
+
// the shim's gate consults, so they are what decides here too.
|
|
130
|
+
const envelope = ctx.mcpReq.envelope;
|
|
131
|
+
if (envelope === undefined) {
|
|
132
|
+
if (!getServer()?.getClientCapabilities()?.elicitation)
|
|
133
|
+
return REFUSED_UNSUPPORTED;
|
|
57
134
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
console.error('[Server] Elicitation failed, refusing destructive action:', error);
|
|
61
|
-
return { allowed: false, reason: 'undeliverable' };
|
|
135
|
+
else if (!clientCanBeAsked(envelope)) {
|
|
136
|
+
return REFUSED_INCAPABLE;
|
|
62
137
|
}
|
|
138
|
+
const argsPreview = Object.entries(args)
|
|
139
|
+
.map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`)
|
|
140
|
+
.join('\n');
|
|
141
|
+
throw new InputRequiredSignal(inputRequired({
|
|
142
|
+
inputRequests: {
|
|
143
|
+
[CONFIRM_KEY]: inputRequired.elicit({
|
|
144
|
+
message: `Confirm destructive action: ${toolName}\n\n${argsPreview}\n\n` +
|
|
145
|
+
'This permanently deletes the resource and cannot be undone.',
|
|
146
|
+
// No fields to fill in: accepting the prompt is the confirmation, and
|
|
147
|
+
// the client's own decline button is the refusal. A checkbox on top of
|
|
148
|
+
// that only produced false refusals — people accepted the dialog and
|
|
149
|
+
// left the box at its default.
|
|
150
|
+
requestedSchema: { type: 'object', properties: {} },
|
|
151
|
+
}),
|
|
152
|
+
},
|
|
153
|
+
requestState: await getRequestStateCodec().mint({ tool: toolName, arguments: digestArguments(args) }, ctx),
|
|
154
|
+
}));
|
|
63
155
|
}
|
|
64
156
|
/** Human-readable explanation for a refused destructive action. */
|
|
65
157
|
export function describeRefusal(toolName, reason) {
|
|
66
158
|
switch (reason) {
|
|
67
159
|
case 'unsupported':
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
160
|
+
// Two ways out, not one. A 2025-era client CAN be asked — over a
|
|
161
|
+
// long-lived connection, through elicitation — but only if it says it
|
|
162
|
+
// supports it; naming just the protocol upgrade sends people looking
|
|
163
|
+
// for a new client when a capability would do. Claude Desktop, measured
|
|
164
|
+
// on the wire, offers neither: it negotiates 2025-11-25 and declares no
|
|
165
|
+
// elicitation, so for it the UI really is the answer.
|
|
166
|
+
return (`Refused "${toolName}": destructive actions need confirmation, and this client cannot be ` +
|
|
167
|
+
`asked for one — it speaks MCP 2025-11-25 and does not support elicitation. Use a client ` +
|
|
168
|
+
`that negotiates 2026-07-28, or one that supports elicitation over stdio, or delete it ` +
|
|
169
|
+
`in the Qase UI.`);
|
|
71
170
|
case 'undeliverable':
|
|
72
171
|
return (`Refused "${toolName}": the confirmation prompt was not answered, so the action ` +
|
|
73
172
|
`was not confirmed. Nothing was deleted. Retry and answer the prompt.`);
|
|
173
|
+
case 'incapable':
|
|
174
|
+
return (`Refused "${toolName}": destructive actions need confirmation, and this client did not ` +
|
|
175
|
+
`declare that it can show one, so there is nowhere to ask. Use a client that supports ` +
|
|
176
|
+
`confirmation prompts, or delete it in the Qase UI.`);
|
|
74
177
|
case 'declined':
|
|
75
178
|
return `Action "${toolName}" declined by the user. Nothing was deleted.`;
|
|
179
|
+
case 'cancelled':
|
|
180
|
+
return (`Action "${toolName}" was not confirmed: the client cancelled the confirmation request ` +
|
|
181
|
+
`instead of answering it. Nothing was deleted. If you were never shown a prompt, the ` +
|
|
182
|
+
`client received the request and dropped it — check that it supports confirmation ` +
|
|
183
|
+
`prompts, or delete it in the Qase UI.`);
|
|
76
184
|
}
|
|
77
185
|
}
|
|
78
186
|
//# sourceMappingURL=server-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-context.js","sourceRoot":"","sources":["../../src/utils/server-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"server-context.js","sourceRoot":"","sources":["../../src/utils/server-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,4BAA4B,EAC5B,aAAa,EACb,aAAa,GACd,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,eAAe,EAAE,oBAAoB,E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;YAClB,OAAO,CACL,YAAY,QAAQ,6DAA6D;gBACjF,sEAAsE,CACvE,CAAC;QACJ,KAAK,WAAW;YACd,OAAO,CACL,YAAY,QAAQ,oEAAoE;gBACxF,uFAAuF;gBACvF,oDAAoD,CACrD,CAAC;QACJ,KAAK,UAAU;YACb,OAAO,WAAW,QAAQ,8CAA8C,CAAC;QAC3E,KAAK,WAAW;YACd,OAAO,CACL,WAAW,QAAQ,qEAAqE;gBACxF,sFAAsF;gBACtF,mFAAmF;gBACnF,uCAAuC,CACxC,CAAC;IACN,CAAC;AACH,CAAC"}
|
|
@@ -14,13 +14,7 @@ import { z } from 'zod';
|
|
|
14
14
|
export declare const PaginationSchema: z.ZodObject<{
|
|
15
15
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
16
16
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
},
|
|
18
|
-
limit?: number | undefined;
|
|
19
|
-
offset?: number | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
limit?: number | undefined;
|
|
22
|
-
offset?: number | undefined;
|
|
23
|
-
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
24
18
|
/**
|
|
25
19
|
* Schema for Qase project codes
|
|
26
20
|
* Format: 2-10 uppercase letters, numbers, or underscores
|
|
@@ -42,7 +36,11 @@ export declare const HashSchema: z.ZodString;
|
|
|
42
36
|
/**
|
|
43
37
|
* Schema for filtering by entity status
|
|
44
38
|
*/
|
|
45
|
-
export declare const StatusFilterSchema: z.ZodOptional<z.ZodEnum<
|
|
39
|
+
export declare const StatusFilterSchema: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
active: "active";
|
|
41
|
+
archived: "archived";
|
|
42
|
+
deleted: "deleted";
|
|
43
|
+
}>>;
|
|
46
44
|
/**
|
|
47
45
|
* Helper function to merge a schema with pagination parameters
|
|
48
46
|
*
|
|
@@ -56,16 +54,13 @@ export declare const StatusFilterSchema: z.ZodOptional<z.ZodEnum<["active", "arc
|
|
|
56
54
|
* });
|
|
57
55
|
* ```
|
|
58
56
|
*/
|
|
59
|
-
export declare function withPagination<T extends z.ZodRawShape>(schema: T): z.ZodObject<
|
|
57
|
+
export declare function withPagination<T extends z.ZodRawShape>(schema: T): z.ZodObject<(keyof T & ("limit" | "offset") extends never ? { -readonly [P in keyof T]: T[P]; } & {
|
|
60
58
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
61
59
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
62
|
-
}
|
|
60
|
+
} : { [K in keyof { -readonly [P in keyof T]: T[P]; } as K extends "limit" | "offset" ? never : K]: { -readonly [P in keyof T]: T[P]; }[K]; } & {
|
|
63
61
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
64
62
|
offset: z.ZodOptional<z.ZodNumber>;
|
|
65
|
-
}
|
|
66
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
67
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
68
|
-
}>> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
63
|
+
}) extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.core.$strip>;
|
|
69
64
|
/**
|
|
70
65
|
* Helper function to add project code to a schema
|
|
71
66
|
*
|
|
@@ -82,11 +77,7 @@ export declare function withPagination<T extends z.ZodRawShape>(schema: T): z.Zo
|
|
|
82
77
|
*/
|
|
83
78
|
export declare function withProjectCode<T extends z.ZodRawShape>(schema: T): z.ZodObject<{
|
|
84
79
|
code: z.ZodString;
|
|
85
|
-
} & T
|
|
86
|
-
code: z.ZodString;
|
|
87
|
-
} & T>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
|
|
88
|
-
code: z.ZodString;
|
|
89
|
-
} & T> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
|
|
80
|
+
} & T extends infer T_1 ? { -readonly [P in keyof T_1]: T_1[P]; } : never, z.core.$strip>;
|
|
90
81
|
/**
|
|
91
82
|
* Helper function to make all fields in a schema optional
|
|
92
83
|
*
|
|
@@ -94,12 +85,8 @@ export declare function withProjectCode<T extends z.ZodRawShape>(schema: T): z.Z
|
|
|
94
85
|
* @returns Schema with all fields optional
|
|
95
86
|
*/
|
|
96
87
|
export declare function makePartial<T extends z.ZodObject<z.ZodRawShape>>(schema: T): z.ZodObject<{
|
|
97
|
-
[x: string]: z.ZodOptional<z.
|
|
98
|
-
}, z.
|
|
99
|
-
[x: string]: any;
|
|
100
|
-
}, {
|
|
101
|
-
[x: string]: any;
|
|
102
|
-
}>;
|
|
88
|
+
[x: string]: z.ZodOptional<z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
103
90
|
export type Pagination = z.infer<typeof PaginationSchema>;
|
|
104
91
|
export type ProjectCode = z.infer<typeof ProjectCodeSchema>;
|
|
105
92
|
export type EntityId = z.infer<typeof IdSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;iBAc3B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,aAQQ,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,YAAY,4BAAwE,CAAC;AAElG;;GAEG;AACH,eAAO,MAAM,QAAQ,aAAoD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,UAAU,aAAyD,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;GAGO,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;;;;;;6EAEhE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;;0FAKjE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;;kBAE1E;AAGD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -36,7 +36,7 @@ export const ProjectCodeSchema = z
|
|
|
36
36
|
.min(2, 'Project code must be at least 2 characters')
|
|
37
37
|
.max(10, 'Project code must be at most 10 characters')
|
|
38
38
|
.regex(/^[A-Z0-9_]+$/, 'Project code must contain only uppercase letters, numbers, or underscores')
|
|
39
|
-
.describe('Project code
|
|
39
|
+
.describe('Project code, e.g. DEMO');
|
|
40
40
|
/**
|
|
41
41
|
* Schema for search query strings
|
|
42
42
|
*/
|
|
@@ -44,7 +44,7 @@ export const SearchSchema = z.string().min(1).max(255).optional().describe('Sear
|
|
|
44
44
|
/**
|
|
45
45
|
* Schema for entity IDs (positive integers)
|
|
46
46
|
*/
|
|
47
|
-
export const IdSchema = z.number().int().positive().describe('Entity ID
|
|
47
|
+
export const IdSchema = z.number().int().positive().describe('Entity ID');
|
|
48
48
|
/**
|
|
49
49
|
* Schema for hash identifiers (used by some entities like shared steps)
|
|
50
50
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,2DAA2D,CAAC;IACxE,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,QAAQ,CAAC,qDAAqD,CAAC;CACnE,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,EAAE,4CAA4C,CAAC;KACpD,GAAG,CAAC,EAAE,EAAE,4CAA4C,CAAC;KACrD,KAAK,CACJ,cAAc,EACd,2EAA2E,CAC5E;KACA,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,GAAG,CAAC,GAAG,CAAC;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,2DAA2D,CAAC;IACxE,MAAM,EAAE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C;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAA0B,MAAS;IAChE,OAAO,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,iBAAiB;QACvB,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAuC,MAAS;IACzE,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC;AAC1B,CAAC"}
|
package/build/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "3.0.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/build/version.js
CHANGED
package/docs/self-run.md
CHANGED
|
@@ -70,7 +70,34 @@ Rules:
|
|
|
70
70
|
- **The name must be on the allowlist** in [`src/utils/integration-marker.ts`](../src/utils/integration-marker.ts) (`ALLOWED_INTEGRATIONS`). This bounds the cardinality of the analytics dimension, so an unlisted name is ignored entirely and nothing is sent. To add your integration, open a PR adding it to that array.
|
|
71
71
|
- A malformed or unlisted marker is dropped silently; the API call itself still succeeds.
|
|
72
72
|
|
|
73
|
-
Over HTTP transports the marker can also travel per request instead of per process — send an `X-Qase-Integration: <name>/<version>` header, or add `?integration=<name>/<version>` to the MCP endpoint URL
|
|
73
|
+
Over HTTP transports the marker can also travel per request instead of per process — send an `X-Qase-Integration: <name>/<version>` header, or add `?integration=<name>/<version>` to the MCP endpoint URL. The query parameter is the fallback for clients that do not pass custom headers through.
|
|
74
|
+
|
|
75
|
+
On **Streamable HTTP**, the marker is read fresh on every single request: a marker on one call is never attributed to the next. Precedence: request header → query parameter → `QASE_MCP_INTEGRATION`.
|
|
76
|
+
|
|
77
|
+
On the (deprecated) **SSE** transport, the marker is captured once, when the `/sse` stream opens, and reused for every message posted on that stream afterwards — a header sent on an individual `/messages` POST can still override it for that one call, but there is no per-request query-parameter fallback once the stream is open. Precedence there is: request header → the value captured when the stream opened → `QASE_MCP_INTEGRATION`.
|
|
78
|
+
|
|
79
|
+
### Running more than one replica
|
|
80
|
+
|
|
81
|
+
Two pieces of state used to live inside a single process. From 3.0.0 both can be shared, and on a
|
|
82
|
+
multi-replica deployment both **must** be, because there are no sessions any more — consecutive
|
|
83
|
+
requests from the same client land on whichever replica the load balancer picks.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Required when running more than one replica: the HMAC key that signs a pending
|
|
87
|
+
# destructive-action confirmation. At least 32 bytes, identical on every replica.
|
|
88
|
+
QASE_MCP_REQUEST_STATE_KEY=<a shared random string of 32+ bytes>
|
|
89
|
+
|
|
90
|
+
# Optional: share the L2 cache across replicas.
|
|
91
|
+
QASE_MCP_REDIS_URL=redis://host:6379
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`QASE_MCP_REQUEST_STATE_KEY` is what makes a confirmation survive the trip through the client. The
|
|
95
|
+
server asks, the client answers, and the answer comes back carrying server-minted state that is
|
|
96
|
+
verified before anything is deleted. Without a shared key each replica generates its own at startup,
|
|
97
|
+
so a confirmation minted by one replica fails verification on another and the deletion is refused —
|
|
98
|
+
safe, but destructive tools stop working. A single replica needs nothing set.
|
|
99
|
+
|
|
100
|
+
`QASE_MCP_REDIS_URL` is optional: it shares the response cache between replicas so a repeated read is served from Valkey rather than from Qase again.
|
|
74
101
|
|
|
75
102
|
### Custom Domains (Enterprise)
|
|
76
103
|
|
|
@@ -293,7 +320,7 @@ npm run start:stdio
|
|
|
293
320
|
### SSE Transport
|
|
294
321
|
|
|
295
322
|
> **Deprecated.** The SSE transport was deprecated in the MCP specification on
|
|
296
|
-
> 2025-03-26 and will be removed in
|
|
323
|
+
> 2025-03-26 and will be removed in a future release. Use
|
|
297
324
|
> `--transport streamable-http` instead.
|
|
298
325
|
|
|
299
326
|
Server-Sent Events for web-based clients:
|
|
@@ -309,7 +336,7 @@ Clients must send a bearer token — see [Security of network transports](#secur
|
|
|
309
336
|
|
|
310
337
|
### Streamable HTTP Transport
|
|
311
338
|
|
|
312
|
-
Full HTTP-based transport
|
|
339
|
+
Full HTTP-based transport — there is no session; every request is served on its own:
|
|
313
340
|
|
|
314
341
|
```bash
|
|
315
342
|
npm run start:http
|
|
@@ -320,6 +347,8 @@ npm run start:http
|
|
|
320
347
|
|
|
321
348
|
Clients must send a bearer token — see [Security of network transports](#security-of-network-transports).
|
|
322
349
|
|
|
350
|
+
**Deleting anything requires a modern client.** Destructive tools (`qase_case_delete` and the rest) are confirmed through a multi-round-trip exchange: the first call returns a request for input instead of deleting anything, and the client must retry with the answer. That round trip needs capabilities a client declares during `initialize`, which only a client that negotiates the **2026-07-28** revision of MCP provides. A client still on the 2025-11-25 revision — the common case on a stateless HTTP connection — cannot complete it, so its deletion is refused with an explanation naming the two ways out: use a client that negotiates 2026-07-28, or delete in the Qase UI. This is specific to the HTTP transports; stdio and SSE are long-lived connections where confirmation always works, though a stdio client that itself negotiates 2026-07-28 goes through the same round trip rather than the old single-call flow.
|
|
351
|
+
|
|
323
352
|
### Custom Configuration
|
|
324
353
|
|
|
325
354
|
```bash
|
|
@@ -344,6 +373,14 @@ Metrics include:
|
|
|
344
373
|
- `qase_mcp_cache_hits_total` / `qase_mcp_cache_misses_total` - Cache hit/miss rates by tier (l1/l2)
|
|
345
374
|
- `qase_mcp_cache_errors_total` - Cache errors by tier
|
|
346
375
|
- `qase_mcp_circuit_breaker_state` - Redis circuit breaker state (0=closed, 1=half_open, 2=open)
|
|
376
|
+
- `qase_mcp_requests_total` - Requests served, labelled by `protocol` (the revision the client
|
|
377
|
+
negotiated, e.g. `2026-07-28`, or `legacy` for 2025-11-25) and `client` (the client's own name).
|
|
378
|
+
This is what tells you whether anyone still needs the older protocol revision before it is
|
|
379
|
+
dropped. A 2025-era client reaches a stateless HTTP request without ever identifying itself, so
|
|
380
|
+
it is counted as `client="unknown"`; on stdio and SSE the name comes from the connection's
|
|
381
|
+
`initialize`. The number of distinct client names is capped at 20 per process — the label comes
|
|
382
|
+
from the wire, and past the cap everything new is counted as `client="other"`.
|
|
383
|
+
- `qase_mcp_tool_calls_total` - Tool calls by tool name
|
|
347
384
|
|
|
348
385
|
> **Note:** This page covers running the server yourself with your own `QASE_API_TOKEN` (self-run). It does not cover operating the hosted OAuth proxy — that is internal operator documentation, not part of this guide.
|
|
349
386
|
|