fastmcp 4.22.9 → 4.22.11
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 +2 -1
- package/dist/FastMCP.d.ts +2 -1
- package/dist/FastMCP.js +1 -1
- package/dist/{chunk-PVW7IVUE.js → chunk-ETHWZXZK.js} +34 -42
- package/dist/chunk-ETHWZXZK.js.map +1 -0
- package/dist/{chunk-YDWOFVQN.cjs → chunk-X7KNHPR4.cjs} +59 -67
- package/dist/chunk-X7KNHPR4.cjs.map +1 -0
- package/dist/edge/index.cjs +6 -0
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.js +6 -0
- package/dist/edge/index.js.map +1 -1
- package/dist/examples/custom-routes.cjs +2 -2
- package/dist/examples/custom-routes.js +1 -1
- package/dist/openapi/index.cjs +6 -6
- package/dist/openapi/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-PVW7IVUE.js.map +0 -1
- package/dist/chunk-YDWOFVQN.cjs.map +0 -1
package/dist/FastMCP.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkX7KNHPR4cjs = require('./chunk-X7KNHPR4.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -50,5 +50,5 @@ require('./chunk-O22SYZMC.cjs');
|
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
|
|
53
|
-
exports.AuthProvider = _chunkYLLBANV4cjs.AuthProvider; exports.AzureProvider = _chunkYLLBANV4cjs.AzureProvider; exports.DiscoveryDocumentCache =
|
|
53
|
+
exports.AuthProvider = _chunkYLLBANV4cjs.AuthProvider; exports.AzureProvider = _chunkYLLBANV4cjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkX7KNHPR4cjs.DiscoveryDocumentCache; exports.FastMCP = _chunkX7KNHPR4cjs.FastMCP; exports.FastMCPError = _chunkX7KNHPR4cjs.FastMCPError; exports.FastMCPSession = _chunkX7KNHPR4cjs.FastMCPSession; exports.GitHubProvider = _chunkYLLBANV4cjs.GitHubProvider; exports.GoogleProvider = _chunkYLLBANV4cjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkX7KNHPR4cjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkYLLBANV4cjs.OAuthProvider; exports.ServerState = _chunkX7KNHPR4cjs.ServerState; exports.SessionError = _chunkX7KNHPR4cjs.SessionError; exports.UnexpectedStateError = _chunkX7KNHPR4cjs.UnexpectedStateError; exports.UserError = _chunkX7KNHPR4cjs.UserError; exports.audioContent = _chunkX7KNHPR4cjs.audioContent; exports.getAuthSession = _chunkYLLBANV4cjs.getAuthSession; exports.imageContent = _chunkX7KNHPR4cjs.imageContent; exports.jsonSchemaAdapter = _chunkX7KNHPR4cjs.jsonSchemaAdapter; exports.requireAll = _chunkYLLBANV4cjs.requireAll; exports.requireAny = _chunkYLLBANV4cjs.requireAny; exports.requireAuth = _chunkYLLBANV4cjs.requireAuth; exports.requireRole = _chunkYLLBANV4cjs.requireRole; exports.requireScopes = _chunkYLLBANV4cjs.requireScopes;
|
|
54
54
|
//# sourceMappingURL=FastMCP.cjs.map
|
package/dist/FastMCP.d.cts
CHANGED
|
@@ -1049,7 +1049,8 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
|
|
|
1049
1049
|
*
|
|
1050
1050
|
* The transport's lifecycle belongs to the caller: `stop()` does not close
|
|
1051
1051
|
* transports passed here. Close the returned session (or the transport) when
|
|
1052
|
-
* you are done with it.
|
|
1052
|
+
* you are done with it. If the client hangs up before the session is set up,
|
|
1053
|
+
* the returned session is already closed and is not listed in `sessions`.
|
|
1053
1054
|
*
|
|
1054
1055
|
* @param transport - An already-constructed MCP server transport.
|
|
1055
1056
|
* @param auth - Session auth, equivalent to what `authenticate` would return.
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -1049,7 +1049,8 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
|
|
|
1049
1049
|
*
|
|
1050
1050
|
* The transport's lifecycle belongs to the caller: `stop()` does not close
|
|
1051
1051
|
* transports passed here. Close the returned session (or the transport) when
|
|
1052
|
-
* you are done with it.
|
|
1052
|
+
* you are done with it. If the client hangs up before the session is set up,
|
|
1053
|
+
* the returned session is already closed and is not listed in `sessions`.
|
|
1053
1054
|
*
|
|
1054
1055
|
* @param transport - An already-constructed MCP server transport.
|
|
1055
1056
|
* @param auth - Session auth, equivalent to what `authenticate` would return.
|
package/dist/FastMCP.js
CHANGED
|
@@ -1308,7 +1308,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1308
1308
|
let result;
|
|
1309
1309
|
try {
|
|
1310
1310
|
result = await prompt.load(
|
|
1311
|
-
args,
|
|
1311
|
+
args ?? {},
|
|
1312
1312
|
this.#auth,
|
|
1313
1313
|
this.#createLoadContext(request.params?._meta)
|
|
1314
1314
|
);
|
|
@@ -2005,7 +2005,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2005
2005
|
*
|
|
2006
2006
|
* The transport's lifecycle belongs to the caller: `stop()` does not close
|
|
2007
2007
|
* transports passed here. Close the returned session (or the transport) when
|
|
2008
|
-
* you are done with it.
|
|
2008
|
+
* you are done with it. If the client hangs up before the session is set up,
|
|
2009
|
+
* the returned session is already closed and is not listed in `sessions`.
|
|
2009
2010
|
*
|
|
2010
2011
|
* @param transport - An already-constructed MCP server transport.
|
|
2011
2012
|
* @param auth - Session auth, equivalent to what `authenticate` would return.
|
|
@@ -2013,21 +2014,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2013
2014
|
*/
|
|
2014
2015
|
async connect(transport, auth) {
|
|
2015
2016
|
const session = this.#createSession(auth);
|
|
2016
|
-
await session
|
|
2017
|
-
this.#sessions.push(session);
|
|
2018
|
-
session.once("error", () => {
|
|
2019
|
-
this.#removeSession(session);
|
|
2020
|
-
});
|
|
2021
|
-
const originalOnClose = transport.onclose;
|
|
2022
|
-
transport.onclose = () => {
|
|
2023
|
-
this.#removeSession(session);
|
|
2024
|
-
if (originalOnClose) {
|
|
2025
|
-
originalOnClose();
|
|
2026
|
-
}
|
|
2027
|
-
};
|
|
2028
|
-
this.emit("connect", {
|
|
2029
|
-
session
|
|
2030
|
-
});
|
|
2017
|
+
await this.#connectSession(session, transport);
|
|
2031
2018
|
this.#serverState = "running" /* Running */;
|
|
2032
2019
|
return session;
|
|
2033
2020
|
}
|
|
@@ -2265,7 +2252,6 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2265
2252
|
version: this.#options.version,
|
|
2266
2253
|
websiteUrl: this.#options.websiteUrl
|
|
2267
2254
|
});
|
|
2268
|
-
await session.connect(transport);
|
|
2269
2255
|
let stdinClosed = false;
|
|
2270
2256
|
const onStdinClose = () => {
|
|
2271
2257
|
if (stdinClosed) return;
|
|
@@ -2277,29 +2263,9 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2277
2263
|
};
|
|
2278
2264
|
process.stdin.on("close", onStdinClose);
|
|
2279
2265
|
process.stdin.on("end", onStdinClose);
|
|
2280
|
-
this.#
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
});
|
|
2284
|
-
if (transport.onclose) {
|
|
2285
|
-
const originalOnClose = transport.onclose;
|
|
2286
|
-
transport.onclose = () => {
|
|
2287
|
-
process.stdin.off("close", onStdinClose);
|
|
2288
|
-
process.stdin.off("end", onStdinClose);
|
|
2289
|
-
this.#removeSession(session);
|
|
2290
|
-
if (originalOnClose) {
|
|
2291
|
-
originalOnClose();
|
|
2292
|
-
}
|
|
2293
|
-
};
|
|
2294
|
-
} else {
|
|
2295
|
-
transport.onclose = () => {
|
|
2296
|
-
process.stdin.off("close", onStdinClose);
|
|
2297
|
-
process.stdin.off("end", onStdinClose);
|
|
2298
|
-
this.#removeSession(session);
|
|
2299
|
-
};
|
|
2300
|
-
}
|
|
2301
|
-
this.emit("connect", {
|
|
2302
|
-
session
|
|
2266
|
+
await this.#connectSession(session, transport, () => {
|
|
2267
|
+
process.stdin.off("close", onStdinClose);
|
|
2268
|
+
process.stdin.off("end", onStdinClose);
|
|
2303
2269
|
});
|
|
2304
2270
|
this.#serverState = "running" /* Running */;
|
|
2305
2271
|
} else if (config.transportType === "httpStream") {
|
|
@@ -2421,6 +2387,32 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2421
2387
|
}
|
|
2422
2388
|
this.#serverState = "stopped" /* Stopped */;
|
|
2423
2389
|
}
|
|
2390
|
+
/**
|
|
2391
|
+
* Connects `session` to `transport` and lists it in `sessions` until the
|
|
2392
|
+
* transport closes. The close is watched from before the session connects,
|
|
2393
|
+
* so a client that hangs up during setup leaves no session behind.
|
|
2394
|
+
*/
|
|
2395
|
+
async #connectSession(session, transport, onClose) {
|
|
2396
|
+
let closed = false;
|
|
2397
|
+
const originalOnClose = transport.onclose;
|
|
2398
|
+
transport.onclose = () => {
|
|
2399
|
+
closed = true;
|
|
2400
|
+
onClose?.();
|
|
2401
|
+
this.#removeSession(session);
|
|
2402
|
+
originalOnClose?.();
|
|
2403
|
+
};
|
|
2404
|
+
await session.connect(transport);
|
|
2405
|
+
if (closed) {
|
|
2406
|
+
return;
|
|
2407
|
+
}
|
|
2408
|
+
this.#sessions.push(session);
|
|
2409
|
+
session.once("error", () => {
|
|
2410
|
+
this.#removeSession(session);
|
|
2411
|
+
});
|
|
2412
|
+
this.emit("connect", {
|
|
2413
|
+
session
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2424
2416
|
/**
|
|
2425
2417
|
* Creates a new FastMCPSession instance with the current configuration.
|
|
2426
2418
|
* Used both for regular sessions and stateless requests.
|
|
@@ -3177,4 +3169,4 @@ export {
|
|
|
3177
3169
|
FastMCPSession,
|
|
3178
3170
|
FastMCP
|
|
3179
3171
|
};
|
|
3180
|
-
//# sourceMappingURL=chunk-
|
|
3172
|
+
//# sourceMappingURL=chunk-ETHWZXZK.js.map
|