@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.
Files changed (117) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +4 -4
  3. package/build/auth/mcp-guard.d.ts.map +1 -1
  4. package/build/auth/mcp-guard.js +1 -1
  5. package/build/auth/mcp-guard.js.map +1 -1
  6. package/build/cache/metrics.js +2 -0
  7. package/build/cache/metrics.js.map +1 -1
  8. package/build/index.js +27 -5
  9. package/build/index.js.map +1 -1
  10. package/build/operations-v2/composites/ci-report.js +3 -5
  11. package/build/operations-v2/composites/ci-report.js.map +1 -1
  12. package/build/operations-v2/composites/regression-run.js +2 -1
  13. package/build/operations-v2/composites/regression-run.js.map +1 -1
  14. package/build/operations-v2/composites/triage-defect.js +5 -7
  15. package/build/operations-v2/composites/triage-defect.js.map +1 -1
  16. package/build/operations-v2/escape/api.js +11 -4
  17. package/build/operations-v2/escape/api.js.map +1 -1
  18. package/build/operations-v2/index.d.ts +1 -0
  19. package/build/operations-v2/index.d.ts.map +1 -1
  20. package/build/operations-v2/index.js +1 -0
  21. package/build/operations-v2/index.js.map +1 -1
  22. package/build/operations-v2/meta/discover.d.ts +5 -4
  23. package/build/operations-v2/meta/discover.d.ts.map +1 -1
  24. package/build/operations-v2/meta/discover.js +13 -32
  25. package/build/operations-v2/meta/discover.js.map +1 -1
  26. package/build/operations-v2/meta/tool-help.d.ts +10 -0
  27. package/build/operations-v2/meta/tool-help.d.ts.map +1 -0
  28. package/build/operations-v2/meta/tool-help.js +42 -0
  29. package/build/operations-v2/meta/tool-help.js.map +1 -0
  30. package/build/operations-v2/qql/index.js +15 -9
  31. package/build/operations-v2/qql/index.js.map +1 -1
  32. package/build/operations-v2/read/get.js +2 -1
  33. package/build/operations-v2/read/get.js.map +1 -1
  34. package/build/operations-v2/read/project-context.js +5 -6
  35. package/build/operations-v2/read/project-context.js.map +1 -1
  36. package/build/operations-v2/write/attachments.js +16 -21
  37. package/build/operations-v2/write/attachments.js.map +1 -1
  38. package/build/operations-v2/write/case-fields.d.ts +26 -215
  39. package/build/operations-v2/write/case-fields.d.ts.map +1 -1
  40. package/build/operations-v2/write/case-fields.js +28 -24
  41. package/build/operations-v2/write/case-fields.js.map +1 -1
  42. package/build/operations-v2/write/cases-bulk.js +2 -1
  43. package/build/operations-v2/write/cases-bulk.js.map +1 -1
  44. package/build/operations-v2/write/cases.js +4 -3
  45. package/build/operations-v2/write/cases.js.map +1 -1
  46. package/build/operations-v2/write/custom-fields.js +13 -10
  47. package/build/operations-v2/write/custom-fields.js.map +1 -1
  48. package/build/operations-v2/write/defects.js +7 -9
  49. package/build/operations-v2/write/defects.js.map +1 -1
  50. package/build/operations-v2/write/environments.js +5 -5
  51. package/build/operations-v2/write/environments.js.map +1 -1
  52. package/build/operations-v2/write/external-issues.js +2 -2
  53. package/build/operations-v2/write/external-issues.js.map +1 -1
  54. package/build/operations-v2/write/milestones.js +6 -6
  55. package/build/operations-v2/write/milestones.js.map +1 -1
  56. package/build/operations-v2/write/plans.js +5 -5
  57. package/build/operations-v2/write/plans.js.map +1 -1
  58. package/build/operations-v2/write/projects.js +6 -6
  59. package/build/operations-v2/write/projects.js.map +1 -1
  60. package/build/operations-v2/write/results.js +7 -12
  61. package/build/operations-v2/write/results.js.map +1 -1
  62. package/build/operations-v2/write/reviews.js +18 -18
  63. package/build/operations-v2/write/reviews.js.map +1 -1
  64. package/build/operations-v2/write/runs.js +8 -6
  65. package/build/operations-v2/write/runs.js.map +1 -1
  66. package/build/operations-v2/write/shared-steps.js +5 -8
  67. package/build/operations-v2/write/shared-steps.js.map +1 -1
  68. package/build/operations-v2/write/suites.js +4 -3
  69. package/build/operations-v2/write/suites.js.map +1 -1
  70. package/build/server-instructions.d.ts +1 -1
  71. package/build/server-instructions.d.ts.map +1 -1
  72. package/build/server-instructions.js +4 -4
  73. package/build/server.d.ts.map +1 -1
  74. package/build/server.js +154 -104
  75. package/build/server.js.map +1 -1
  76. package/build/transports/body-limit.d.ts +9 -17
  77. package/build/transports/body-limit.d.ts.map +1 -1
  78. package/build/transports/body-limit.js +18 -2
  79. package/build/transports/body-limit.js.map +1 -1
  80. package/build/transports/rate-limit.d.ts +1 -1
  81. package/build/transports/rate-limit.js +1 -1
  82. package/build/transports/sse.js +1 -1
  83. package/build/transports/sse.js.map +1 -1
  84. package/build/transports/streamableHttp.d.ts.map +1 -1
  85. package/build/transports/streamableHttp.js +83 -171
  86. package/build/transports/streamableHttp.js.map +1 -1
  87. package/build/utils/auth-context.d.ts +30 -0
  88. package/build/utils/auth-context.d.ts.map +1 -1
  89. package/build/utils/auth-context.js +33 -0
  90. package/build/utils/auth-context.js.map +1 -1
  91. package/build/utils/protocol-telemetry.d.ts +62 -0
  92. package/build/utils/protocol-telemetry.d.ts.map +1 -0
  93. package/build/utils/protocol-telemetry.js +123 -0
  94. package/build/utils/protocol-telemetry.js.map +1 -0
  95. package/build/utils/registry.d.ts +28 -34
  96. package/build/utils/registry.d.ts.map +1 -1
  97. package/build/utils/registry.js +107 -102
  98. package/build/utils/registry.js.map +1 -1
  99. package/build/utils/request-state.d.ts +71 -0
  100. package/build/utils/request-state.d.ts.map +1 -0
  101. package/build/utils/request-state.js +108 -0
  102. package/build/utils/request-state.js.map +1 -0
  103. package/build/utils/server-context.d.ts +53 -16
  104. package/build/utils/server-context.d.ts.map +1 -1
  105. package/build/utils/server-context.js +147 -39
  106. package/build/utils/server-context.js.map +1 -1
  107. package/build/utils/validation.d.ts +12 -25
  108. package/build/utils/validation.d.ts.map +1 -1
  109. package/build/utils/validation.js +2 -2
  110. package/build/utils/validation.js.map +1 -1
  111. package/build/version.d.ts +1 -1
  112. package/build/version.js +1 -1
  113. package/docs/self-run.md +40 -3
  114. package/docs/tools.md +54 -60
  115. package/docs/troubleshooting.md +29 -8
  116. package/package.json +8 -9
  117. package/server.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-telemetry.js","s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,YAAY,CACjB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,OAAO,EACb,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CACpE,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,IAAa,EAAE,OAAgB,EAAE,QAAgB;IACrE,MAAM,GAAG,GAAG,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;IAChE,MAAM,KAAK,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1E,OAAO,GAAG,GAAG,GAAG,KAAK,MAAM,QAAQ,EAAE,CAAC;AACxC,CAAC;AAED,mFAAmF;AACnF,MAAM,eAAe,GAAG,IAAI,cAAc,EAAE,CAAC;AAE7C,2EAA2E;AAC3E,MAAM,UAAU,qBAAqB,CAAC,GAAqB;IACzD,UAAU,EAAE,CAAC,UAAU,CAAC,yBAAyB,EAAE,cAAc,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC,CAAC;AAC3F,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * - Convert Zod schemas to JSON Schema automatically
