@1mcp/agent 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/auth/sessionTypes.d.ts +16 -0
- package/build/auth/sessionTypes.d.ts.map +1 -1
- package/build/commands/serve/index.d.ts +5 -0
- package/build/commands/serve/index.d.ts.map +1 -1
- package/build/commands/serve/index.js +5 -0
- package/build/commands/serve/index.js.map +1 -1
- package/build/commands/serve/serve.d.ts +1 -0
- package/build/commands/serve/serve.d.ts.map +1 -1
- package/build/commands/serve/serve.js +1 -0
- package/build/commands/serve/serve.js.map +1 -1
- package/build/constants/mcp.d.ts +1 -1
- package/build/constants/mcp.js +1 -1
- package/build/core/server/agentConfig.d.ts +2 -0
- package/build/core/server/agentConfig.d.ts.map +1 -1
- package/build/core/server/agentConfig.js +4 -0
- package/build/core/server/agentConfig.js.map +1 -1
- package/build/transport/http/loggingSseTransport.d.ts +13 -0
- package/build/transport/http/loggingSseTransport.d.ts.map +1 -0
- package/build/transport/http/loggingSseTransport.js +43 -0
- package/build/transport/http/loggingSseTransport.js.map +1 -0
- package/build/transport/http/middlewares/tagsExtractor.d.ts.map +1 -1
- package/build/transport/http/middlewares/tagsExtractor.js +21 -62
- package/build/transport/http/middlewares/tagsExtractor.js.map +1 -1
- package/build/transport/http/restorableStreamableTransport.d.ts +16 -59
- package/build/transport/http/restorableStreamableTransport.d.ts.map +1 -1
- package/build/transport/http/restorableStreamableTransport.js +18 -114
- package/build/transport/http/restorableStreamableTransport.js.map +1 -1
- package/build/transport/http/routes/sseRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/sseRoutes.js +2 -1
- package/build/transport/http/routes/sseRoutes.js.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.js +169 -60
- package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.d.ts +28 -0
- package/build/transport/http/storage/streamableSessionRepository.d.ts.map +1 -1
- package/build/transport/http/storage/streamableSessionRepository.js +103 -0
- package/build/transport/http/storage/streamableSessionRepository.js.map +1 -1
- package/build/transport/http/utils/httpErrorHandler.d.ts +36 -0
- package/build/transport/http/utils/httpErrorHandler.d.ts.map +1 -0
- package/build/transport/http/utils/httpErrorHandler.js +83 -0
- package/build/transport/http/utils/httpErrorHandler.js.map +1 -0
- package/build/transport/http/utils/sessionService.d.ts +30 -0
- package/build/transport/http/utils/sessionService.d.ts.map +1 -1
- package/build/transport/http/utils/sessionService.js +130 -20
- package/build/transport/http/utils/sessionService.js.map +1 -1
- package/build/transport/http/utils/unifiedLogger.d.ts +52 -0
- package/build/transport/http/utils/unifiedLogger.d.ts.map +1 -0
- package/build/transport/http/utils/unifiedLogger.js +80 -0
- package/build/transport/http/utils/unifiedLogger.js.map +1 -0
- package/package.json +1 -1
- package/build/transport/http/utils/sdkInternals.d.ts +0 -32
- package/build/transport/http/utils/sdkInternals.d.ts.map +0 -1
- package/build/transport/http/utils/sdkInternals.js +0 -6
- package/build/transport/http/utils/sdkInternals.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamableHttpRoutes.js","sourceRoot":"","sources":["../../../../src/transport/http/routes/streamableHttpRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"streamableHttpRoutes.js","sourceRoot":"","sources":["../../../../src/transport/http/routes/streamableHttpRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG/G,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,gBAAgB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QAAC,OAAO,KAAK,EAAE,CAAC;YACf,iBAAiB,CAAC,GAAG,EAAE,KAAK,EAAE;gBAC5B,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAuB;gBAC9D,KAAK,EAAE,eAAe;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StreamableSessionData } from '../../../auth/sessionTypes.js';
|
|
1
2
|
import { FileStorageService } from '../../../auth/storage/fileStorageService.js';
|
|
2
3
|
import { InboundConnectionConfig } from '../../../core/types/index.js';
|
|
3
4
|
/**
|
|
@@ -23,6 +24,16 @@ export declare class StreamableSessionRepository {
|
|
|
23
24
|
* Creates a new streamable session with the given ID and configuration
|
|
24
25
|
*/
|
|
25
26
|
create(sessionId: string, config: InboundConnectionConfig): void;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves raw session data by ID including initialize response data.
|
|
29
|
+
*
|
|
30
|
+
* This returns the full StreamableSessionData object, not just the config.
|
|
31
|
+
* Used for session restoration where we need access to initialize response data.
|
|
32
|
+
*
|
|
33
|
+
* @param sessionId - The session ID to retrieve
|
|
34
|
+
* @returns The full session data including initializeResponse, or null if not found
|
|
35
|
+
*/
|
|
36
|
+
getSessionData(sessionId: string): StreamableSessionData | null;
|
|
26
37
|
/**
|
|
27
38
|
* Retrieves a session by ID and returns the configuration
|
|
28
39
|
*/
|
|
@@ -34,6 +45,23 @@ export declare class StreamableSessionRepository {
|
|
|
34
45
|
* Always updates in-memory timestamps to prevent data loss.
|
|
35
46
|
*/
|
|
36
47
|
updateAccess(sessionId: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Stores initialize response data for a session to enable proper restoration.
|
|
50
|
+
*
|
|
51
|
+
* This data is used to replay the initialize handshake through the SDK's
|
|
52
|
+
* public API during session restoration, avoiding fragile private property access.
|
|
53
|
+
*
|
|
54
|
+
* @param sessionId - The session ID to update
|
|
55
|
+
* @param initializeResponse - The initialize response data to store
|
|
56
|
+
*/
|
|
57
|
+
storeInitializeResponse(sessionId: string, initializeResponse: {
|
|
58
|
+
protocolVersion: string;
|
|
59
|
+
capabilities: Record<string, unknown>;
|
|
60
|
+
serverInfo: {
|
|
61
|
+
name: string;
|
|
62
|
+
version: string;
|
|
63
|
+
};
|
|
64
|
+
}): void;
|
|
37
65
|
/**
|
|
38
66
|
* Deletes a session by ID
|
|
39
67
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamableSessionRepository.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/storage/streamableSessionRepository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"streamableSessionRepository.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/storage/streamableSessionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAG7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAMnE;;;;;;;;;GASG;AACH,qBAAa,2BAA2B;IAa1B,OAAO,CAAC,OAAO;IAX3B,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,eAAe,CAAqB;IAG5C,OAAO,CAAC,gBAAgB,CAA4C;IAGpE,OAAO,CAAC,aAAa,CAA+C;gBAEhD,OAAO,EAAE,kBAAkB;IAI/C;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB,GAAG,IAAI;IA4BhE;;;;;;;;OAQG;IACH,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI;IAuB/D;;OAEG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI;IAiEtD;;;;;OAKG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAiCrC;;;;;;;;OAQG;IACH,uBAAuB,CACrB,SAAS,EAAE,MAAM,EACjB,kBAAkB,EAAE;QAClB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACtC,UAAU,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/C,GACA,IAAI;IAsEP;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAsBlC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAkC5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACI,iBAAiB,IAAI,IAAI;CAUjC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AUTH_CONFIG } from '../../../constants.js';
|
|
2
2
|
import { AgentConfigManager } from '../../../core/server/agentConfig.js';
|
|
3
3
|
import logger from '../../../logger/logger.js';
|
|
4
|
+
import { logError } from '../../../transport/http/utils/unifiedLogger.js';
|
|
4
5
|
/**
|
|
5
6
|
* Repository for streamable HTTP session operations
|
|
6
7
|
*
|
|
@@ -55,6 +56,32 @@ export class StreamableSessionRepository {
|
|
|
55
56
|
logger.info(`Created streamable session (memory-only): ${sessionId}`);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves raw session data by ID including initialize response data.
|
|
61
|
+
*
|
|
62
|
+
* This returns the full StreamableSessionData object, not just the config.
|
|
63
|
+
* Used for session restoration where we need access to initialize response data.
|
|
64
|
+
*
|
|
65
|
+
* @param sessionId - The session ID to retrieve
|
|
66
|
+
* @returns The full session data including initializeResponse, or null if not found
|
|
67
|
+
*/
|
|
68
|
+
getSessionData(sessionId) {
|
|
69
|
+
// Check in-memory store first
|
|
70
|
+
let sessionData = this.inMemorySessions.get(sessionId);
|
|
71
|
+
// If not in memory and persistence is enabled, try reading from disk
|
|
72
|
+
if (!sessionData) {
|
|
73
|
+
const agentConfig = AgentConfigManager.getInstance();
|
|
74
|
+
if (agentConfig.get('features').sessionPersistence) {
|
|
75
|
+
const diskData = this.storage.readData(AUTH_CONFIG.SERVER.STREAMABLE_SESSION.FILE_PREFIX, sessionId);
|
|
76
|
+
// Cache in memory if found
|
|
77
|
+
if (diskData) {
|
|
78
|
+
sessionData = diskData;
|
|
79
|
+
this.inMemorySessions.set(sessionId, diskData);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return sessionData || null;
|
|
84
|
+
}
|
|
58
85
|
/**
|
|
59
86
|
* Retrieves a session by ID and returns the configuration
|
|
60
87
|
*/
|
|
@@ -148,6 +175,82 @@ export class StreamableSessionRepository {
|
|
|
148
175
|
this.persistSessionAccess(sessionId, now);
|
|
149
176
|
}
|
|
150
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Stores initialize response data for a session to enable proper restoration.
|
|
180
|
+
*
|
|
181
|
+
* This data is used to replay the initialize handshake through the SDK's
|
|
182
|
+
* public API during session restoration, avoiding fragile private property access.
|
|
183
|
+
*
|
|
184
|
+
* @param sessionId - The session ID to update
|
|
185
|
+
* @param initializeResponse - The initialize response data to store
|
|
186
|
+
*/
|
|
187
|
+
storeInitializeResponse(sessionId, initializeResponse) {
|
|
188
|
+
try {
|
|
189
|
+
let sessionData = this.inMemorySessions.get(sessionId);
|
|
190
|
+
// If not in memory, try reading from disk
|
|
191
|
+
if (!sessionData) {
|
|
192
|
+
const agentConfig = AgentConfigManager.getInstance();
|
|
193
|
+
if (agentConfig.get('features').sessionPersistence) {
|
|
194
|
+
try {
|
|
195
|
+
const diskData = this.storage.readData(AUTH_CONFIG.SERVER.STREAMABLE_SESSION.FILE_PREFIX, sessionId);
|
|
196
|
+
if (diskData) {
|
|
197
|
+
sessionData = diskData;
|
|
198
|
+
this.inMemorySessions.set(sessionId, diskData);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch (readError) {
|
|
202
|
+
logError('Failed to read session from disk for initialize response storage', {
|
|
203
|
+
method: 'storeInitializeResponse',
|
|
204
|
+
path: 'streamableSessionRepository',
|
|
205
|
+
sessionId,
|
|
206
|
+
phase: 'disk read',
|
|
207
|
+
error: readError,
|
|
208
|
+
});
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (sessionData) {
|
|
214
|
+
sessionData.initializeResponse = initializeResponse;
|
|
215
|
+
// Persist to disk if enabled
|
|
216
|
+
const agentConfig = AgentConfigManager.getInstance();
|
|
217
|
+
if (agentConfig.get('features').sessionPersistence) {
|
|
218
|
+
try {
|
|
219
|
+
this.storage.writeData(AUTH_CONFIG.SERVER.STREAMABLE_SESSION.FILE_PREFIX, sessionId, sessionData);
|
|
220
|
+
}
|
|
221
|
+
catch (writeError) {
|
|
222
|
+
logError('Failed to persist initialize response to disk', {
|
|
223
|
+
method: 'storeInitializeResponse',
|
|
224
|
+
path: 'streamableSessionRepository',
|
|
225
|
+
sessionId,
|
|
226
|
+
phase: 'disk write',
|
|
227
|
+
error: writeError,
|
|
228
|
+
});
|
|
229
|
+
// Session is in memory, so continue with warning
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
logger.debug(`Stored initialize response for session ${sessionId}`);
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
logError('Session not found for storing initialize response', {
|
|
236
|
+
method: 'storeInitializeResponse',
|
|
237
|
+
path: 'streamableSessionRepository',
|
|
238
|
+
sessionId,
|
|
239
|
+
phase: 'session lookup',
|
|
240
|
+
context: { reason: 'Session not in memory or on disk' },
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
logError('Unexpected error storing initialize response', {
|
|
246
|
+
method: 'storeInitializeResponse',
|
|
247
|
+
path: 'streamableSessionRepository',
|
|
248
|
+
sessionId,
|
|
249
|
+
phase: 'unknown',
|
|
250
|
+
error,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
151
254
|
/**
|
|
152
255
|
* Deletes a session by ID
|
|
153
256
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamableSessionRepository.js","sourceRoot":"","sources":["../../../../src/transport/http/storage/streamableSessionRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,OAAO,MAAM,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"streamableSessionRepository.js","sourceRoot":"","sources":["../../../../src/transport/http/storage/streamableSessionRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,OAAO,2BAA2B;IAalB;IAZpB,oDAAoD;IAC5C,gBAAgB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC7C,eAAe,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAE5C,0EAA0E;IAClE,gBAAgB,GAAG,IAAI,GAAG,EAAiC,CAAC;IAEpE,mBAAmB;IACX,aAAa,GAA0C,IAAI,CAAC;IAEpE,YAAoB,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAA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eAAe,EAAE,CAAC;YACxC,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,CAAC,oBAAoB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,WAAW,eAAe,CAAC,MAAM,iBAAiB,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACK,kBAAkB;QACxB,iCAAiC;QACjC,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;QACrD,MAAM,eAAe,GAAG,WAAW,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,sBAAsB,GAAG,IAAI,CAAC;QAE5F,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,GAAG,EAAE;YACpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,CAAC,EAAE,eAAe,CAAC,CAAC;IACtB,CAAC;IAED;;OAEG;IACI,iBAAiB;QACtB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YAClC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,oCAAoC;QACpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;IAC7E,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Response } from 'express';
|
|
2
|
+
/**
|
|
3
|
+
* Consolidated HTTP error response helpers.
|
|
4
|
+
* Provides consistent error responses across all HTTP routes with proper logging.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Sends a 400 Bad Request response with consistent error format.
|
|
8
|
+
*
|
|
9
|
+
* @param res - Express response object
|
|
10
|
+
* @param message - Error message describing what went wrong
|
|
11
|
+
* @param details - Optional additional context for debugging and response
|
|
12
|
+
*/
|
|
13
|
+
export declare function sendBadRequest(res: Response, message: string, details?: Record<string, unknown>): void;
|
|
14
|
+
/**
|
|
15
|
+
* Sends a 404 Not Found response with consistent error format.
|
|
16
|
+
*
|
|
17
|
+
* @param res - Express response object
|
|
18
|
+
* @param message - Error message describing what was not found
|
|
19
|
+
* @param details - Optional additional context for debugging
|
|
20
|
+
*/
|
|
21
|
+
export declare function sendNotFound(res: Response, message: string, details?: Record<string, unknown>): void;
|
|
22
|
+
/**
|
|
23
|
+
* Sends a 500 Internal Server Error response with consistent error format.
|
|
24
|
+
* Logs the actual error with stack trace for debugging.
|
|
25
|
+
*
|
|
26
|
+
* @param res - Express response object
|
|
27
|
+
* @param error - The error that occurred (can be Error, string, or unknown)
|
|
28
|
+
* @param context - Request context for logging (method, path, sessionId, phase)
|
|
29
|
+
*/
|
|
30
|
+
export declare function sendInternalError(res: Response, error: unknown, context: {
|
|
31
|
+
method: string;
|
|
32
|
+
path: string;
|
|
33
|
+
sessionId?: string;
|
|
34
|
+
phase?: string;
|
|
35
|
+
}): void;
|
|
36
|
+
//# sourceMappingURL=httpErrorHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpErrorHandler.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/utils/httpErrorHandler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAInC;;;GAGG;AAEH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAwBtG;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAgBpG;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5E,IAAI,CAgBN"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ErrorCode } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { logError, logWarn } from './unifiedLogger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Consolidated HTTP error response helpers.
|
|
5
|
+
* Provides consistent error responses across all HTTP routes with proper logging.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Sends a 400 Bad Request response with consistent error format.
|
|
9
|
+
*
|
|
10
|
+
* @param res - Express response object
|
|
11
|
+
* @param message - Error message describing what went wrong
|
|
12
|
+
* @param details - Optional additional context for debugging and response
|
|
13
|
+
*/
|
|
14
|
+
export function sendBadRequest(res, message, details) {
|
|
15
|
+
const req = res.req;
|
|
16
|
+
logWarn('HTTP error 400', {
|
|
17
|
+
method: req?.method,
|
|
18
|
+
path: req?.path,
|
|
19
|
+
statusCode: 400,
|
|
20
|
+
reason: message,
|
|
21
|
+
context: details,
|
|
22
|
+
});
|
|
23
|
+
// Build response object - include details if they should be part of the response
|
|
24
|
+
const response = {
|
|
25
|
+
error: {
|
|
26
|
+
code: ErrorCode.InvalidParams,
|
|
27
|
+
message,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// Merge details into error response if provided (e.g., for examples)
|
|
31
|
+
if (details) {
|
|
32
|
+
Object.assign(response.error, details);
|
|
33
|
+
}
|
|
34
|
+
res.status(400).json(response);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Sends a 404 Not Found response with consistent error format.
|
|
38
|
+
*
|
|
39
|
+
* @param res - Express response object
|
|
40
|
+
* @param message - Error message describing what was not found
|
|
41
|
+
* @param details - Optional additional context for debugging
|
|
42
|
+
*/
|
|
43
|
+
export function sendNotFound(res, message, details) {
|
|
44
|
+
const req = res.req;
|
|
45
|
+
logWarn('HTTP error 404', {
|
|
46
|
+
method: req?.method,
|
|
47
|
+
path: req?.path,
|
|
48
|
+
statusCode: 404,
|
|
49
|
+
reason: message,
|
|
50
|
+
context: details,
|
|
51
|
+
});
|
|
52
|
+
res.status(404).json({
|
|
53
|
+
error: {
|
|
54
|
+
code: ErrorCode.InvalidParams,
|
|
55
|
+
message,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sends a 500 Internal Server Error response with consistent error format.
|
|
61
|
+
* Logs the actual error with stack trace for debugging.
|
|
62
|
+
*
|
|
63
|
+
* @param res - Express response object
|
|
64
|
+
* @param error - The error that occurred (can be Error, string, or unknown)
|
|
65
|
+
* @param context - Request context for logging (method, path, sessionId, phase)
|
|
66
|
+
*/
|
|
67
|
+
export function sendInternalError(res, error, context) {
|
|
68
|
+
logError('HTTP error 500', {
|
|
69
|
+
method: context.method,
|
|
70
|
+
path: context.path,
|
|
71
|
+
sessionId: context.sessionId,
|
|
72
|
+
statusCode: 500,
|
|
73
|
+
phase: context.phase,
|
|
74
|
+
error,
|
|
75
|
+
});
|
|
76
|
+
res.status(500).json({
|
|
77
|
+
error: {
|
|
78
|
+
code: ErrorCode.InternalError,
|
|
79
|
+
message: 'An internal server error occurred while processing the request',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=httpErrorHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpErrorHandler.js","sourceRoot":"","sources":["../../../../src/transport/http/utils/httpErrorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAI/D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AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAa,EACb,KAAc,EACd,OAA6E;IAE7E,QAAQ,CAAC,gBAAgB,EAAE;QACzB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,UAAU,EAAE,GAAG;QACf,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK;KACN,CAAC,CAAC;IAEH,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACnB,KAAK,EAAE;YACL,IAAI,EAAE,SAAS,CAAC,aAAa;YAC7B,OAAO,EAAE,gEAAgE;SAC1E;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
2
|
+
import { InitializeResponseData } from '../../../auth/sessionTypes.js';
|
|
2
3
|
import { AsyncLoadingOrchestrator } from '../../../core/capabilities/asyncLoadingOrchestrator.js';
|
|
3
4
|
import { ServerManager } from '../../../core/server/serverManager.js';
|
|
4
5
|
import { InboundConnectionConfig } from '../../../core/types/index.js';
|
|
@@ -38,9 +39,35 @@ export declare class SessionService {
|
|
|
38
39
|
* @returns The transport if found or restored successfully, null otherwise
|
|
39
40
|
*/
|
|
40
41
|
getSession(sessionId: string): Promise<StreamableHTTPServerTransport | RestorableStreamableHTTPServerTransport | null>;
|
|
42
|
+
/**
|
|
43
|
+
* Stores initialize response data for a session to enable proper restoration.
|
|
44
|
+
*
|
|
45
|
+
* This data is used to replay the initialize handshake through the SDK's
|
|
46
|
+
* public API during session restoration, avoiding fragile private property access.
|
|
47
|
+
*
|
|
48
|
+
* @param sessionId - The session ID to update
|
|
49
|
+
* @param initializeResponse - The initialize response data to store
|
|
50
|
+
*/
|
|
51
|
+
storeInitializeResponse(sessionId: string, initializeResponse: InitializeResponseData): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the SDK's internal initialized state directly.
|
|
54
|
+
*
|
|
55
|
+
* This is a simple approach that accesses SDK internals. If the SDK structure
|
|
56
|
+
* changes, this will fail gracefully and the session won't be marked as restored,
|
|
57
|
+
* allowing the client to re-initialize.
|
|
58
|
+
*
|
|
59
|
+
* @param transport - The transport to mark as initialized
|
|
60
|
+
* @param sessionId - The session ID to set
|
|
61
|
+
* @returns true if successful, false if SDK internals are inaccessible
|
|
62
|
+
*/
|
|
63
|
+
private setInitializedState;
|
|
41
64
|
/**
|
|
42
65
|
* Restores a session from persistent storage.
|
|
43
66
|
*
|
|
67
|
+
* The client won't send initialize again when reconnecting - they think the session
|
|
68
|
+
* is already initialized. We need to restore the SDK's initialized state internally
|
|
69
|
+
* using the stored initialize response data.
|
|
70
|
+
*
|
|
44
71
|
* @param sessionId - The session ID to restore
|
|
45
72
|
* @returns SessionRestoreResult with transport or error details
|
|
46
73
|
*/
|
|
@@ -58,6 +85,9 @@ export declare class SessionService {
|
|
|
58
85
|
/**
|
|
59
86
|
* Deletes a session and cleans up resources.
|
|
60
87
|
*
|
|
88
|
+
* Best-effort deletion: client is disconnecting anyway, so we log but don't throw.
|
|
89
|
+
* The session will expire naturally via TTL if repository deletion fails.
|
|
90
|
+
*
|
|
61
91
|
* @param sessionId - The session ID to delete
|
|
62
92
|
*/
|
|
63
93
|
deleteSession(sessionId: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionService.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/utils/sessionService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"sessionService.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/utils/sessionService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,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