@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
|
@@ -4,6 +4,7 @@ import { AUTH_CONFIG } from '../../../constants.js';
|
|
|
4
4
|
import { ServerStatus } from '../../../core/types/index.js';
|
|
5
5
|
import logger from '../../../logger/logger.js';
|
|
6
6
|
import { RestorableStreamableHTTPServerTransport } from '../../../transport/http/restorableStreamableTransport.js';
|
|
7
|
+
import { logError } from '../../../transport/http/utils/unifiedLogger.js';
|
|
7
8
|
/**
|
|
8
9
|
* Validates a session ID format.
|
|
9
10
|
*
|
|
@@ -54,37 +55,119 @@ export class SessionService {
|
|
|
54
55
|
const result = await this.restoreSession(sessionId);
|
|
55
56
|
return result.transport;
|
|
56
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Stores initialize response data for a session to enable proper restoration.
|
|
60
|
+
*
|
|
61
|
+
* This data is used to replay the initialize handshake through the SDK's
|
|
62
|
+
* public API during session restoration, avoiding fragile private property access.
|
|
63
|
+
*
|
|
64
|
+
* @param sessionId - The session ID to update
|
|
65
|
+
* @param initializeResponse - The initialize response data to store
|
|
66
|
+
*/
|
|
67
|
+
storeInitializeResponse(sessionId, initializeResponse) {
|
|
68
|
+
this.sessionRepository.storeInitializeResponse(sessionId, initializeResponse);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Sets the SDK's internal initialized state directly.
|
|
72
|
+
*
|
|
73
|
+
* This is a simple approach that accesses SDK internals. If the SDK structure
|
|
74
|
+
* changes, this will fail gracefully and the session won't be marked as restored,
|
|
75
|
+
* allowing the client to re-initialize.
|
|
76
|
+
*
|
|
77
|
+
* @param transport - The transport to mark as initialized
|
|
78
|
+
* @param sessionId - The session ID to set
|
|
79
|
+
* @returns true if successful, false if SDK internals are inaccessible
|
|
80
|
+
*/
|
|
81
|
+
setInitializedState(transport, sessionId) {
|
|
82
|
+
try {
|
|
83
|
+
const internals = transport;
|
|
84
|
+
if (internals._webStandardTransport) {
|
|
85
|
+
// Validate that required properties exist before assignment
|
|
86
|
+
if (internals._webStandardTransport._initialized !== undefined &&
|
|
87
|
+
typeof internals._webStandardTransport._initialized !== 'boolean') {
|
|
88
|
+
logError('SDK internal property _initialized is not a boolean', {
|
|
89
|
+
method: 'setInitializedState',
|
|
90
|
+
path: 'sessionService',
|
|
91
|
+
sessionId,
|
|
92
|
+
phase: 'SDK internal validation',
|
|
93
|
+
context: { property: '_initialized', type: typeof internals._webStandardTransport._initialized },
|
|
94
|
+
});
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (internals._webStandardTransport.sessionId !== undefined &&
|
|
98
|
+
typeof internals._webStandardTransport.sessionId !== 'string') {
|
|
99
|
+
logError('SDK internal property sessionId is not a string', {
|
|
100
|
+
method: 'setInitializedState',
|
|
101
|
+
path: 'sessionService',
|
|
102
|
+
sessionId,
|
|
103
|
+
phase: 'SDK internal validation',
|
|
104
|
+
context: { property: 'sessionId', type: typeof internals._webStandardTransport.sessionId },
|
|
105
|
+
});
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
internals._webStandardTransport._initialized = true;
|
|
109
|
+
internals._webStandardTransport.sessionId = sessionId;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
logError('SDK internal structure changed - _webStandardTransport not found', {
|
|
113
|
+
method: 'setInitializedState',
|
|
114
|
+
path: 'sessionService',
|
|
115
|
+
sessionId,
|
|
116
|
+
phase: 'SDK internal access',
|
|
117
|
+
context: { reason: '_webStandardTransport property missing' },
|
|
118
|
+
});
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
logError('Failed to set initialized state', {
|
|
123
|
+
method: 'setInitializedState',
|
|
124
|
+
path: 'sessionService',
|
|
125
|
+
sessionId,
|
|
126
|
+
phase: 'SDK internal mutation',
|
|
127
|
+
error,
|
|
128
|
+
});
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
57
132
|
/**
|
|
58
133
|
* Restores a session from persistent storage.
|
|
59
134
|
*
|
|
135
|
+
* The client won't send initialize again when reconnecting - they think the session
|
|
136
|
+
* is already initialized. We need to restore the SDK's initialized state internally
|
|
137
|
+
* using the stored initialize response data.
|
|
138
|
+
*
|
|
60
139
|
* @param sessionId - The session ID to restore
|
|
61
140
|
* @returns SessionRestoreResult with transport or error details
|
|
62
141
|
*/
|
|
63
142
|
async restoreSession(sessionId) {
|
|
64
143
|
try {
|
|
65
|
-
|
|
144
|
+
// Get full session data including initializeResponse
|
|
145
|
+
const sessionData = this.sessionRepository.getSessionData(sessionId);
|
|
66
146
|
if (!sessionData) {
|
|
67
147
|
logger.debug(`No persisted session found for: ${sessionId}`);
|
|
68
148
|
return { transport: null, errorType: 'not_found' };
|
|
69
149
|
}
|
|
70
|
-
|
|
150
|
+
// Check if session has initialize response data
|
|
151
|
+
if (!sessionData.initializeResponse) {
|
|
152
|
+
logger.warn(`Session ${sessionId} exists but lacks initialize response data, cannot restore`);
|
|
153
|
+
return {
|
|
154
|
+
transport: null,
|
|
155
|
+
errorType: 'transport_failed',
|
|
156
|
+
error: 'Session data incompatible with current version. Please create a new session.',
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
// Parse session data to config
|
|
160
|
+
const config = this.sessionRepository.get(sessionId);
|
|
161
|
+
if (!config) {
|
|
162
|
+
logger.error(`Failed to parse session config for ${sessionId}`);
|
|
163
|
+
return { transport: null, errorType: 'transport_failed', error: 'Failed to parse session config' };
|
|
164
|
+
}
|
|
71
165
|
logger.info(`Restoring streamable session: ${sessionId}`);
|
|
72
|
-
// Create new transport with the original session ID
|
|
166
|
+
// Create new transport with the original session ID
|
|
167
|
+
// The sessionIdGenerator callback is the SDK's public API for controlling session IDs
|
|
73
168
|
const transport = new RestorableStreamableHTTPServerTransport({
|
|
74
169
|
sessionIdGenerator: () => sessionId,
|
|
75
170
|
});
|
|
76
|
-
// Mark the transport as initialized for restored session
|
|
77
|
-
const initResult = transport.markAsInitialized();
|
|
78
|
-
if (!initResult.success) {
|
|
79
|
-
logger.warn(`Failed to mark transport ${sessionId} as initialized: ${initResult.error}`);
|
|
80
|
-
return { transport: null, error: initResult.error, errorType: 'transport_failed' };
|
|
81
|
-
}
|
|
82
|
-
// Set the sessionId for the restored session
|
|
83
|
-
const setSessionResult = transport.setSessionId(sessionId);
|
|
84
|
-
if (!setSessionResult.success) {
|
|
85
|
-
logger.warn(`Failed to set sessionId ${sessionId}: ${setSessionResult.error}`);
|
|
86
|
-
return { transport: null, error: setSessionResult.error, errorType: 'transport_failed' };
|
|
87
|
-
}
|
|
88
171
|
// Convert config context to ContextData format if available
|
|
89
172
|
const context = config.context;
|
|
90
173
|
const contextData = context
|
|
@@ -107,6 +190,21 @@ export class SessionService {
|
|
|
107
190
|
logger.error(`Failed to connect transport ${sessionId}:`, connectError);
|
|
108
191
|
return { transport: null, error: errorMessage, errorType: 'connection_failed' };
|
|
109
192
|
}
|
|
193
|
+
// Set SDK's internal initialized state directly
|
|
194
|
+
// This is simple but fragile - if SDK changes, client can re-initialize
|
|
195
|
+
const initialized = this.setInitializedState(transport, sessionId);
|
|
196
|
+
if (!initialized) {
|
|
197
|
+
logError('Could not set initialized state during session restoration', {
|
|
198
|
+
method: 'restoreSession',
|
|
199
|
+
path: 'sessionService',
|
|
200
|
+
sessionId,
|
|
201
|
+
phase: 'SDK initialization',
|
|
202
|
+
context: { reason: 'SDK internal structure inaccessible' },
|
|
203
|
+
});
|
|
204
|
+
// Continue anyway - client can re-initialize if needed
|
|
205
|
+
}
|
|
206
|
+
// Mark as restored
|
|
207
|
+
transport.markAsRestored();
|
|
110
208
|
// Initialize notifications
|
|
111
209
|
this.initializeNotifications(sessionId);
|
|
112
210
|
// Set up handlers
|
|
@@ -135,6 +233,8 @@ export class SessionService {
|
|
|
135
233
|
const sessionId = providedSessionId || AUTH_CONFIG.SERVER.STREAMABLE_SESSION.ID_PREFIX + randomUUID();
|
|
136
234
|
let transport;
|
|
137
235
|
try {
|
|
236
|
+
// Always use the standard transport - no special handling for providedSessionId
|
|
237
|
+
// The client's initialize request will be processed normally through handleRequest
|
|
138
238
|
transport = new StreamableHTTPServerTransport({
|
|
139
239
|
sessionIdGenerator: () => sessionId,
|
|
140
240
|
});
|
|
@@ -183,6 +283,9 @@ export class SessionService {
|
|
|
183
283
|
/**
|
|
184
284
|
* Deletes a session and cleans up resources.
|
|
185
285
|
*
|
|
286
|
+
* Best-effort deletion: client is disconnecting anyway, so we log but don't throw.
|
|
287
|
+
* The session will expire naturally via TTL if repository deletion fails.
|
|
288
|
+
*
|
|
186
289
|
* @param sessionId - The session ID to delete
|
|
187
290
|
*/
|
|
188
291
|
async deleteSession(sessionId) {
|
|
@@ -190,10 +293,16 @@ export class SessionService {
|
|
|
190
293
|
this.sessionRepository.delete(sessionId);
|
|
191
294
|
}
|
|
192
295
|
catch (error) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
296
|
+
// Best-effort deletion: client is disconnecting, so we log but don't throw
|
|
297
|
+
// The session will expire naturally via TTL
|
|
298
|
+
logError('Session deletion failed', {
|
|
299
|
+
method: 'deleteSession',
|
|
300
|
+
path: 'sessionService',
|
|
301
|
+
sessionId,
|
|
302
|
+
phase: 'session cleanup',
|
|
303
|
+
error,
|
|
304
|
+
context: { reason: 'Repository delete failed - session will expire via TTL' },
|
|
305
|
+
});
|
|
197
306
|
}
|
|
198
307
|
}
|
|
199
308
|
/**
|
|
@@ -216,8 +325,9 @@ export class SessionService {
|
|
|
216
325
|
}
|
|
217
326
|
setupTransportHandlers(transport, sessionId) {
|
|
218
327
|
transport.onclose = () => {
|
|
328
|
+
// Only disconnect the transport, don't delete the session
|
|
329
|
+
// Sessions persist across server restarts and are only deleted via explicit DELETE requests
|
|
219
330
|
this.serverManager.disconnectTransport(sessionId);
|
|
220
|
-
this.sessionRepository.delete(sessionId);
|
|
221
331
|
};
|
|
222
332
|
transport.onerror = (error) => {
|
|
223
333
|
logger.error(`Streamable HTTP transport error for session ${sessionId}:`, error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionService.js","sourceRoot":"","sources":["../../../../src/transport/http/utils/sessionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"sessionService.js","sourceRoot":"","sources":["../../../../src/transport/http/utils/sessionService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAGnG,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAA2B,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,uCAAuC,E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,CAAC,aAAa,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC;gBACnC,MAAM,CAAC,SAAS,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC/E,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified logging for HTTP transport and JSON-RPC messages.
|
|
3
|
+
* All logs follow the same format with consistent metadata including sessionId.
|
|
4
|
+
* Error level includes additional details (stack traces, error messages).
|
|
5
|
+
*/
|
|
6
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
7
|
+
export interface BaseLogOptions {
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
context?: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export interface HttpLogOptions extends BaseLogOptions {
|
|
12
|
+
method?: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
statusCode?: number;
|
|
15
|
+
reason?: string;
|
|
16
|
+
phase?: string;
|
|
17
|
+
headers?: Record<string, string | undefined>;
|
|
18
|
+
}
|
|
19
|
+
export interface ErrorLogOptions extends HttpLogOptions {
|
|
20
|
+
error?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface JsonRpcLogOptions extends BaseLogOptions {
|
|
23
|
+
jsonrpcVersion?: string;
|
|
24
|
+
requestId?: string | number;
|
|
25
|
+
errorCode?: number;
|
|
26
|
+
errorMessage?: string;
|
|
27
|
+
errorData?: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Unified logging function for all log levels.
|
|
31
|
+
* Error level includes stack traces and additional error details.
|
|
32
|
+
*
|
|
33
|
+
* @param level - Log level ('debug' | 'info' | 'warn' | 'error')
|
|
34
|
+
* @param message - Log message prefix
|
|
35
|
+
* @param options - Log metadata options
|
|
36
|
+
*/
|
|
37
|
+
export declare function log(level: LogLevel, message: string, options?: BaseLogOptions): void;
|
|
38
|
+
/**
|
|
39
|
+
* Logs HTTP request/response with optional status code.
|
|
40
|
+
*/
|
|
41
|
+
export declare function logHttp(level: Exclude<LogLevel, 'error'>, message: string, options: HttpLogOptions): void;
|
|
42
|
+
export declare function logHttp(level: 'error', message: string, options: ErrorLogOptions): void;
|
|
43
|
+
/**
|
|
44
|
+
* Logs JSON-RPC messages and errors.
|
|
45
|
+
* Errors use error level, other messages use specified level.
|
|
46
|
+
*/
|
|
47
|
+
export declare function logJsonRpc(level: LogLevel, message: string, options: JsonRpcLogOptions): void;
|
|
48
|
+
export declare const logError: (message: string, options: ErrorLogOptions) => void;
|
|
49
|
+
export declare const logWarn: (message: string, options: HttpLogOptions) => void;
|
|
50
|
+
export declare const logInfo: (message: string, options: HttpLogOptions) => void;
|
|
51
|
+
export declare const logDebug: (message: string, options: HttpLogOptions) => void;
|
|
52
|
+
//# sourceMappingURL=unifiedLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unifiedLogger.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/utils/unifiedLogger.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IACh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AE,SAAS,cAAc,SAAuC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import logger from '../../../logger/logger.js';
|
|
2
|
+
/**
|
|
3
|
+
* Unified logging function for all log levels.
|
|
4
|
+
* Error level includes stack traces and additional error details.
|
|
5
|
+
*
|
|
6
|
+
* @param level - Log level ('debug' | 'info' | 'warn' | 'error')
|
|
7
|
+
* @param message - Log message prefix
|
|
8
|
+
* @param options - Log metadata options
|
|
9
|
+
*/
|
|
10
|
+
export function log(level, message, options = {}) {
|
|
11
|
+
const { sessionId, context = {} } = options;
|
|
12
|
+
const metadata = {
|
|
13
|
+
sessionId: sessionId || '(none)',
|
|
14
|
+
...context,
|
|
15
|
+
};
|
|
16
|
+
// Map level to logger function
|
|
17
|
+
const logFn = logger[level];
|
|
18
|
+
if (typeof logFn === 'function') {
|
|
19
|
+
logFn(message, metadata);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function logHttp(level, message, options) {
|
|
23
|
+
const { method, path, statusCode, reason, phase, headers, sessionId, context, error } = options;
|
|
24
|
+
const baseContext = {
|
|
25
|
+
...(method && { method }),
|
|
26
|
+
...(path && { path }),
|
|
27
|
+
...(statusCode !== undefined && { statusCode }),
|
|
28
|
+
...context,
|
|
29
|
+
};
|
|
30
|
+
if (reason)
|
|
31
|
+
baseContext.reason = reason;
|
|
32
|
+
if (phase)
|
|
33
|
+
baseContext.phase = phase;
|
|
34
|
+
if (headers)
|
|
35
|
+
baseContext.headers = headers;
|
|
36
|
+
// Add error details for error level
|
|
37
|
+
if (level === 'error' && error) {
|
|
38
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
39
|
+
const errorStack = error instanceof Error ? error.stack : undefined;
|
|
40
|
+
const errorType = error instanceof Error ? error.constructor.name : typeof error;
|
|
41
|
+
baseContext.errorMessage = errorMessage;
|
|
42
|
+
baseContext.errorType = errorType;
|
|
43
|
+
if (errorStack)
|
|
44
|
+
baseContext.stack = errorStack;
|
|
45
|
+
// Include full error context for non-Error objects
|
|
46
|
+
if (typeof error === 'object' && !(error instanceof Error)) {
|
|
47
|
+
baseContext.errorContext = error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
log(level, message, { sessionId, context: baseContext });
|
|
51
|
+
}
|
|
52
|
+
/* eslint-enable no-redeclare */
|
|
53
|
+
/**
|
|
54
|
+
* Logs JSON-RPC messages and errors.
|
|
55
|
+
* Errors use error level, other messages use specified level.
|
|
56
|
+
*/
|
|
57
|
+
export function logJsonRpc(level, message, options) {
|
|
58
|
+
const { jsonrpcVersion, requestId, errorCode, errorMessage, errorData, sessionId, context } = options;
|
|
59
|
+
const baseContext = {
|
|
60
|
+
jsonrpc: jsonrpcVersion || '2.0',
|
|
61
|
+
...context,
|
|
62
|
+
};
|
|
63
|
+
if (requestId !== undefined)
|
|
64
|
+
baseContext.requestId = requestId;
|
|
65
|
+
if (errorCode !== undefined)
|
|
66
|
+
baseContext.errorCode = errorCode;
|
|
67
|
+
if (errorMessage)
|
|
68
|
+
baseContext.errorMessage = errorMessage;
|
|
69
|
+
if (errorData !== undefined)
|
|
70
|
+
baseContext.errorData = errorData;
|
|
71
|
+
// Use error level if errorCode is present, otherwise use specified level
|
|
72
|
+
const finalLevel = errorCode !== undefined ? 'error' : level;
|
|
73
|
+
log(finalLevel, message, { sessionId, context: baseContext });
|
|
74
|
+
}
|
|
75
|
+
// Convenience functions for common use cases
|
|
76
|
+
export const logError = (message, options) => logHttp('error', message, options);
|
|
77
|
+
export const logWarn = (message, options) => logHttp('warn', message, options);
|
|
78
|
+
export const logInfo = (message, options) => logHttp('info', message, options);
|
|
79
|
+
export const logDebug = (message, options) => logHttp('debug', message, options);
|
|
80
|
+
//# sourceMappingURL=unifiedLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unifiedLogger.js","sourceRoot":"","sources":["../../../../src/transport/http/utils/unifiedLogger.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,uB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S,KAAK,SAAS;QAAE,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC;IAE/D,yEAAyE;IACzE,MAAM,UAAU,GAAG,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7D,GAAG,CAAC,UAAsB,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,OAAwB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1G,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,OAAuB,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACvG,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAE,OAAuB,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACvG,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,OAAuB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for internal properties of the MCP SDK that are not exposed
|
|
3
|
-
* in the public API but are needed for session restoration functionality.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Interface representing the internal structure of the web standard transport
|
|
7
|
-
* used within StreamableHTTPServerTransport
|
|
8
|
-
*/
|
|
9
|
-
export interface InternalWebStandardTransport {
|
|
10
|
-
sessionId: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Interface representing the internal structure of StreamableHTTPServerTransport
|
|
14
|
-
* exposing private properties needed for restoration
|
|
15
|
-
*/
|
|
16
|
-
export interface InternalStreamableTransport {
|
|
17
|
-
/**
|
|
18
|
-
* The underlying web standard transport instance
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
|
-
_webStandardTransport?: InternalWebStandardTransport;
|
|
22
|
-
/**
|
|
23
|
-
* Flag indicating if the transport has been initialized
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
_initialized?: boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Session ID from public interface
|
|
29
|
-
*/
|
|
30
|
-
sessionId?: string;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=sdkInternals.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdkInternals.d.ts","sourceRoot":"","sources":["../../../../src/transport/http/utils/sdkInternals.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,qBAAqB,CAAC,EAAE,4BAA4B,CAAC;IAErD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sdkInternals.js","sourceRoot":"","sources":["../../../../src/transport/http/utils/sdkInternals.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|