7
7
  * - Store and retrieve tool handlers
8
8
  * - Manage tool lifecycle
9
- * - Support tool discovery with core/discoverable visibility
9
+ * - Every registered tool is listed; qase_discover_tools is a search over the catalogue
10
10
  */
11
11
  import { Tool, ToolAnnotations } from '@modelcontextprotocol/server';
12
12
  import { z } from 'zod';
@@ -32,8 +32,15 @@ export interface ToolDefinition<T extends z.ZodType = z.ZodType> {
32
32
  annotations?: ToolAnnotations;
33
33
  /** JSON Schema describing the tool's output — enables clients to process results programmatically */
34
34
  outputSchema?: OutputSchema;
35
- /** Tool visibility: 'core' tools are always listed, 'discoverable' tools require activation via qase_discover_tools */
36
- visibility?: 'core' | 'discoverable';
35
+ /**
36
+ * The long documentation, read on demand through qase_tool_help.
37
+ *
38
+ * `description` is sent to the model on every request, so it says what the
39
+ * tool is for and what it costs and stops. Everything else an agent needs
40
+ * before its first call — the traps, the limits, the field semantics — goes
41
+ * here, where it costs nothing until it is asked for.
42
+ */
43
+ help?: string;
37
44
  }
38
45
  /**
39
46
  * Tool Registry Class
@@ -42,22 +49,11 @@ export interface ToolDefinition<T extends z.ZodType = z.ZodType> {
42
49
  export declare class ToolRegistry {
43
50
  private tools;
44
51
  private handlers;
45
- private activeTools;
46
- private toolVisibility;
47
- /**
48
- * Listeners invoked when the active tool set changes (each wired to one
49
- * Server's sendToolListChanged).
50
- *
51
- * A set rather than a single slot because the registry is a process-wide
52
- * singleton while every HTTP session gets its own Server: with one slot each
53
- * new session overwrote the previous one's callback, so only the newest
54
- * session ever heard that discovery had activated a tool.
55
- */
56
- private toolsChangedListeners;
52
+ private help;
57
53
  /**
58
54
  * Register a new tool with the registry
59
55
  *
60
- * @param definition - Tool definition including name, description, schema, handler, and visibility
56
+ * @param definition - Tool definition including name, description, schema and handler
61
57
  *
62
58
  * @example
63
59
  * ```typescript
@@ -67,38 +63,36 @@ export declare class ToolRegistry {
67
63
  * description: 'Get all projects',
68
64
  * schema: z.object({ limit: z.number().optional() }),
69
65
  * handler: async (args) => { ... },
70
- * visibility: 'discoverable', // hidden until discovered
71
66
  * });
72
67
  * ```
73
68
  */
