fastmcp 4.15.0 → 4.15.2
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/FastMCP.cjs +2 -2
- package/dist/FastMCP.d.cts +8 -0
- package/dist/FastMCP.d.ts +8 -0
- package/dist/FastMCP.js +1 -1
- package/dist/{chunk-3YTVMLYE.js → chunk-4VIPI4GU.js} +18 -13
- package/dist/chunk-4VIPI4GU.js.map +1 -0
- package/dist/{chunk-6I3JC3FN.cjs → chunk-N6ZZF5YB.cjs} +58 -53
- package/dist/chunk-N6ZZF5YB.cjs.map +1 -0
- package/dist/examples/custom-routes.cjs +2 -2
- package/dist/examples/custom-routes.js +1 -1
- package/package.json +1 -2
- package/dist/chunk-3YTVMLYE.js.map +0 -1
- package/dist/chunk-6I3JC3FN.cjs.map +0 -1
package/dist/FastMCP.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkN6ZZF5YBcjs = require('./chunk-N6ZZF5YB.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -49,5 +49,5 @@ var _chunk5FVNY65Mcjs = require('./chunk-5FVNY65M.cjs');
|
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
exports.AuthProvider = _chunk5FVNY65Mcjs.AuthProvider; exports.AzureProvider = _chunk5FVNY65Mcjs.AzureProvider; exports.DiscoveryDocumentCache =
|
|
52
|
+
exports.AuthProvider = _chunk5FVNY65Mcjs.AuthProvider; exports.AzureProvider = _chunk5FVNY65Mcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkN6ZZF5YBcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkN6ZZF5YBcjs.FastMCP; exports.FastMCPError = _chunkN6ZZF5YBcjs.FastMCPError; exports.FastMCPSession = _chunkN6ZZF5YBcjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkN6ZZF5YBcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunkN6ZZF5YBcjs.ServerState; exports.SessionError = _chunkN6ZZF5YBcjs.SessionError; exports.UnexpectedStateError = _chunkN6ZZF5YBcjs.UnexpectedStateError; exports.UserError = _chunkN6ZZF5YBcjs.UserError; exports.audioContent = _chunkN6ZZF5YBcjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunkN6ZZF5YBcjs.imageContent; exports.jsonSchemaAdapter = _chunkN6ZZF5YBcjs.jsonSchemaAdapter; exports.requireAll = _chunk5FVNY65Mcjs.requireAll; exports.requireAny = _chunk5FVNY65Mcjs.requireAny; exports.requireAuth = _chunk5FVNY65Mcjs.requireAuth; exports.requireRole = _chunk5FVNY65Mcjs.requireRole; exports.requireScopes = _chunk5FVNY65Mcjs.requireScopes;
|
|
53
53
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -884,6 +884,14 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
|
|
|
884
884
|
get loggingLevel(): LoggingLevel;
|
|
885
885
|
get roots(): Root[];
|
|
886
886
|
get server(): Server;
|
|
887
|
+
/**
|
|
888
|
+
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
889
|
+
*
|
|
890
|
+
* Resolved from the transport on every read rather than captured when the
|
|
891
|
+
* session connects: `StreamableHTTPServerTransport` assigns its `sessionId`
|
|
892
|
+
* while it handles `initialize`, which happens after `connect()` resolves.
|
|
893
|
+
* A value read at connect time is therefore still `undefined`.
|
|
894
|
+
*/
|
|
887
895
|
get sessionId(): string | undefined;
|
|
888
896
|
set sessionId(value: string | undefined);
|
|
889
897
|
constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -884,6 +884,14 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
|
|
|
884
884
|
get loggingLevel(): LoggingLevel;
|
|
885
885
|
get roots(): Root[];
|
|
886
886
|
get server(): Server;
|
|
887
|
+
/**
|
|
888
|
+
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
889
|
+
*
|
|
890
|
+
* Resolved from the transport on every read rather than captured when the
|
|
891
|
+
* session connects: `StreamableHTTPServerTransport` assigns its `sessionId`
|
|
892
|
+
* while it handles `initialize`, which happens after `connect()` resolves.
|
|
893
|
+
* A value read at connect time is therefore still `undefined`.
|
|
894
|
+
*/
|
|
887
895
|
get sessionId(): string | undefined;
|
|
888
896
|
set sessionId(value: string | undefined);
|
|
889
897
|
constructor({ auth, icons, instructions, logger, name, onToolCall, ping, prompts, resources, resourcesTemplates, roots, sessionId, stateless, streamKeepalive, title, tools, transportType, utils, version, websiteUrl, }: {
|
package/dist/FastMCP.js
CHANGED
|
@@ -23,7 +23,6 @@ import Fuse from "fuse.js";
|
|
|
23
23
|
import { Hono } from "hono";
|
|
24
24
|
import { startHTTPServer } from "mcp-proxy";
|
|
25
25
|
import { setTimeout as delay } from "timers/promises";
|
|
26
|
-
import { fetch as fetch2 } from "undici";
|
|
27
26
|
import parseURITemplate from "uri-templates";
|
|
28
27
|
import { strictJsonSchema, toJsonSchema } from "xsschema";
|
|
29
28
|
import { z } from "zod";
|
|
@@ -204,7 +203,7 @@ var imageContent = async (input) => {
|
|
|
204
203
|
if ("url" in input) {
|
|
205
204
|
const timeoutMs = input.timeoutMs ?? MEDIA_FETCH_TIMEOUT_MS;
|
|
206
205
|
try {
|
|
207
|
-
const response = await
|
|
206
|
+
const response = await fetch(input.url, {
|
|
208
207
|
signal: AbortSignal.timeout(timeoutMs)
|
|
209
208
|
});
|
|
210
209
|
if (!response.ok) {
|
|
@@ -265,7 +264,7 @@ var audioContent = async (input) => {
|
|
|
265
264
|
if ("url" in input) {
|
|
266
265
|
const timeoutMs = input.timeoutMs ?? MEDIA_FETCH_TIMEOUT_MS;
|
|
267
266
|
try {
|
|
268
|
-
const response = await
|
|
267
|
+
const response = await fetch(input.url, {
|
|
269
268
|
signal: AbortSignal.timeout(timeoutMs)
|
|
270
269
|
});
|
|
271
270
|
if (!response.ok) {
|
|
@@ -465,8 +464,20 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
465
464
|
get server() {
|
|
466
465
|
return this.#server;
|
|
467
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
469
|
+
*
|
|
470
|
+
* Resolved from the transport on every read rather than captured when the
|
|
471
|
+
* session connects: `StreamableHTTPServerTransport` assigns its `sessionId`
|
|
472
|
+
* while it handles `initialize`, which happens after `connect()` resolves.
|
|
473
|
+
* A value read at connect time is therefore still `undefined`.
|
|
474
|
+
*/
|
|
468
475
|
get sessionId() {
|
|
469
|
-
|
|
476
|
+
if (this.#sessionId !== void 0) {
|
|
477
|
+
return this.#sessionId;
|
|
478
|
+
}
|
|
479
|
+
const transport = this.#server.transport;
|
|
480
|
+
return typeof transport?.sessionId === "string" ? transport.sessionId : void 0;
|
|
470
481
|
}
|
|
471
482
|
set sessionId(value) {
|
|
472
483
|
this.#sessionId = value;
|
|
@@ -605,12 +616,6 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
605
616
|
this.#connectionState = "connecting";
|
|
606
617
|
try {
|
|
607
618
|
await this.#server.connect(transport);
|
|
608
|
-
if ("sessionId" in transport) {
|
|
609
|
-
const transportWithSessionId = transport;
|
|
610
|
-
if (typeof transportWithSessionId.sessionId === "string") {
|
|
611
|
-
this.#sessionId = transportWithSessionId.sessionId;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
619
|
if (!this.#stateless) {
|
|
615
620
|
let attempt = 0;
|
|
616
621
|
const maxAttempts = 10;
|
|
@@ -807,7 +812,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
807
812
|
log: this.#createLog(),
|
|
808
813
|
requestId: typeof meta?.requestId === "string" ? meta.requestId : void 0,
|
|
809
814
|
session: this.#auth,
|
|
810
|
-
sessionId: this
|
|
815
|
+
sessionId: this.sessionId
|
|
811
816
|
};
|
|
812
817
|
}
|
|
813
818
|
#createLog() {
|
|
@@ -1415,7 +1420,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1415
1420
|
reportProgress,
|
|
1416
1421
|
requestId: typeof request.params?._meta?.requestId === "string" ? request.params._meta.requestId : void 0,
|
|
1417
1422
|
session: this.#auth,
|
|
1418
|
-
sessionId: this
|
|
1423
|
+
sessionId: this.sessionId,
|
|
1419
1424
|
streamContent
|
|
1420
1425
|
})
|
|
1421
1426
|
);
|
|
@@ -2762,4 +2767,4 @@ export {
|
|
|
2762
2767
|
FastMCPSession,
|
|
2763
2768
|
FastMCP
|
|
2764
2769
|
};
|
|
2765
|
-
//# sourceMappingURL=chunk-
|
|
2770
|
+
//# sourceMappingURL=chunk-4VIPI4GU.js.map
|