mcp-use 1.9.1-canary.0 → 1.9.1-canary.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/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-KHTTBIRP.js → chunk-33U4IA4N.js} +58 -1
- package/dist/{chunk-5URNFWCQ.js → chunk-LWVK6RXA.js} +8 -3
- package/dist/{context-storage-TXQ4DVSS.js → context-storage-NA4MHWOZ.js} +3 -1
- package/dist/src/server/context-storage.d.ts +8 -1
- package/dist/src/server/context-storage.d.ts.map +1 -1
- package/dist/src/server/endpoints/mount-mcp.d.ts.map +1 -1
- package/dist/src/server/index.cjs +447 -21
- package/dist/src/server/index.d.ts +1 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +391 -25
- package/dist/src/server/mcp-server.d.ts +30 -0
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/prompts/index.d.ts.map +1 -1
- package/dist/src/server/resources/index.d.ts +1 -0
- package/dist/src/server/resources/index.d.ts.map +1 -1
- package/dist/src/server/resources/subscriptions.d.ts +54 -0
- package/dist/src/server/resources/subscriptions.d.ts.map +1 -0
- package/dist/src/server/sessions/session-manager.d.ts +7 -1
- package/dist/src/server/sessions/session-manager.d.ts.map +1 -1
- package/dist/src/server/tools/tool-execution-helpers.d.ts +30 -17
- package/dist/src/server/tools/tool-execution-helpers.d.ts.map +1 -1
- package/dist/src/server/types/tool-context.d.ts +16 -0
- package/dist/src/server/types/tool-context.d.ts.map +1 -1
- package/dist/src/server/utils/response-helpers.d.ts +48 -4
- package/dist/src/server/utils/response-helpers.d.ts.map +1 -1
- package/dist/{tool-execution-helpers-IVUDHXMK.js → tool-execution-helpers-BQJTPWPN.js} +7 -1
- package/package.json +3 -3
|
@@ -252,7 +252,60 @@ function createReportProgressMethod(progressToken, sendNotification) {
|
|
|
252
252
|
return void 0;
|
|
253
253
|
}
|
|
254
254
|
__name(createReportProgressMethod, "createReportProgressMethod");
|
|
255
|
-
|
|
255
|
+
var LOG_LEVELS = {
|
|
256
|
+
debug: 0,
|
|
257
|
+
info: 1,
|
|
258
|
+
notice: 2,
|
|
259
|
+
warning: 3,
|
|
260
|
+
error: 4,
|
|
261
|
+
critical: 5,
|
|
262
|
+
alert: 6,
|
|
263
|
+
emergency: 7
|
|
264
|
+
};
|
|
265
|
+
var VALID_LOG_LEVELS = [
|
|
266
|
+
"debug",
|
|
267
|
+
"info",
|
|
268
|
+
"notice",
|
|
269
|
+
"warning",
|
|
270
|
+
"error",
|
|
271
|
+
"critical",
|
|
272
|
+
"alert",
|
|
273
|
+
"emergency"
|
|
274
|
+
];
|
|
275
|
+
function isValidLogLevel(level) {
|
|
276
|
+
return VALID_LOG_LEVELS.includes(level);
|
|
277
|
+
}
|
|
278
|
+
__name(isValidLogLevel, "isValidLogLevel");
|
|
279
|
+
function shouldLogMessage(messageLevel, minLevel) {
|
|
280
|
+
if (!minLevel) {
|
|
281
|
+
return true;
|
|
282
|
+
}
|
|
283
|
+
if (!isValidLogLevel(messageLevel) || !isValidLogLevel(minLevel)) {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
return LOG_LEVELS[messageLevel] >= LOG_LEVELS[minLevel];
|
|
287
|
+
}
|
|
288
|
+
__name(shouldLogMessage, "shouldLogMessage");
|
|
289
|
+
function createLogMethod(sendNotification, minLogLevel) {
|
|
290
|
+
if (!sendNotification) {
|
|
291
|
+
return void 0;
|
|
292
|
+
}
|
|
293
|
+
return async (level, message, logger) => {
|
|
294
|
+
if (!shouldLogMessage(level, minLogLevel)) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
await sendNotification({
|
|
298
|
+
method: "notifications/message",
|
|
299
|
+
params: {
|
|
300
|
+
level,
|
|
301
|
+
data: message,
|
|
302
|
+
logger: logger || "tool"
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
__name(createLogMethod, "createLogMethod");
|
|
308
|
+
function createEnhancedContext(baseContext, createMessage, elicitInput, progressToken, sendNotification, minLogLevel) {
|
|
256
309
|
const enhancedContext = baseContext ? Object.create(baseContext) : {};
|
|
257
310
|
enhancedContext.sample = createSampleMethod(
|
|
258
311
|
createMessage,
|
|
@@ -264,6 +317,7 @@ function createEnhancedContext(baseContext, createMessage, elicitInput, progress
|
|
|
264
317
|
progressToken,
|
|
265
318
|
sendNotification
|
|
266
319
|
);
|
|
320
|
+
enhancedContext.log = createLogMethod(sendNotification, minLogLevel);
|
|
267
321
|
return enhancedContext;
|
|
268
322
|
}
|
|
269
323
|
__name(createEnhancedContext, "createEnhancedContext");
|
|
@@ -276,5 +330,8 @@ export {
|
|
|
276
330
|
createSampleMethod,
|
|
277
331
|
createElicitMethod,
|
|
278
332
|
createReportProgressMethod,
|
|
333
|
+
VALID_LOG_LEVELS,
|
|
334
|
+
isValidLogLevel,
|
|
335
|
+
shouldLogMessage,
|
|
279
336
|
createEnhancedContext
|
|
280
337
|
};
|
|
@@ -5,14 +5,18 @@ import {
|
|
|
5
5
|
// src/server/context-storage.ts
|
|
6
6
|
import { AsyncLocalStorage } from "async_hooks";
|
|
7
7
|
var requestContextStorage = new AsyncLocalStorage();
|
|
8
|
-
async function runWithContext(context, fn) {
|
|
9
|
-
return requestContextStorage.run(context, fn);
|
|
8
|
+
async function runWithContext(context, fn, sessionId) {
|
|
9
|
+
return requestContextStorage.run({ honoContext: context, sessionId }, fn);
|
|
10
10
|
}
|
|
11
11
|
__name(runWithContext, "runWithContext");
|
|
12
12
|
function getRequestContext() {
|
|
13
|
-
return requestContextStorage.getStore();
|
|
13
|
+
return requestContextStorage.getStore()?.honoContext;
|
|
14
14
|
}
|
|
15
15
|
__name(getRequestContext, "getRequestContext");
|
|
16
|
+
function getSessionId() {
|
|
17
|
+
return requestContextStorage.getStore()?.sessionId;
|
|
18
|
+
}
|
|
19
|
+
__name(getSessionId, "getSessionId");
|
|
16
20
|
function hasRequestContext() {
|
|
17
21
|
return requestContextStorage.getStore() !== void 0;
|
|
18
22
|
}
|
|
@@ -21,5 +25,6 @@ __name(hasRequestContext, "hasRequestContext");
|
|
|
21
25
|
export {
|
|
22
26
|
runWithContext,
|
|
23
27
|
getRequestContext,
|
|
28
|
+
getSessionId,
|
|
24
29
|
hasRequestContext
|
|
25
30
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getRequestContext,
|
|
3
|
+
getSessionId,
|
|
3
4
|
hasRequestContext,
|
|
4
5
|
runWithContext
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LWVK6RXA.js";
|
|
6
7
|
import "./chunk-3GQAWCBQ.js";
|
|
7
8
|
export {
|
|
8
9
|
getRequestContext,
|
|
10
|
+
getSessionId,
|
|
9
11
|
hasRequestContext,
|
|
10
12
|
runWithContext
|
|
11
13
|
};
|
|
@@ -15,6 +15,7 @@ import type { Context } from "hono";
|
|
|
15
15
|
*
|
|
16
16
|
* @param context - Hono Context object to store
|
|
17
17
|
* @param fn - Function to execute within this context
|
|
18
|
+
* @param sessionId - Optional session ID to store with the context
|
|
18
19
|
* @returns Promise resolving to the function's return value
|
|
19
20
|
*
|
|
20
21
|
* @example
|
|
@@ -28,7 +29,7 @@ import type { Context } from "hono";
|
|
|
28
29
|
* });
|
|
29
30
|
* ```
|
|
30
31
|
*/
|
|
31
|
-
export declare function runWithContext<T>(context: Context, fn: () => Promise<T
|
|
32
|
+
export declare function runWithContext<T>(context: Context, fn: () => Promise<T>, sessionId?: string): Promise<T>;
|
|
32
33
|
/**
|
|
33
34
|
* Get the current request context from AsyncLocalStorage
|
|
34
35
|
*
|
|
@@ -45,6 +46,12 @@ export declare function runWithContext<T>(context: Context, fn: () => Promise<T>
|
|
|
45
46
|
* ```
|
|
46
47
|
*/
|
|
47
48
|
export declare function getRequestContext(): Context | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Get the current session ID from AsyncLocalStorage
|
|
51
|
+
*
|
|
52
|
+
* @returns The session ID for the current async operation, or undefined if not in a request context
|
|
53
|
+
*/
|
|
54
|
+
export declare function getSessionId(): string | undefined;
|
|
48
55
|
/**
|
|
49
56
|
* Check if currently executing within a request context
|
|
50
57
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-storage.d.ts","sourceRoot":"","sources":["../../../src/server/context-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"context-storage.d.ts","sourceRoot":"","sources":["../../../src/server/context-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAgBpC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,GAAG,SAAS,CAEvD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount-mcp.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/mount-mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAW,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,QAAQ,EACb,iBAAiB,EAAE,GAAG,EAAE,2DAA2D;AACnF,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAClC,MAAM,EAAE,YAAY,EACpB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,OAAO,CAAA;CAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"mount-mcp.d.ts","sourceRoot":"","sources":["../../../../src/server/endpoints/mount-mcp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAW,IAAI,IAAI,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,QAAQ,EACb,iBAAiB,EAAE,GAAG,EAAE,2DAA2D;AACnF,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,EAClC,MAAM,EAAE,YAAY,EACpB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC;IAAE,UAAU,EAAE,OAAO,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,OAAO,CAAA;CAAE,CAAC,CAkFxE"}
|