74
69
  register<T extends z.ZodType>(definition: ToolDefinition<T>): void;
75
70
  /**
76
- * Get active tools only (core + activated discoverable)
77
- * Used by the ListToolsRequestSchema handler
71
+ * Every tool, in the shape it takes on the wire. Nothing is hidden: the
72
+ * full list is what a client needs to call any of them, and a client cannot
73
+ * be told about a list that changed on a stateless connection anyway.
78
74
  */
79
75
  getTools(): Tool[];
76
+ /** The long documentation of a tool, or undefined when it has none. */
77
+ getHelp(name: string): string | undefined;
80
78
  /**
81
- * Get ALL registered tools regardless of activation status.
82
- * Used for discovery search and testing.
79
+ * Every tool as it was registered, with nothing projected away.
80
+ *
81
+ * This is what code INSIDE the server reads — search, the category filter,
82
+ * the help index. `getTools()` is for the wire and drops annotation hints
83
+ * that match the spec's own defaults, and one of those defaults is
84
+ * `destructiveHint: true`. Reading the wire shape internally therefore said
85
+ * no tool was destructive: `qase_discover_tools` answered `category:
86
+ * "delete"` with nothing and reported `destructive: false` for every
87
+ * deletion it listed. The two shapes are kept apart by name so that cannot
88
+ * be reintroduced by reaching for whichever accessor is nearest.
83
89
  */
84
- getAllTools(): Tool[];
90
+ getDefinitions(): Tool[];
85
91
  /**
86
92
  * Search tools by name or description (case-insensitive substring match).
87
93
  * Searches the full catalog including inactive tools.
88
94
  */
89
95
  searchTools(query: string): Tool[];
90
- /**
91
- * Subscribe to active-tool-set changes. Returns an unsubscribe function the
92
- * caller must invoke when its session ends, or the listener — and the Server
93
- * it closes over — outlives the connection.
94
- */
95
- subscribeToolsChanged(listener: () => void): () => void;
96
- /**
97
- * Activate tools by name, making them visible in getTools().
98
- * Returns the list of newly activated tool names.
99
- * Notifies every subscriber if any tools were activated.
100
- */
101
- activateTools(names: string[]): string[];
102
96
  /**
103
97
  * Get handler function for a specific tool
104
98
  *
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AAEH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAepE,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC,MAA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AAqB,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,eAK5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAK9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAK9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,eAK9B,CAAC"}
@@ -1,8 +1,37 @@
1
- import { zodToJsonSchema } from 'zod-to-json-schema';
1
+ import { z } from 'zod';
2
2
  /**
3
3
  * Tool definition for registration
4
4
  * Contains all information needed to register a tool with the MCP server
5
5
  */
