@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
package/build/server.js
CHANGED
|
@@ -6,15 +6,18 @@
|
|
|
6
6
|
* transport on import.
|
|
7
7
|
*/
|
|
8
8
|
import { Server, ProtocolError, ProtocolErrorCode } from '@modelcontextprotocol/server';
|
|
9
|
+
import { getMetrics } from './cache/index.js';
|
|
9
10
|
import { toolRegistry } from './utils/registry.js';
|
|
10
11
|
import { formatApiError, ToolExecutionError } from './utils/errors.js';
|
|
11
12
|
import { compactResponse } from './utils/response-shape.js';
|
|
12
13
|
import { isRichResult } from './utils/rich-response.js';
|
|
13
|
-
import { serverStorage, confirmDestructiveAction, describeRefusal, } from './utils/server-context.js';
|
|
14
|
+
import { serverStorage, requestContextStorage, InputRequiredSignal, confirmDestructiveAction, describeRefusal, } from './utils/server-context.js';
|
|
15
|
+
import { getRequestStateCodec } from './utils/request-state.js';
|
|
14
16
|
import { extractCallMarkers } from './utils/call-markers.js';
|
|
15
17
|
import { parseProducerMarker } from './utils/producer-marker.js';
|
|
16
18
|
import { producerStorage } from './utils/producer-context.js';
|
|
17
19
|
import { callIntegrationStorage } from './utils/integration-context.js';
|
|
20
|
+
import { describeCaller, recordProtocolRequest } from './utils/protocol-telemetry.js';
|
|
18
21
|
import { VERSION } from './version.js';
|
|
19
22
|
import { listPrompts, getPrompt } from './prompts/index.js';
|
|
20
23
|
import { SERVER_INSTRUCTIONS } from './server-instructions.js';
|
|
@@ -55,10 +58,27 @@ export function createServer() {
|
|
|
55
58
|
],
|
|
56
59
|
}, {
|
|
57
60
|
capabilities: {
|
|
58
|
-
tools: {
|
|
61
|
+
tools: {},
|
|
59
62
|
prompts: {},
|
|
60
63
|
},
|
|
61
64
|
instructions: SERVER_INSTRUCTIONS,
|
|
65
|
+
// `requestState` is minted by the destructive-action gate and echoed
|
|
66
|
+
// back by the client, so it re-enters as attacker-controlled input. The
|
|
67
|
+
// seam runs this hook before the handler and answers a frozen -32602
|
|
68
|
+
// when it throws, so the handler only ever sees state this process
|
|
69
|
+
// signed, for this caller and this method.
|
|
70
|
+
requestState: { verify: getRequestStateCodec().verify },
|
|
71
|
+
cacheHints: {
|
|
72
|
+
// Same as the SDK default, written down on purpose: the tool list now
|
|
73
|
+
// depends on who is asking, so the day someone makes it cacheable to
|
|
74
|
+
// save a round trip, they have to delete this line and answer for it.
|
|
75
|
+
// A shared cache here would show an agent another caller's tools.
|
|
76
|
+
'tools/list': { ttlMs: 0, cacheScope: 'private' },
|
|
77
|
+
// The prompt catalog is static — the same for every caller, and we
|
|
78
|
+
// declare no prompts.listChanged — so it is the one list worth letting
|
|
79
|
+
// a shared cache hold.
|
|
80
|
+
'prompts/list': { ttlMs: 300_000, cacheScope: 'public' },
|
|
81
|
+
},
|
|
62
82
|
});
|
|
63
83
|
/**
|
|
64
84
|
* Handler: List all available tools
|
|
@@ -66,7 +86,8 @@ export function createServer() {
|
|
|
66
86
|
* Returns all tools registered in the tool registry.
|
|
67
87
|
* Called when the MCP client wants to discover available tools.
|
|
68
88
|
*/
|
|
69
|
-
server.setRequestHandler('tools/list', async (request) => {
|
|
89
|
+
server.setRequestHandler('tools/list', async (request, ctx) => {
|
|
90
|
+
recordProtocolRequest(ctx);
|
|
70
91
|
rejectUnknownCursor(request.params?.cursor);
|
|
71
92
|
const tools = toolRegistry.getTools();
|
|
72
93
|
console.error(`[Server] Listing ${tools.length} tools`);
|
|
@@ -75,7 +96,8 @@ export function createServer() {
|
|
|
75
96
|
/**
|
|
76
97
|
* Handler: List available prompts (workflow templates)
|
|
77
98
|
*/
|
|
78
|
-
server.setRequestHandler('prompts/list', async (request) => {
|
|
99
|
+
server.setRequestHandler('prompts/list', async (request, ctx) => {
|
|
100
|
+
recordProtocolRequest(ctx);
|
|
79
101
|
rejectUnknownCursor(request.params?.cursor);
|
|
80
102
|
const prompts = listPrompts();
|
|
81
103
|
console.error(`[Server] Listing ${prompts.length} prompts`);
|
|
@@ -84,7 +106,8 @@ export function createServer() {
|
|
|
84
106
|
/**
|
|
85
107
|
* Handler: Get a specific prompt with arguments
|
|
86
108
|
*/
|
|
87
|
-
server.setRequestHandler('prompts/get', async (request) => {
|
|
109
|
+
server.setRequestHandler('prompts/get', async (request, ctx) => {
|
|
110
|
+
recordProtocolRequest(ctx);
|
|
88
111
|
const { name, arguments: args } = request.params;
|
|
89
112
|
console.error(`[Server] Getting prompt: ${name}`);
|
|
90
113
|
return getPrompt(name, args);
|
|
@@ -95,120 +118,147 @@ export function createServer() {
|
|
|
95
118
|
* Executes the specified tool with provided arguments.
|
|
96
119
|
*/
|
|
97
120
|
server.setRequestHandler('tools/call', async (request, ctx) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// The
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
recordProtocolRequest(ctx);
|
|
122
|
+
try {
|
|
123
|
+
return await // The handler's context travels via AsyncLocalStorage rather than as
|
|
124
|
+
|
|
125
|
+
// a parameter: the destructive-action gate reads the retry's answers
|
|
126
|
+
// and the verified request state off it, and is called from places
|
|
127
|
+
// with no ctx of their own — see server-context.ts.
|
|
128
|
+
requestContextStorage.run(ctx, () => serverStorage.run(server, async () => {
|
|
129
|
+
const { name, arguments: rawArgs } = request.params;
|
|
130
|
+
// The two hidden attribution arguments never reach a tool handler — see
|
|
131
|
+
// call-markers.ts for why they travel as arguments rather than a header.
|
|
132
|
+
const markers = extractCallMarkers(rawArgs);
|
|
133
|
+
const args = markers.rest;
|
|
134
|
+
console.error(`[Server] Executing tool: ${name}`);
|
|
135
|
+
getMetrics().incCounter('qase_mcp_tool_calls_total', { tool: name });
|
|
136
|
+
const runCall = async () => {
|
|
137
|
+
// Get tool handler from registry
|
|
138
|
+
const handler = toolRegistry.getHandler(name);
|
|
139
|
+
if (!handler) {
|
|
140
|
+
throw new Error(`Unknown tool: ${name}. Use list_tools to see available tools.`);
|
|
141
|
+
}
|
|
142
|
+
// Confirm destructive actions before execution. The gate is
|
|
143
|
+
// fail-closed — an unconfirmed deletion does not happen. On the
|
|
144
|
+
// first round it signals an input-required result instead of
|
|
145
|
+
// returning a verdict; the catch at the bottom of this handler
|
|
146
|
+
// turns that into the call's result.
|
|
147
|
+
const toolDef = toolRegistry.getTool(name);
|
|
148
|
+
if (toolDef?.annotations?.destructiveHint === true) {
|
|
149
|
+
const confirmation = await confirmDestructiveAction(name, args || {});
|
|
150
|
+
if (!confirmation.allowed) {
|
|
151
|
+
// The client is named because the reason alone does not say
|
|
152
|
+
// whose client behaved this way, and `declined` vs `cancelled`
|
|
153
|
+
// is the difference between a person saying no and a client
|
|
154
|
+
// dropping the question — which is what has to be chased.
|
|
155
|
+
console.error(`[Server] Refused destructive tool '${name}': ${confirmation.reason} ` +
|
|
156
|
+
`(client: ${describeCaller(ctx)})`);
|
|
157
|
+
return {
|
|
158
|
+
content: [
|
|
159
|
+
{ type: 'text', text: describeRefusal(name, confirmation.reason) },
|
|
160
|
+
],
|
|
161
|
+
// A decline is the user's decision, not a tool failure; the other
|
|
162
|
+
// reasons are something the caller has to act on.
|
|
163
|
+
...(confirmation.reason !== 'declined' && { isError: true }),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
// Execute the tool handler with provided arguments
|
|
169
|
+
const result = await handler(args || {});
|
|
170
|
+
// Rich results: pass through pre-formatted content blocks directly
|
|
171
|
+
if (isRichResult(result)) {
|
|
172
|
+
return {
|
|
173
|
+
content: result.content,
|
|
174
|
+
...(result.structuredContent && {
|
|
175
|
+
structuredContent: result.structuredContent,
|
|
176
|
+
}),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// Default: wrap in compact JSON text block
|
|
180
|
+
const compacted = compactResponse(result);
|
|
120
181
|
return {
|
|
121
182
|
content: [
|
|
122
|
-
{
|
|
183
|
+
{
|
|
184
|
+
type: 'text',
|
|
185
|
+
text: JSON.stringify(compacted),
|
|
186
|
+
},
|
|
123
187
|
],
|
|
124
|
-
//
|
|
125
|
-
//
|
|
126
|
-
|
|
188
|
+
// Attached for every object result, not only where an
|
|
189
|
+
// outputSchema used to say so: the wire no longer carries
|
|
190
|
+
// outputSchema at all (see registry.ts toWire), and a client
|
|
191
|
+
// that reads structured data gains nothing from its absence.
|
|
192
|
+
...(compacted !== null &&
|
|
193
|
+
typeof compacted === 'object' &&
|
|
194
|
+
!Array.isArray(compacted) && {
|
|
195
|
+
structuredContent: compacted,
|
|
196
|
+
}),
|
|
127
197
|
};
|
|
128
198
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
catch (error) {
|
|
155
|
-
// Handle tool execution errors (expected failures like validation, API errors)
|
|
156
|
-
// These are returned with isError: true so the LLM can understand and recover
|
|
157
|
-
if (error instanceof ToolExecutionError) {
|
|
158
|
-
console.error(`[Server] Tool '${name}' execution error:`, error.message);
|
|
199
|
+
catch (error) {
|
|
200
|
+
// Not a failure: the gate inside a tool handler (qase_api's
|
|
201
|
+
// DELETE branch) is asking for confirmation. Let it past the
|
|
202
|
+
// error mapping below, to the catch that returns it.
|
|
203
|
+
if (error instanceof InputRequiredSignal)
|
|
204
|
+
throw error;
|
|
205
|
+
// Handle tool execution errors (expected failures like validation, API errors)
|
|
206
|
+
// These are returned with isError: true so the LLM can understand and recover
|
|
207
|
+
if (error instanceof ToolExecutionError) {
|
|
208
|
+
console.error(`[Server] Tool '${name}' execution error:`, error.message);
|
|
209
|
+
return {
|
|
210
|
+
content: [
|
|
211
|
+
{
|
|
212
|
+
type: 'text',
|
|
213
|
+
text: error.toUserMessage(),
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
isError: true,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
// Handle unexpected errors (protocol-level failures)
|
|
220
|
+
// Format error message using our error utilities
|
|
221
|
+
const errorMessage = formatApiError(error);
|
|
222
|
+
console.error(`[Server] Tool '${name}' unexpected error:`, errorMessage);
|
|
223
|
+
// Return as tool execution error with isError: true for better LLM recovery
|
|
159
224
|
return {
|
|
160
225
|
content: [
|
|
161
226
|
{
|
|
162
227
|
type: 'text',
|
|
163
|
-
text:
|
|
228
|
+
text: errorMessage,
|
|
164
229
|
},
|
|
165
230
|
],
|
|
166
231
|
isError: true,
|
|
167
232
|
};
|
|
168
233
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return markers.integration
|
|
190
|
-
? callIntegrationStorage.run(markers.integration, withProducer)
|
|
191
|
-
: withProducer();
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
// Wire tool discovery notifications: when tools are activated via qase_discover_tools,
|
|
195
|
-
// notify the client so it re-queries the tool list.
|
|
196
|
-
//
|
|
197
|
-
// Subscribe rather than assign: the registry is a process-wide singleton but
|
|
198
|
-
// createServer runs once per session on the HTTP transports, and a single
|
|
199
|
-
// callback slot meant each new session silently replaced the previous one's
|
|
200
|
-
// — every older session then went unnotified and its client kept calling a
|
|
201
|
-
// tools/list it had cached before discovery ran.
|
|
202
|
-
const unsubscribe = toolRegistry.subscribeToolsChanged(() => {
|
|
203
|
-
server.sendToolListChanged().catch((err) => {
|
|
204
|
-
console.error('[Server] Failed to send tool list changed notification:', err);
|
|
205
|
-
});
|
|
234
|
+
};
|
|
235
|
+
// Both scopes stay open for the whole call, so the outbound interceptor
|
|
236
|
+
// sees them however deep in the handler the API request is made.
|
|
237
|
+
const producer = parseProducerMarker(markers.producer);
|
|
238
|
+
const withProducer = producer ? () => producerStorage.run(producer, runCall) : runCall;
|
|
239
|
+
return markers.integration
|
|
240
|
+
? callIntegrationStorage.run(markers.integration, withProducer)
|
|
241
|
+
: withProducer();
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
// Multi-round-trip: the destructive-action gate does not return a verdict
|
|
246
|
+
// on the first round, it signals a request for confirmation from wherever
|
|
247
|
+
// it was called. This catch sits ABOVE the one that maps errors onto
|
|
248
|
+
// `isError` results, so the request reaches the client as the result of
|
|
249
|
+
// the call rather than as the text of a failure.
|
|
250
|
+
if (error instanceof InputRequiredSignal)
|
|
251
|
+
return error.result;
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
206
254
|
});
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
255
|
+
// Tool-list-changed push notifications used to be wired here through the
|
|
256
|
+
// registry's process-wide listener set (toolRegistry.subscribeToolsChanged),
|
|
257
|
+
// which assumed one activation event visible to every session. Activation
|
|
258
|
+
// is per-caller state now (see src/tools/activation.ts), so that mechanism
|
|
259
|
+
// is gone along with it; the 2026-07-28 era replaces the push with a client
|
|
260
|
+
// pull via `subscriptions/listen` over a `ServerEventBus`, which a later
|
|
261
|
+
// task in this migration wires in.
|
|
212
262
|
return server;
|
|
213
263
|
}
|
|
214
264
|
//# sourceMappingURL=server.js.map
|
package/build/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACL,aAAa,E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/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
* It exists because `qase_attachment_upload` sends file content as base64
|
|
5
|
-
* inside the JSON-RPC body — on a network transport that is the only option,
|
|
6
|
-
* since the server cannot see the caller's filesystem. express defaults to
|
|
7
|
-
* 100kb, which silently capped uploads at roughly 75kb of file while the tool
|
|
8
|
-
* advertised far more.
|
|
3
|
+
* The same cap as `readBodyLimit()`, in bytes.
|
|
9
4
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* the cap: an unlimited body on a public endpoint is a memory-exhaustion knob,
|
|
17
|
-
* so this one does not offer an off switch (unlike the rate limiter, where 0
|
|
18
|
-
* is a legitimate choice for a private deployment).
|
|
5
|
+
* `express.json()` takes the human string; the MCP handler and the Node
|
|
6
|
+
* adapter take a number of bytes and default to 4 MiB of their own. Left at
|
|
7
|
+
* that default they would answer 413 long before express ever saw the body,
|
|
8
|
+
* silently undoing the 10 MB limit release 2.7.5 set for attachment uploads —
|
|
9
|
+
* so both sides are fed from this one function, and a test pins them to each
|
|
10
|
+
* other.
|
|
19
11
|
*/
|
|
20
|
-
export declare function
|
|
12
|
+
export declare function bodyLimitBytes(env?: Record<string, string | undefined>): number;
|
|
21
13
|
//# sourceMappingURL=body-limit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-limit.d.ts","sourceRoot":"","sources":["../../src/transports/body-limit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"body-limit.d.ts","sourceRoot":"","sources":["../../src/transports/body-limit.ts"],"names":[],"mappings":"AA4BA,wBAAgB,aAAa,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,CAE3F;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,MAAM,CAE5F"}
|
|
@@ -19,9 +19,25 @@ const DEFAULT_LIMIT_MB = 10;
|
|
|
19
19
|
* so this one does not offer an off switch (unlike the rate limiter, where 0
|
|
20
20
|
* is a legitimate choice for a private deployment).
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
function readLimitMb(env) {
|
|
23
23
|
const raw = env.QASE_MCP_BODY_LIMIT_MB;
|
|
24
24
|
const parsed = raw !== undefined && /^\d+$/.test(raw) ? Number(raw) : 0;
|
|
25
|
-
return
|
|
25
|
+
return parsed > 0 ? parsed : DEFAULT_LIMIT_MB;
|
|
26
|
+
}
|
|
27
|
+
export function readBodyLimit(env = process.env) {
|
|
28
|
+
return `${readLimitMb(env)}mb`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The same cap as `readBodyLimit()`, in bytes.
|
|
32
|
+
*
|
|
33
|
+
* `express.json()` takes the human string; the MCP handler and the Node
|
|
34
|
+
* adapter take a number of bytes and default to 4 MiB of their own. Left at
|
|
35
|
+
* that default they would answer 413 long before express ever saw the body,
|
|
36
|
+
* silently undoing the 10 MB limit release 2.7.5 set for attachment uploads —
|
|
37
|
+
* so both sides are fed from this one function, and a test pins them to each
|
|
38
|
+
* other.
|
|
39
|
+
*/
|
|
40
|
+
export function bodyLimitBytes(env = process.env) {
|
|
41
|
+
return readLimitMb(env) * 1024 * 1024;
|
|
26
42
|
}
|
|
27
43
|
//# sourceMappingURL=body-limit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"body-limit.js","sourceRoot":"","sources":["../../src/transports/body-limit.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;;;;GAkBG;AACH,
|
|
1
|
+
{"version":3,"file":"body-limit.js","sourceRoot":"","sources":["../../src/transports/body-limit.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,WAAW,CAAC,GAAuC;IAC1D,MAAM,GAAG,GAAG,GAAG,CAAC,sBAAsB,CAAC;IACvC,MAAM,MAAM,GAAG,GAAG,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,MAA0C,OAAO,CAAC,GAAG;IACjF,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC;AACjC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,MAA0C,OAAO,CAAC,GAAG;IAClF,OAAO,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AACxC,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { RequestHandler } from 'express';
|
|
|
4
4
|
*
|
|
5
5
|
* `QASE_MCP_RATE_LIMIT_PER_MINUTE=0` turns the limiter off; anything that is not
|
|
6
6
|
* a non-negative integer falls back to the default rather than failing startup,
|
|
7
|
-
* matching how
|
|
7
|
+
* matching how `QASE_MCP_BODY_LIMIT_MB` is read (src/transports/body-limit.ts).
|
|
8
8
|
*/
|
|
9
9
|
export declare function readRateLimitPerMinute(env?: Record<string, string | undefined>): number;
|
|
10
10
|
/**
|
|
@@ -6,7 +6,7 @@ const WINDOW_MS = 60_000;
|
|
|
6
6
|
*
|
|
7
7
|
* `QASE_MCP_RATE_LIMIT_PER_MINUTE=0` turns the limiter off; anything that is not
|
|
8
8
|
* a non-negative integer falls back to the default rather than failing startup,
|
|
9
|
-
* matching how
|
|
9
|
+
* matching how `QASE_MCP_BODY_LIMIT_MB` is read (src/transports/body-limit.ts).
|
|
10
10
|
*/
|
|
11
11
|
export function readRateLimitPerMinute(env = process.env) {
|
|
12
12
|
const raw = env.QASE_MCP_RATE_LIMIT_PER_MINUTE;
|
package/build/transports/sse.js
CHANGED
|
@@ -83,7 +83,7 @@ export function setupSSETransport(createServer, config) {
|
|
|
83
83
|
console.error(`[SSE] Server listening on http://${host}:${config.port}${sseEndpoint}`);
|
|
84
84
|
console.error(`[SSE] Health check: http://${host}:${config.port}/health`);
|
|
85
85
|
console.error('[SSE] WARNING: the SSE transport is deprecated (MCP spec 2025-03-26) and will be ' +
|
|
86
|
-
'removed in
|
|
86
|
+
'removed in a future release. Use --transport streamable-http instead.');
|
|
87
87
|
});
|
|
88
88
|
// Keep server reference alive (prevent garbage collection), same as streamable-http
|
|
89
89
|
app._httpServer = httpServer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/transports/sse.ts"],"names":[],"mappings":"AAAA,OAAO,OAAoB,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AASpE,yFAAyF;AACzF,SAAS,qBAAqB,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC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CAAC,CAAC,EAAE,CAAC;QACxF,MAAM,WAAW,GACf,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,IAAI,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QAExF,wEAAwE;QACxE,4EAA4E;QAC5E,iCAAiC;QACjC,mBAAmB,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,EAAE,CACzC,kBAAkB,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,CACvC,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CACxD,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,eAAe;IACf,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;QACpD,OAAO,CAAC,KAAK,CAAC,oCAAoC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,WAAW,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,KAAK,CAAC,8BAA8B,IAAI,IAAI,MAAM,CAAC,IAAI,SAAS,CAAC,CAAC;QAC1E,OAAO,CAAC,KAAK,CACX,mFAAmF;YACjF,uEAAuE,CAC1E,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,oFAAoF;IACnF,GAA+C,CAAC,WAAW,GAAG,UAAU,CAAC;IAE1E,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamableHttp.d.ts","sourceRoot":"","sources":["../../src/transports/streamableHttp.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,
|
|
1
|
+
{"version":3,"file":"streamableHttp.d.ts","sourceRoot":"","sources":["../../src/transports/streamableHttp.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG3C,OAAO,EAAoB,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAIxE,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAWjF,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAeD,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,MAAM,MAAM,EAC1B,MAAM,EAAE,oBAAoB,EAC5B,SAAS,CAAC,EAAE;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,GAC1D,OAAO,CAkQT"}
|