fastmcp 4.15.1 → 4.15.3
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 +14 -0
- package/dist/FastMCP.d.ts +14 -0
- package/dist/FastMCP.js +1 -1
- package/dist/{chunk-MD6EC4EY.cjs → chunk-IXYHFFR6.cjs} +63 -49
- package/dist/chunk-IXYHFFR6.cjs.map +1 -0
- package/dist/{chunk-JI5H5LIK.js → chunk-UEBA2F55.js} +23 -9
- package/dist/chunk-UEBA2F55.js.map +1 -0
- package/dist/examples/custom-routes.cjs +2 -2
- package/dist/examples/custom-routes.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JI5H5LIK.js.map +0 -1
- package/dist/chunk-MD6EC4EY.cjs.map +0 -1
package/dist/FastMCP.cjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkIXYHFFR6cjs = require('./chunk-IXYHFFR6.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 = _chunkIXYHFFR6cjs.DiscoveryDocumentCache; exports.FastMCP = _chunkIXYHFFR6cjs.FastMCP; exports.FastMCPError = _chunkIXYHFFR6cjs.FastMCPError; exports.FastMCPSession = _chunkIXYHFFR6cjs.FastMCPSession; exports.GitHubProvider = _chunk5FVNY65Mcjs.GitHubProvider; exports.GoogleProvider = _chunk5FVNY65Mcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkIXYHFFR6cjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk5FVNY65Mcjs.OAuthProvider; exports.ServerState = _chunkIXYHFFR6cjs.ServerState; exports.SessionError = _chunkIXYHFFR6cjs.SessionError; exports.UnexpectedStateError = _chunkIXYHFFR6cjs.UnexpectedStateError; exports.UserError = _chunkIXYHFFR6cjs.UserError; exports.audioContent = _chunkIXYHFFR6cjs.audioContent; exports.getAuthSession = _chunk5FVNY65Mcjs.getAuthSession; exports.imageContent = _chunkIXYHFFR6cjs.imageContent; exports.jsonSchemaAdapter = _chunkIXYHFFR6cjs.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,20 @@ 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 rather than captured when the session
|
|
891
|
+
* connects: `StreamableHTTPServerTransport` assigns its `sessionId` while it
|
|
892
|
+
* handles `initialize`, which happens after `connect()` resolves. A value
|
|
893
|
+
* read at connect time is therefore still `undefined`.
|
|
894
|
+
*
|
|
895
|
+
* The first ID seen is latched, so the session keeps reporting it once the
|
|
896
|
+
* transport detaches — `Protocol` drops its transport reference on close,
|
|
897
|
+
* which would otherwise make the ID vanish mid-teardown. Latching is safe
|
|
898
|
+
* because {@link connect} refuses a second transport, so a session never
|
|
899
|
+
* sees two IDs.
|
|
900
|
+
*/
|
|
887
901
|
get sessionId(): string | undefined;
|
|
888
902
|
set sessionId(value: string | undefined);
|
|
889
903
|
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,20 @@ 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 rather than captured when the session
|
|
891
|
+
* connects: `StreamableHTTPServerTransport` assigns its `sessionId` while it
|
|
892
|
+
* handles `initialize`, which happens after `connect()` resolves. A value
|
|
893
|
+
* read at connect time is therefore still `undefined`.
|
|
894
|
+
*
|
|
895
|
+
* The first ID seen is latched, so the session keeps reporting it once the
|
|
896
|
+
* transport detaches — `Protocol` drops its transport reference on close,
|
|
897
|
+
* which would otherwise make the ID vanish mid-teardown. Latching is safe
|
|
898
|
+
* because {@link connect} refuses a second transport, so a session never
|
|
899
|
+
* sees two IDs.
|
|
900
|
+
*/
|
|
887
901
|
get sessionId(): string | undefined;
|
|
888
902
|
set sessionId(value: string | undefined);
|
|
889
903
|
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
|
@@ -464,7 +464,27 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
464
464
|
get server() {
|
|
465
465
|
return this.#server;
|
|
466
466
|
}
|
|
467
|
+
/**
|
|
468
|
+
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
469
|
+
*
|
|
470
|
+
* Resolved from the transport rather than captured when the session
|
|
471
|
+
* connects: `StreamableHTTPServerTransport` assigns its `sessionId` while it
|
|
472
|
+
* handles `initialize`, which happens after `connect()` resolves. A value
|
|
473
|
+
* read at connect time is therefore still `undefined`.
|
|
474
|
+
*
|
|
475
|
+
* The first ID seen is latched, so the session keeps reporting it once the
|
|
476
|
+
* transport detaches — `Protocol` drops its transport reference on close,
|
|
477
|
+
* which would otherwise make the ID vanish mid-teardown. Latching is safe
|
|
478
|
+
* because {@link connect} refuses a second transport, so a session never
|
|
479
|
+
* sees two IDs.
|
|
480
|
+
*/
|
|
467
481
|
get sessionId() {
|
|
482
|
+
if (this.#sessionId === void 0) {
|
|
483
|
+
const transportSessionId = _optionalChain([this, 'access', _9 => _9.#server, 'access', _10 => _10.transport, 'optionalAccess', _11 => _11.sessionId]);
|
|
484
|
+
if (typeof transportSessionId === "string") {
|
|
485
|
+
this.#sessionId = transportSessionId;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
468
488
|
return this.#sessionId;
|
|
469
489
|
}
|
|
470
490
|
set sessionId(value) {
|
|
@@ -604,12 +624,6 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
604
624
|
this.#connectionState = "connecting";
|
|
605
625
|
try {
|
|
606
626
|
await this.#server.connect(transport);
|
|
607
|
-
if ("sessionId" in transport) {
|
|
608
|
-
const transportWithSessionId = transport;
|
|
609
|
-
if (typeof transportWithSessionId.sessionId === "string") {
|
|
610
|
-
this.#sessionId = transportWithSessionId.sessionId;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
627
|
if (!this.#stateless) {
|
|
614
628
|
let attempt = 0;
|
|
615
629
|
const maxAttempts = 10;
|
|
@@ -628,10 +642,10 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
628
642
|
);
|
|
629
643
|
}
|
|
630
644
|
}
|
|
631
|
-
if (_optionalChain([this, 'access',
|
|
645
|
+
if (_optionalChain([this, 'access', _12 => _12.#rootsConfig, 'optionalAccess', _13 => _13.enabled]) !== false && _optionalChain([this, 'access', _14 => _14.#clientCapabilities, 'optionalAccess', _15 => _15.roots, 'optionalAccess', _16 => _16.listChanged]) && typeof this.#server.listRoots === "function") {
|
|
632
646
|
try {
|
|
633
647
|
const roots = await this.#server.listRoots();
|
|
634
|
-
this.#roots = _optionalChain([roots, 'optionalAccess',
|
|
648
|
+
this.#roots = _optionalChain([roots, 'optionalAccess', _17 => _17.roots]) || [];
|
|
635
649
|
} catch (e) {
|
|
636
650
|
if (e instanceof _typesjs.McpError && e.code === _typesjs.ErrorCode.MethodNotFound) {
|
|
637
651
|
this.#logger.debug(
|
|
@@ -804,9 +818,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
804
818
|
},
|
|
805
819
|
elicit: (params, options) => this.#server.elicitInput(params, options),
|
|
806
820
|
log: this.#createLog(),
|
|
807
|
-
requestId: typeof _optionalChain([meta, 'optionalAccess',
|
|
821
|
+
requestId: typeof _optionalChain([meta, 'optionalAccess', _18 => _18.requestId]) === "string" ? meta.requestId : void 0,
|
|
808
822
|
session: this.#auth,
|
|
809
|
-
sessionId: this
|
|
823
|
+
sessionId: this.sessionId
|
|
810
824
|
};
|
|
811
825
|
}
|
|
812
826
|
#createLog() {
|
|
@@ -850,8 +864,8 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
850
864
|
};
|
|
851
865
|
}
|
|
852
866
|
#formatSchemaIssues(issues) {
|
|
853
|
-
return _optionalChain([this, 'access',
|
|
854
|
-
const path = _optionalChain([issue, 'access',
|
|
867
|
+
return _optionalChain([this, 'access', _19 => _19.#utils, 'optionalAccess', _20 => _20.formatInvalidParamsErrorMessage]) ? this.#utils.formatInvalidParamsErrorMessage(issues) : issues.map((issue) => {
|
|
868
|
+
const path = _optionalChain([issue, 'access', _21 => _21.path, 'optionalAccess', _22 => _22.join, 'call', _23 => _23(".")]) || "root";
|
|
855
869
|
return `${path}: ${issue.message}`;
|
|
856
870
|
}).join(", ");
|
|
857
871
|
}
|
|
@@ -882,7 +896,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
882
896
|
*/
|
|
883
897
|
#startStreamKeepalive(extra, toolName) {
|
|
884
898
|
const config = this.#streamKeepaliveConfig;
|
|
885
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
899
|
+
if (!_optionalChain([config, 'optionalAccess', _24 => _24.enabled])) {
|
|
886
900
|
return () => {
|
|
887
901
|
};
|
|
888
902
|
}
|
|
@@ -902,9 +916,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
902
916
|
);
|
|
903
917
|
});
|
|
904
918
|
}, intervalMs);
|
|
905
|
-
_optionalChain([timer, 'access',
|
|
919
|
+
_optionalChain([timer, 'access', _25 => _25.unref, 'optionalCall', _26 => _26()]);
|
|
906
920
|
const stop = () => clearInterval(timer);
|
|
907
|
-
_optionalChain([extra, 'access',
|
|
921
|
+
_optionalChain([extra, 'access', _27 => _27.signal, 'optionalAccess', _28 => _28.addEventListener, 'call', _29 => _29("abort", stop, { once: true })]);
|
|
908
922
|
return stop;
|
|
909
923
|
}
|
|
910
924
|
async #validateStructuredContent(tool, value, toolName) {
|
|
@@ -1105,7 +1119,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1105
1119
|
result = await prompt.load(
|
|
1106
1120
|
args,
|
|
1107
1121
|
this.#auth,
|
|
1108
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1122
|
+
this.#createLoadContext(_optionalChain([request, 'access', _30 => _30.params, 'optionalAccess', _31 => _31._meta]))
|
|
1109
1123
|
);
|
|
1110
1124
|
} catch (error) {
|
|
1111
1125
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -1170,7 +1184,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1170
1184
|
const result = await resourceTemplate.load(
|
|
1171
1185
|
match,
|
|
1172
1186
|
this.#auth,
|
|
1173
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1187
|
+
this.#createLoadContext(_optionalChain([request, 'access', _32 => _32.params, 'optionalAccess', _33 => _33._meta]))
|
|
1174
1188
|
);
|
|
1175
1189
|
const resources = Array.isArray(result) ? result : [result];
|
|
1176
1190
|
return {
|
|
@@ -1195,7 +1209,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1195
1209
|
try {
|
|
1196
1210
|
maybeArrayResult = await resource.load(
|
|
1197
1211
|
this.#auth,
|
|
1198
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1212
|
+
this.#createLoadContext(_optionalChain([request, 'access', _34 => _34.params, 'optionalAccess', _35 => _35._meta]))
|
|
1199
1213
|
);
|
|
1200
1214
|
} catch (error) {
|
|
1201
1215
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -1258,7 +1272,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1258
1272
|
);
|
|
1259
1273
|
}
|
|
1260
1274
|
setupRootsHandlers() {
|
|
1261
|
-
if (_optionalChain([this, 'access',
|
|
1275
|
+
if (_optionalChain([this, 'access', _36 => _36.#rootsConfig, 'optionalAccess', _37 => _37.enabled]) === false) {
|
|
1262
1276
|
this.#logger.debug(
|
|
1263
1277
|
"[FastMCP debug] roots capability explicitly disabled via config"
|
|
1264
1278
|
);
|
|
@@ -1352,7 +1366,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1352
1366
|
}
|
|
1353
1367
|
args = parsed.value;
|
|
1354
1368
|
}
|
|
1355
|
-
const progressToken = _optionalChain([request, 'access',
|
|
1369
|
+
const progressToken = _optionalChain([request, 'access', _38 => _38.params, 'optionalAccess', _39 => _39._meta, 'optionalAccess', _40 => _40.progressToken]);
|
|
1356
1370
|
let result;
|
|
1357
1371
|
try {
|
|
1358
1372
|
const reportProgress = async (progress) => {
|
|
@@ -1412,9 +1426,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1412
1426
|
elicit: (params, options) => this.#server.elicitInput(params, options),
|
|
1413
1427
|
log,
|
|
1414
1428
|
reportProgress,
|
|
1415
|
-
requestId: typeof _optionalChain([request, 'access',
|
|
1429
|
+
requestId: typeof _optionalChain([request, 'access', _41 => _41.params, 'optionalAccess', _42 => _42._meta, 'optionalAccess', _43 => _43.requestId]) === "string" ? request.params._meta.requestId : void 0,
|
|
1416
1430
|
session: this.#auth,
|
|
1417
|
-
sessionId: this
|
|
1431
|
+
sessionId: this.sessionId,
|
|
1418
1432
|
streamContent
|
|
1419
1433
|
})
|
|
1420
1434
|
);
|
|
@@ -1528,7 +1542,7 @@ function normalizePath(path) {
|
|
|
1528
1542
|
return path.startsWith("/") ? path : `/${path}`;
|
|
1529
1543
|
}
|
|
1530
1544
|
function parseBasicAuthHeader(authHeader) {
|
|
1531
|
-
const basicMatch = _optionalChain([authHeader, 'optionalAccess',
|
|
1545
|
+
const basicMatch = _optionalChain([authHeader, 'optionalAccess', _44 => _44.match, 'call', _45 => _45(/^Basic\s+(.+)$/)]);
|
|
1532
1546
|
if (!basicMatch) return null;
|
|
1533
1547
|
try {
|
|
1534
1548
|
const credentials = Buffer.from(basicMatch[1], "base64").toString("utf-8");
|
|
@@ -2013,7 +2027,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2013
2027
|
enableJsonResponse: httpConfig.enableJsonResponse,
|
|
2014
2028
|
eventStore: httpConfig.eventStore,
|
|
2015
2029
|
host: httpConfig.host,
|
|
2016
|
-
..._optionalChain([this, 'access',
|
|
2030
|
+
..._optionalChain([this, 'access', _46 => _46.#options, 'access', _47 => _47.oauth, 'optionalAccess', _48 => _48.enabled]) && _optionalChain([this, 'access', _49 => _49.#options, 'access', _50 => _50.oauth, 'access', _51 => _51.protectedResource, 'optionalAccess', _52 => _52.resource]) ? {
|
|
2017
2031
|
oauth: {
|
|
2018
2032
|
protectedResource: {
|
|
2019
2033
|
resource: this.#options.oauth.protectedResource.resource
|
|
@@ -2062,7 +2076,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2062
2076
|
enableJsonResponse: httpConfig.enableJsonResponse,
|
|
2063
2077
|
eventStore: httpConfig.eventStore,
|
|
2064
2078
|
host: httpConfig.host,
|
|
2065
|
-
..._optionalChain([this, 'access',
|
|
2079
|
+
..._optionalChain([this, 'access', _53 => _53.#options, 'access', _54 => _54.oauth, 'optionalAccess', _55 => _55.enabled]) && _optionalChain([this, 'access', _56 => _56.#options, 'access', _57 => _57.oauth, 'access', _58 => _58.protectedResource, 'optionalAccess', _59 => _59.resource]) ? {
|
|
2066
2080
|
oauth: {
|
|
2067
2081
|
protectedResource: {
|
|
2068
2082
|
resource: this.#options.oauth.protectedResource.resource
|
|
@@ -2168,7 +2182,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2168
2182
|
*/
|
|
2169
2183
|
#createUnauthorizedResponse(message) {
|
|
2170
2184
|
const oauth = this.#options.oauth;
|
|
2171
|
-
const resource = _optionalChain([oauth, 'optionalAccess',
|
|
2185
|
+
const resource = _optionalChain([oauth, 'optionalAccess', _60 => _60.enabled]) ? _optionalChain([oauth, 'access', _61 => _61.protectedResource, 'optionalAccess', _62 => _62.resource]) : void 0;
|
|
2172
2186
|
const wwwAuthenticateParts = [
|
|
2173
2187
|
'error="invalid_token"',
|
|
2174
2188
|
`error_description="${message.replace(/"/g, '\\"')}"`
|
|
@@ -2280,7 +2294,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2280
2294
|
}
|
|
2281
2295
|
}
|
|
2282
2296
|
const oauthConfig = this.#options.oauth;
|
|
2283
|
-
if (_optionalChain([oauthConfig, 'optionalAccess',
|
|
2297
|
+
if (_optionalChain([oauthConfig, 'optionalAccess', _63 => _63.enabled]) && req.method === "GET") {
|
|
2284
2298
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
2285
2299
|
const authorizationServerMetadataPath = joinPaths(
|
|
2286
2300
|
"",
|
|
@@ -2314,8 +2328,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2314
2328
|
}
|
|
2315
2329
|
}
|
|
2316
2330
|
}
|
|
2317
|
-
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess',
|
|
2318
|
-
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess',
|
|
2331
|
+
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _64 => _64.proxy]);
|
|
2332
|
+
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _65 => _65.enabled])) {
|
|
2319
2333
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
2320
2334
|
const oauthPath = basePathRelativePath;
|
|
2321
2335
|
try {
|
|
@@ -2368,7 +2382,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2368
2382
|
const statusCode = error.statusCode || 400;
|
|
2369
2383
|
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
2370
2384
|
JSON.stringify(
|
|
2371
|
-
_optionalChain([error, 'access',
|
|
2385
|
+
_optionalChain([error, 'access', _66 => _66.toJSON, 'optionalCall', _67 => _67()]) || {
|
|
2372
2386
|
error: "invalid_request"
|
|
2373
2387
|
}
|
|
2374
2388
|
)
|
|
@@ -2395,7 +2409,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2395
2409
|
} catch (error) {
|
|
2396
2410
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2397
2411
|
JSON.stringify(
|
|
2398
|
-
_optionalChain([error, 'access',
|
|
2412
|
+
_optionalChain([error, 'access', _68 => _68.toJSON, 'optionalCall', _69 => _69()]) || {
|
|
2399
2413
|
error: "invalid_request"
|
|
2400
2414
|
}
|
|
2401
2415
|
)
|
|
@@ -2417,7 +2431,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2417
2431
|
} catch (error) {
|
|
2418
2432
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2419
2433
|
JSON.stringify(
|
|
2420
|
-
_optionalChain([error, 'access',
|
|
2434
|
+
_optionalChain([error, 'access', _70 => _70.toJSON, 'optionalCall', _71 => _71()]) || {
|
|
2421
2435
|
error: "server_error"
|
|
2422
2436
|
}
|
|
2423
2437
|
)
|
|
@@ -2486,7 +2500,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2486
2500
|
} catch (error) {
|
|
2487
2501
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2488
2502
|
JSON.stringify(
|
|
2489
|
-
_optionalChain([error, 'access',
|
|
2503
|
+
_optionalChain([error, 'access', _72 => _72.toJSON, 'optionalCall', _73 => _73()]) || {
|
|
2490
2504
|
error: "server_error"
|
|
2491
2505
|
}
|
|
2492
2506
|
)
|
|
@@ -2544,8 +2558,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2544
2558
|
const basicAuth = parseBasicAuthHeader(
|
|
2545
2559
|
req.headers.authorization
|
|
2546
2560
|
);
|
|
2547
|
-
const clientId = _optionalChain([basicAuth, 'optionalAccess',
|
|
2548
|
-
const clientSecret = _nullishCoalesce(_nullishCoalesce(_optionalChain([basicAuth, 'optionalAccess',
|
|
2561
|
+
const clientId = _optionalChain([basicAuth, 'optionalAccess', _74 => _74.clientId]) || params.get("client_id") || "";
|
|
2562
|
+
const clientSecret = _nullishCoalesce(_nullishCoalesce(_optionalChain([basicAuth, 'optionalAccess', _75 => _75.clientSecret]), () => ( params.get("client_secret"))), () => ( void 0));
|
|
2549
2563
|
let response;
|
|
2550
2564
|
if (grantType === "authorization_code") {
|
|
2551
2565
|
response = await oauthProxy.exchangeAuthorizationCode({
|
|
@@ -2575,7 +2589,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2575
2589
|
const statusCode = error.statusCode || 400;
|
|
2576
2590
|
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
2577
2591
|
JSON.stringify(
|
|
2578
|
-
_optionalChain([error, 'access',
|
|
2592
|
+
_optionalChain([error, 'access', _76 => _76.toJSON, 'optionalCall', _77 => _77()]) || {
|
|
2579
2593
|
error: "invalid_request"
|
|
2580
2594
|
}
|
|
2581
2595
|
)
|
|
@@ -2646,23 +2660,23 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2646
2660
|
const envBasePath = process.env.FASTMCP_BASE_PATH;
|
|
2647
2661
|
const envStateless = process.env.FASTMCP_STATELESS;
|
|
2648
2662
|
const envHost = process.env.FASTMCP_HOST;
|
|
2649
|
-
const transportType = _optionalChain([overrides, 'optionalAccess',
|
|
2663
|
+
const transportType = _optionalChain([overrides, 'optionalAccess', _78 => _78.transportType]) || (transportArg === "http-stream" ? "httpStream" : transportArg) || envTransport || "stdio";
|
|
2650
2664
|
if (transportType === "httpStream") {
|
|
2651
2665
|
const port = parseInt(
|
|
2652
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
2666
|
+
_optionalChain([overrides, 'optionalAccess', _79 => _79.httpStream, 'optionalAccess', _80 => _80.port, 'optionalAccess', _81 => _81.toString, 'call', _82 => _82()]) || portArg || envPort || "8080"
|
|
2653
2667
|
);
|
|
2654
|
-
const host = _optionalChain([overrides, 'optionalAccess',
|
|
2655
|
-
const endpoint = _optionalChain([overrides, 'optionalAccess',
|
|
2668
|
+
const host = _optionalChain([overrides, 'optionalAccess', _83 => _83.httpStream, 'optionalAccess', _84 => _84.host]) || hostArg || envHost || "localhost";
|
|
2669
|
+
const endpoint = _optionalChain([overrides, 'optionalAccess', _85 => _85.httpStream, 'optionalAccess', _86 => _86.endpoint]) || endpointArg || envEndpoint || "/mcp";
|
|
2656
2670
|
const basePath = normalizeBasePath(
|
|
2657
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
2671
|
+
_optionalChain([overrides, 'optionalAccess', _87 => _87.httpStream, 'optionalAccess', _88 => _88.basePath]) || basePathArg || envBasePath
|
|
2658
2672
|
);
|
|
2659
|
-
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess',
|
|
2660
|
-
const stateless = _optionalChain([overrides, 'optionalAccess',
|
|
2661
|
-
const cors = _optionalChain([overrides, 'optionalAccess',
|
|
2662
|
-
const eventStore = _optionalChain([overrides, 'optionalAccess',
|
|
2663
|
-
const sslCa = _optionalChain([overrides, 'optionalAccess',
|
|
2664
|
-
const sslCert = _optionalChain([overrides, 'optionalAccess',
|
|
2665
|
-
const sslKey = _optionalChain([overrides, 'optionalAccess',
|
|
2673
|
+
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _89 => _89.httpStream, 'optionalAccess', _90 => _90.enableJsonResponse]) || false;
|
|
2674
|
+
const stateless = _optionalChain([overrides, 'optionalAccess', _91 => _91.httpStream, 'optionalAccess', _92 => _92.stateless]) || statelessArg === "true" || envStateless === "true" || false;
|
|
2675
|
+
const cors = _optionalChain([overrides, 'optionalAccess', _93 => _93.httpStream, 'optionalAccess', _94 => _94.cors]);
|
|
2676
|
+
const eventStore = _optionalChain([overrides, 'optionalAccess', _95 => _95.httpStream, 'optionalAccess', _96 => _96.eventStore]);
|
|
2677
|
+
const sslCa = _optionalChain([overrides, 'optionalAccess', _97 => _97.httpStream, 'optionalAccess', _98 => _98.sslCa]);
|
|
2678
|
+
const sslCert = _optionalChain([overrides, 'optionalAccess', _99 => _99.httpStream, 'optionalAccess', _100 => _100.sslCert]);
|
|
2679
|
+
const sslKey = _optionalChain([overrides, 'optionalAccess', _101 => _101.httpStream, 'optionalAccess', _102 => _102.sslKey]);
|
|
2666
2680
|
return {
|
|
2667
2681
|
httpStream: {
|
|
2668
2682
|
basePath,
|
|
@@ -2761,4 +2775,4 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2761
2775
|
|
|
2762
2776
|
|
|
2763
2777
|
exports.DiscoveryDocumentCache = DiscoveryDocumentCache; exports.jsonSchemaAdapter = jsonSchemaAdapter; exports.MEDIA_FETCH_TIMEOUT_MS = MEDIA_FETCH_TIMEOUT_MS; exports.imageContent = imageContent; exports.audioContent = audioContent; exports.FastMCPError = FastMCPError; exports.SessionError = SessionError; exports.UnexpectedStateError = UnexpectedStateError; exports.UserError = UserError; exports.ServerState = ServerState; exports.FastMCPSession = FastMCPSession; exports.FastMCP = FastMCP;
|
|
2764
|
-
//# sourceMappingURL=chunk-
|
|
2778
|
+
//# sourceMappingURL=chunk-IXYHFFR6.cjs.map
|