6
+ /**
7
+ * `Number.MAX_SAFE_INTEGER`, which zod emits as the bound of every integer.
8
+ *
9
+ * It is true — a JSON number above it loses precision in JavaScript — but it
10
+ * is true of every integer everywhere, so repeating it on all 55 integer
11
+ * fields spends bytes in every tool list to tell the model something that
12
+ * never changes and that no caller of ours is anywhere near. Our integers are
13
+ * record IDs and page sizes.
14
+ */
15
+ const SAFE_INTEGER_BOUND = 9007199254740991;
16
+ /** Drop that bound wherever zod attached it, in place. */
17
+ function stripSafeIntegerBounds(node) {
18
+ if (Array.isArray(node)) {
19
+ for (const item of node)
20
+ stripSafeIntegerBounds(item);
21
+ return;
22
+ }
23
+ if (node === null || typeof node !== 'object')
24
+ return;
25
+ const record = node;
26
+ if (record.type === 'integer') {
27
+ if (record.maximum === SAFE_INTEGER_BOUND)
28
+ delete record.maximum;
29
+ if (record.minimum === -SAFE_INTEGER_BOUND)
30
+ delete record.minimum;
31
+ }
32
+ for (const value of Object.values(record))
33
+ stripSafeIntegerBounds(value);
34
+ }
6
35
  /**
7
36
  * Sort by `name`, comparing code units rather than by locale: ListTools and
8
37
  * ListPrompts must come back in the same order on every host.
@@ -12,6 +41,35 @@ function byName(a, b) {
12
41
  return -1;
13
42
  return a.name > b.name ? 1 : 0;
14
43
  }
44
+ /**
45
+ * Annotation hints as the MCP spec defaults them when a tool says nothing.
46
+ * A hint equal to its default carries no information, so the wire projection
47
+ * leaves it out — the client reads exactly the same meaning either way.
48
+ */
49
+ const SPEC_DEFAULT_HINTS = {
50
+ readOnlyHint: false,
51
+ destructiveHint: true,
52
+ idempotentHint: false,
53
+ openWorldHint: true,
54
+ };
55
+ /**
56
+ * The shape a tool takes on the wire, as opposed to the one the registry
57
+ * stores. Every byte of `tools/list` is sent to the model on every request:
58
+ *
59
+ * - hints equal to the spec defaults are dropped (see SPEC_DEFAULT_HINTS);
60
+ * - `outputSchema` is dropped: no client validates results against it, and
61
+ * its one job here — deciding whether to attach `structuredContent` — is
62
+ * now done for every object result (see server.ts).
63
+ *
64
+ * The stored definition keeps both, because handlers and tests read it.
65
+ */
66
+ function toWire(tool) {
67
+ const { outputSchema: _omitted, annotations, ...rest } = tool;
68
+ if (!annotations)
69
+ return rest;
70
+ const kept = Object.fromEntries(Object.entries(annotations).filter(([k, v]) => SPEC_DEFAULT_HINTS[k] !== v));
71
+ return Object.keys(kept).length ? { ...rest, annotations: kept } : rest;
72
+ }
15
73
  /**
16
74
  * Tool Registry Class
17
75
  * Manages the lifecycle of MCP tools with support for dynamic discovery
@@ -19,22 +77,11 @@ function byName(a, b) {
19
77
  export class ToolRegistry {
20
78
  tools = new Map();
21
79
  handlers = new Map();
22
- activeTools = new Set();
23
- toolVisibility = new Map();
24
- /**
25
- * Listeners invoked when the active tool set changes (each wired to one
26
- * Server's sendToolListChanged).
27
- *
28
- * A set rather than a single slot because the registry is a process-wide
29
- * singleton while every HTTP session gets its own Server: with one slot each
30
- * new session overwrote the previous one's callback, so only the newest
31
- * session ever heard that discovery had activated a tool.
32
- */
33
- toolsChangedListeners = new Set();
80
+ help = new Map();
34
81
  /**
35
82
  * Register a new tool with the registry
36
83
  *
37
- * @param definition - Tool definition including name, description, schema, handler, and visibility
84
+ * @param definition - Tool definition including name, description, schema and handler
38
85
  *
39
86
  * @example
40
87
  * ```typescript
@@ -44,41 +91,34 @@ export class ToolRegistry {
44
91
  * description: 'Get all projects',
45
92
  * schema: z.object({ limit: z.number().optional() }),
46
93
  * handler: async (args) => { ... },
47
- * visibility: 'discoverable', // hidden until discovered
48
94
  * });
49
95
  * ```
50
96
  */
51
97
  register(definition) {
52
- const { name, title, description, schema, handler, annotations, outputSchema } = definition;
53
- const visibility = definition.visibility ?? 'core';
54
- // Convert Zod schema to JSON Schema for MCP protocol
55
- // Using explicit type assertion to avoid TypeScript's deep type inference issues
56
- // The zodToJsonSchema function can cause "excessively deep" type errors with complex schemas
57
- // We cast both the input and output to avoid deep type inference
98
+ const { name, title, description, schema, handler, annotations, outputSchema, help } = definition;
99
+ // Convert the Zod schema to JSON Schema for the MCP protocol.
100
+ //
101
+ // `io: 'input'` is what the client is being described: a field with a
102
+ // default is optional on the way in, and a `z.preprocess` is advertised by
103
+ // what it accepts rather than by what it produces.
104
+ //
105
+ // zod emits `$defs` + `$ref` for a schema that refers to itself (the test
106
+ // step tree). That is the only way to express recursion in JSON Schema at
107
+ // all, and the pointers are same-document, which every JSON Schema
108
+ // implementation resolves.
109
+ //
110
+ // Cast through `unknown`: the conversion is value-level, and letting
111
+ // TypeScript infer it across our deepest schemas trips "excessively deep".
58
112
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
59
- const jsonSchema = zodToJsonSchema(schema, {
60
- name: `${name}Input`,
61
- $refStrategy: 'none', // Inline all definitions
62
- });
63
- // Extract the actual schema from definitions if present
64
- // zodToJsonSchema sometimes wraps the schema in a $ref even with $refStrategy: 'none'
65
- let inputSchema;
66
- if (jsonSchema.$ref && jsonSchema.definitions) {
67
- // Extract from definitions
68
- const definitionKey = Object.keys(jsonSchema.definitions)[0];
69
- inputSchema = jsonSchema.definitions[definitionKey];
70
- }
71
- else if (jsonSchema.type === 'object') {
72
- // Use directly
73
- inputSchema = jsonSchema;
74
- }
75
- else {
76
- // Fallback: create minimal object schema
77
- inputSchema = {
78
- type: 'object',
79
- properties: {},
80
- };
81
- }
113
+ const converted = z.toJSONSchema(schema, { io: 'input' });
114
+ // `$schema` says which dialect the document is written in. The tool list
115
+ // repeats it in all 42 schemas and no client reads it, so it is dropped —
116
+ // the MCP spec already fixes the dialect for `inputSchema`.
117
+ const { $schema: _dialect, ...body } = converted;
118
+ stripSafeIntegerBounds(body);
119
+ const inputSchema = body.type === 'object'
120
+ ? body
121
+ : { type: 'object', properties: {} };
82
122
  // Store tool definition
83
123
  this.tools.set(name, {
84
124
  name,
@@ -90,28 +130,36 @@ export class ToolRegistry {
90
130
  });
91
131
  // Store handler function
92
132
  this.handlers.set(name, handler);
93
- // Track visibility and activation
94
- this.toolVisibility.set(name, visibility);
95
- if (visibility === 'core') {
96
- this.activeTools.add(name);
97
- }
133
+ if (help)
134
+ this.help.set(name, help);
98
135
  // Log registration for debugging (to stderr)
99
- console.error(`[Registry] Registered tool: ${name} (${visibility})`);
136
+ console.error(`[Registry] Registered tool: ${name}`);
100
137
  }
101
138
  /**
102
- * Get active tools only (core + activated discoverable)
103
- * Used by the ListToolsRequestSchema handler
139
+ * Every tool, in the shape it takes on the wire. Nothing is hidden: the
140
+ * full list is what a client needs to call any of them, and a client cannot
141
+ * be told about a list that changed on a stateless connection anyway.
104
142
  */
105
143
  getTools() {
106
- return Array.from(this.tools.values())
107
- .filter((t) => this.activeTools.has(t.name))
108
- .sort(byName);
144
+ return this.getDefinitions().map(toWire);
145
+ }
146
+ /** The long documentation of a tool, or undefined when it has none. */
147
+ getHelp(name) {
148
+ return this.help.get(name);
109
149
  }
110
150
  /**
111
- * Get ALL registered tools regardless of activation status.
112
- * Used for discovery search and testing.
151
+ * Every tool as it was registered, with nothing projected away.
152
+ *
153
+ * This is what code INSIDE the server reads — search, the category filter,
154
+ * the help index. `getTools()` is for the wire and drops annotation hints
155
+ * that match the spec's own defaults, and one of those defaults is
156
+ * `destructiveHint: true`. Reading the wire shape internally therefore said
157
+ * no tool was destructive: `qase_discover_tools` answered `category:
158
+ * "delete"` with nothing and reported `destructive: false` for every
159
+ * deletion it listed. The two shapes are kept apart by name so that cannot
160
+ * be reintroduced by reaching for whichever accessor is nearest.
113
161
  */
114
- getAllTools() {
162
+ getDefinitions() {
115
163
  return Array.from(this.tools.values()).sort(byName);
116
164
  }
117
165
  /**
@@ -126,49 +174,11 @@ export class ToolRegistry {
126
174
  const words = query.toLowerCase().split(/\s+/).filter(Boolean);
127
175
  if (words.length === 0)
128
176
  return [];
129
- return this.getAllTools().filter((t) => {
177
+ return this.getDefinitions().filter((t) => {
130
178
  const haystack = `${t.name} ${t.description ?? ''}`.toLowerCase();
131
179
  return words.every((word) => haystack.includes(word));
132
180
  });
133
181
  }
134
- /**
135
- * Subscribe to active-tool-set changes. Returns an unsubscribe function the
136
- * caller must invoke when its session ends, or the listener — and the Server
137
- * it closes over — outlives the connection.
138
- */
139
- subscribeToolsChanged(listener) {
140
- this.toolsChangedListeners.add(listener);
141
- return () => {
142
- this.toolsChangedListeners.delete(listener);
143
- };
144
- }
145
- /**
146
- * Activate tools by name, making them visible in getTools().
147
- * Returns the list of newly activated tool names.
148
- * Notifies every subscriber if any tools were activated.
149
- */
150
- activateTools(names) {
151
- const newlyActivated = [];
152
- for (const name of names) {
153
- if (this.tools.has(name) && !this.activeTools.has(name)) {
154
- this.activeTools.add(name);
155
- newlyActivated.push(name);
156
- }
157
- }
158
- if (newlyActivated.length > 0) {
159
- for (const listener of this.toolsChangedListeners) {
160
- // One dead session's transport must not swallow the notification for
161
- // every session subscribed after it.
162
- try {
163
- listener();
164
- }
165
- catch (err) {
166
- console.error('[Registry] Tool-list-changed listener failed:', err);
167
- }
168
- }
169
- }
170
- return newlyActivated;
171
- }
172
182
  /**
173
183
  * Get handler function for a specific tool
174
184
  *
@@ -209,8 +219,6 @@ export class ToolRegistry {
209
219
  unregister(name) {
210
220
  const hadTool = this.tools.delete(name);
211
221
  this.handlers.delete(name);
212
- this.activeTools.delete(name);
213
- this.toolVisibility.delete(name);
214
222
  return hadTool;
215
223
  }
216
224
  /**
@@ -221,9 +229,6 @@ export class ToolRegistry {
221
229
  clear() {
222
230
  this.tools.clear();
223
231
  this.handlers.clear();
224
- this.activeTools.clear();
225
- this.toolVisibility.clear();
226
- this.toolsChangedListeners.clear();
227
232
  }
228
233
  }
229
234
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/utils/registry.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AASrD;;;GAGG;AACH;;;GAGG;AACH,SAAS,MAAM,CAAC,CAAmB,EAAE,CAAmB;IACtD,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI;QAAE,OAAO,CAAC,CAAC,CAAC;IAC/B,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC;AAwBD;;;GAGG;AACH,MAAM,OAAO,YAAY;IACf,KAAK,GAAsB,IAAI,GAAG,EAAE,CAAC;IACrC,QAAQ,GAA6B,IAAI,GAAG,EAAE,CAAC;IAC/C,WAAW,GAAgB,IAAI,GAAG,EAAE,CAAC;IACrC,cAAc,GAAyC,IAAI,GAAG,EAAE,CAAC;IAEzE;;;;;;;;OAQG;IACK,qBAAqB,GAAoB,IAAI,GAAG,EAAE,CAAC;IAE3D;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAsB,UAA6B;QACzD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;QAC5F,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,IAAI,MAAM,CAAC;QAEnD,qDAAqD;QACrD,iFAAiF;QACjF,6FAA6F;QAC7F,iEAAiE;QACjE,8DAA8D;QAC9D,MAAM,UAAU,GAAI,eAAuB,CAAC,MAAM,EAAE;YAClD,IAAI,EAAE,GAAG,IAAI,OAAO;YACpB,YAAY,EAAE,MAAM,EAAE,yBAAyB;SAChD,CAAC,CAAC;QAEH,wDAAwD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AC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAoB;IAC7C,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACpB,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Multi-round-trip request state.
3
+ *
4
+ * A destructive confirmation now spans two requests: the first returns an
5
+ * input-required result, the second carries the answer. Nothing on the server
6
+ * remembers the first one — the only thing that connects them is the opaque
7
+ * `requestState` string the client echoes back.
8
+ */
9
+ import type { RequestStateCodec } from '@modelcontextprotocol/server';
10
+ /** What a pending destructive confirmation carries across the round trip. */
11
+ export interface ConfirmationState {
12
+ /** The tool the confirmation was issued for; an answer only counts for it. */
13
+ tool: string;
14
+ /**
15
+ * Digest of the arguments the human was shown.
16
+ *
17
+ * The tool name alone does not say WHAT was confirmed. Without this, an
18
+ * accepted `qase_case_delete {code:'TEST', id:1}` could be echoed back
19
+ * unchanged against `{code:'PROD', id:999}` for the whole lifetime of the
20
+ * state — same caller, same tool, valid signature — and the second case
21
+ * would be deleted with nobody asked. The client here is the agent, and
22
+ * stopping exactly that is what this gate is for.
23
+ */
24
+ arguments: string;
25
+ }
26
+ /**
27
+ * How long a confirmation stays answerable.
28
+ *
29
+ * This is a human's thinking time, not a protocol timeout: the prompt is in
30
+ * front of a person deciding whether to delete something. Ten minutes is long
31
+ * enough to read the arguments, check them elsewhere and come back, and short
32
+ * enough that an answer given before lunch is not still spendable after it.
33
+ * It is the SDK's own default, stated here because it is a policy decision
34
+ * rather than an implementation detail.
35
+ */
36
+ export declare const CONFIRMATION_TTL_SECONDS = 600;
37
+ /**
38
+ * Digest of a call's arguments, for pinning a confirmation to the exact call
39
+ * the human saw.
40
+ *
41
+ * Canonical: keys are sorted at every depth, so `{a:1,b:2}` and `{b:2,a:1}`
42
+ * agree — the same call written two ways is the same call, and a client that
43
+ * re-serialises its arguments between rounds must not be told its answer no
44
+ * longer counts. Array order is preserved, because it is part of the value.
45
+ */
46
+ export declare function digestArguments(args: Record<string, unknown>): string;
47
+ /**
48
+ * requestState round-trips through the client, so it comes back as
49
+ * attacker-controlled input and has to be integrity-checked. The SDK does not
50
+ * do that for us — this is the HMAC layer it expects.
51
+ *
52
+ * The key must be the same on every replica that might receive the echoed
53
+ * value. Without one we generate a random key and say so: a single replica
54
+ * keeps working, a multi-replica deployment would reject its own second round.
55
+ *
56
+ * `bind` ties a minted confirmation to the caller and the method, so a
57
+ * confirmation issued to one authenticated user cannot be replayed by another
58
+ * — the spec's user-binding requirement for state that gates authorization.
59
+ * The binding value never reaches the wire; the codec stores a keyed tag.
60
+ * The caller identity comes from `subjectFromContext` (auth-context.ts) — the
61
+ * same derivation tool activation uses — so a caller with no OAuth `sub` is
62
+ * bound by their per-request token digest rather than collapsing onto one
63
+ * shared, empty binding for everyone.
64
+ */
65
+ export declare function createRequestStateCodecFromEnv(env?: typeof process.env): RequestStateCodec<ConfirmationState>;
66
+ /**
67
+ * Lazy for the same reason as the event bus and the activation store:
68
+ * importing the module must not build anything and must not write to stderr.
69
+ */
70
+ export declare function getRequestStateCodec(): RequestStateCodec<ConfirmationState>;
71
+ //# sourceMappingURL=request-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-state.d.ts","sourceRoot":"","sources":["../../src/utils/request-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAiB,MAAM,8BAA8B,CAAC;AAGrF,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;;OASG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AA4B5C;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAIrE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,8BAA8B,CAC5C,GAAG,GAAE,OAAO,OAAO,CAAC,GAAiB,GACpC,iBAAiB,CAAC,iBAAiB,CAAC,CAmBtC;AAKD;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAAC,iBAAiB,CAAC,CAG3E"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Multi-round-trip request state.
3
+ *
4
+ * A destructive confirmation now spans two requests: the first returns an
5
+ * input-required result, the second carries the answer. Nothing on the server
6
+ * remembers the first one — the only thing that connects them is the opaque
7
+ * `requestState` string the client echoes back.
8
+ */
9
+ import { createHash, randomBytes } from 'node:crypto';
10
+ import { createRequestStateCodec } from '@modelcontextprotocol/server';
11
+ import { subjectFromContext } from './auth-context.js';
12
+ const MIN_KEY_BYTES = 32;
13
+ /**
14
+ * How long a confirmation stays answerable.
15
+ *
16
+ * This is a human's thinking time, not a protocol timeout: the prompt is in
17
+ * front of a person deciding whether to delete something. Ten minutes is long
18
+ * enough to read the arguments, check them elsewhere and come back, and short
19
+ * enough that an answer given before lunch is not still spendable after it.
20
+ * It is the SDK's own default, stated here because it is a policy decision
21
+ * rather than an implementation detail.
22
+ */
23
+ export const CONFIRMATION_TTL_SECONDS = 600;
24
+ /**
25
+ * Order two keys by code unit, NOT by `localeCompare`.
26
+ *
27
+ * This ordering feeds a digest that two replicas must agree on, and
28
+ * `localeCompare` depends on the runtime's locale data — it could order the
29
+ * same two keys differently on two machines and refuse a confirmation the
30
+ * user actually gave.
31
+ */
32
+ function byCodeUnit(a, b) {
33
+ if (a < b)
34
+ return -1;
35
+ if (a > b)
36
+ return 1;
37
+ return 0;
38
+ }
39
+ /** Recursively sort object keys so two spellings of one value serialise alike. */
40
+ function canonicalize(value) {
41
+ if (Array.isArray(value))
42
+ return value.map(canonicalize);
43
+ if (value === null || typeof value !== 'object')
44
+ return value;
45
+ const source = value;
46
+ return Object.fromEntries(Object.keys(source)
47
+ .sort(byCodeUnit)
48
+ .map((key) => [key, canonicalize(source[key])]));
49
+ }
50
+ /**
51
+ * Digest of a call's arguments, for pinning a confirmation to the exact call
52
+ * the human saw.
53
+ *
54
+ * Canonical: keys are sorted at every depth, so `{a:1,b:2}` and `{b:2,a:1}`
55
+ * agree — the same call written two ways is the same call, and a client that
56
+ * re-serialises its arguments between rounds must not be told its answer no
57
+ * longer counts. Array order is preserved, because it is part of the value.
58
+ */
59
+ export function digestArguments(args) {
60
+ return createHash('sha256')
61
+ .update(JSON.stringify(canonicalize(args)))
62
+ .digest('hex');
63
+ }
64
+ /**
65
+ * requestState round-trips through the client, so it comes back as
66
+ * attacker-controlled input and has to be integrity-checked. The SDK does not
67
+ * do that for us — this is the HMAC layer it expects.
68
+ *
69
+ * The key must be the same on every replica that might receive the echoed
70
+ * value. Without one we generate a random key and say so: a single replica
71
+ * keeps working, a multi-replica deployment would reject its own second round.
72
+ *
73
+ * `bind` ties a minted confirmation to the caller and the method, so a
74
+ * confirmation issued to one authenticated user cannot be replayed by another
75
+ * — the spec's user-binding requirement for state that gates authorization.
76
+ * The binding value never reaches the wire; the codec stores a keyed tag.
77
+ * The caller identity comes from `subjectFromContext` (auth-context.ts) — the
78
+ * same derivation tool activation uses — so a caller with no OAuth `sub` is
79
+ * bound by their per-request token digest rather than collapsing onto one
80
+ * shared, empty binding for everyone.
81
+ */
82
+ export function createRequestStateCodecFromEnv(env = process.env) {
83
+ const configured = env.QASE_MCP_REQUEST_STATE_KEY;
84
+ if (configured !== undefined && Buffer.byteLength(configured) < MIN_KEY_BYTES) {
85
+ throw new Error(`QASE_MCP_REQUEST_STATE_KEY must be at least ${MIN_KEY_BYTES} bytes; got ${Buffer.byteLength(configured)}.`);
86
+ }
87
+ if (!configured) {
88
+ console.error('[RequestState] QASE_MCP_REQUEST_STATE_KEY is not set — generating a per-process key. ' +
89
+ 'Multi-round-trip confirmations will fail across replicas; set the variable to a shared ' +
90
+ 'value of at least 32 bytes before running more than one.');
91
+ }
92
+ return createRequestStateCodec({
93
+ key: configured ?? randomBytes(MIN_KEY_BYTES),
94
+ ttlSeconds: CONFIRMATION_TTL_SECONDS,
95
+ bind: (ctx) => `${ctx.mcpReq.method}\0${subjectFromContext(ctx)}`,
96
+ });
97
+ }
98
+ /** The one codec this process mints and verifies with, built on first use. */
99
+ let processCodec;
100
+ /**
101
+ * Lazy for the same reason as the event bus and the activation store:
102
+ * importing the module must not build anything and must not write to stderr.
103
+ */
104
+ export function getRequestStateCodec() {
105
+ processCodec ??= createRequestStateCodecFromEnv();
106
+ return processCodec;
107
+ }
108
+ //# sourceMappingURL=request-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-state.js","sourceRoot":"","sources":["../../src/utils/request-state.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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