fastmcp 4.15.2 → 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 +10 -4
- package/dist/FastMCP.d.ts +10 -4
- package/dist/FastMCP.js +1 -1
- package/dist/{chunk-N6ZZF5YB.cjs → chunk-IXYHFFR6.cjs} +57 -49
- package/dist/chunk-IXYHFFR6.cjs.map +1 -0
- package/dist/{chunk-4VIPI4GU.js → chunk-UEBA2F55.js} +17 -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-4VIPI4GU.js.map +0 -1
- package/dist/chunk-N6ZZF5YB.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
|
@@ -887,10 +887,16 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
|
|
|
887
887
|
/**
|
|
888
888
|
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
889
889
|
*
|
|
890
|
-
* Resolved from the transport
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
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.
|
|
894
900
|
*/
|
|
895
901
|
get sessionId(): string | undefined;
|
|
896
902
|
set sessionId(value: string | undefined);
|
package/dist/FastMCP.d.ts
CHANGED
|
@@ -887,10 +887,16 @@ declare class FastMCPSession<T extends FastMCPSessionAuth = FastMCPSessionAuth>
|
|
|
887
887
|
/**
|
|
888
888
|
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
889
889
|
*
|
|
890
|
-
* Resolved from the transport
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
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.
|
|
894
900
|
*/
|
|
895
901
|
get sessionId(): string | undefined;
|
|
896
902
|
set sessionId(value: string | undefined);
|
package/dist/FastMCP.js
CHANGED
|
@@ -467,17 +467,25 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
467
467
|
/**
|
|
468
468
|
* The HTTP session ID, or `undefined` for transports that do not have one.
|
|
469
469
|
*
|
|
470
|
-
* Resolved from the transport
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
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.
|
|
474
480
|
*/
|
|
475
481
|
get sessionId() {
|
|
476
|
-
if (this.#sessionId
|
|
477
|
-
|
|
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
|
+
}
|
|
478
487
|
}
|
|
479
|
-
|
|
480
|
-
return typeof _optionalChain([transport, 'optionalAccess', _9 => _9.sessionId]) === "string" ? transport.sessionId : void 0;
|
|
488
|
+
return this.#sessionId;
|
|
481
489
|
}
|
|
482
490
|
set sessionId(value) {
|
|
483
491
|
this.#sessionId = value;
|
|
@@ -634,10 +642,10 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
|
|
|
634
642
|
);
|
|
635
643
|
}
|
|
636
644
|
}
|
|
637
|
-
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") {
|
|
638
646
|
try {
|
|
639
647
|
const roots = await this.#server.listRoots();
|
|
640
|
-
this.#roots = _optionalChain([roots, 'optionalAccess',
|
|
648
|
+
this.#roots = _optionalChain([roots, 'optionalAccess', _17 => _17.roots]) || [];
|
|
641
649
|
} catch (e) {
|
|
642
650
|
if (e instanceof _typesjs.McpError && e.code === _typesjs.ErrorCode.MethodNotFound) {
|
|
643
651
|
this.#logger.debug(
|
|
@@ -810,7 +818,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
810
818
|
},
|
|
811
819
|
elicit: (params, options) => this.#server.elicitInput(params, options),
|
|
812
820
|
log: this.#createLog(),
|
|
813
|
-
requestId: typeof _optionalChain([meta, 'optionalAccess',
|
|
821
|
+
requestId: typeof _optionalChain([meta, 'optionalAccess', _18 => _18.requestId]) === "string" ? meta.requestId : void 0,
|
|
814
822
|
session: this.#auth,
|
|
815
823
|
sessionId: this.sessionId
|
|
816
824
|
};
|
|
@@ -856,8 +864,8 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
856
864
|
};
|
|
857
865
|
}
|
|
858
866
|
#formatSchemaIssues(issues) {
|
|
859
|
-
return _optionalChain([this, 'access',
|
|
860
|
-
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";
|
|
861
869
|
return `${path}: ${issue.message}`;
|
|
862
870
|
}).join(", ");
|
|
863
871
|
}
|
|
@@ -888,7 +896,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
888
896
|
*/
|
|
889
897
|
#startStreamKeepalive(extra, toolName) {
|
|
890
898
|
const config = this.#streamKeepaliveConfig;
|
|
891
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
899
|
+
if (!_optionalChain([config, 'optionalAccess', _24 => _24.enabled])) {
|
|
892
900
|
return () => {
|
|
893
901
|
};
|
|
894
902
|
}
|
|
@@ -908,9 +916,9 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
908
916
|
);
|
|
909
917
|
});
|
|
910
918
|
}, intervalMs);
|
|
911
|
-
_optionalChain([timer, 'access',
|
|
919
|
+
_optionalChain([timer, 'access', _25 => _25.unref, 'optionalCall', _26 => _26()]);
|
|
912
920
|
const stop = () => clearInterval(timer);
|
|
913
|
-
_optionalChain([extra, 'access',
|
|
921
|
+
_optionalChain([extra, 'access', _27 => _27.signal, 'optionalAccess', _28 => _28.addEventListener, 'call', _29 => _29("abort", stop, { once: true })]);
|
|
914
922
|
return stop;
|
|
915
923
|
}
|
|
916
924
|
async #validateStructuredContent(tool, value, toolName) {
|
|
@@ -1111,7 +1119,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1111
1119
|
result = await prompt.load(
|
|
1112
1120
|
args,
|
|
1113
1121
|
this.#auth,
|
|
1114
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1122
|
+
this.#createLoadContext(_optionalChain([request, 'access', _30 => _30.params, 'optionalAccess', _31 => _31._meta]))
|
|
1115
1123
|
);
|
|
1116
1124
|
} catch (error) {
|
|
1117
1125
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -1176,7 +1184,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1176
1184
|
const result = await resourceTemplate.load(
|
|
1177
1185
|
match,
|
|
1178
1186
|
this.#auth,
|
|
1179
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1187
|
+
this.#createLoadContext(_optionalChain([request, 'access', _32 => _32.params, 'optionalAccess', _33 => _33._meta]))
|
|
1180
1188
|
);
|
|
1181
1189
|
const resources = Array.isArray(result) ? result : [result];
|
|
1182
1190
|
return {
|
|
@@ -1201,7 +1209,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1201
1209
|
try {
|
|
1202
1210
|
maybeArrayResult = await resource.load(
|
|
1203
1211
|
this.#auth,
|
|
1204
|
-
this.#createLoadContext(_optionalChain([request, 'access',
|
|
1212
|
+
this.#createLoadContext(_optionalChain([request, 'access', _34 => _34.params, 'optionalAccess', _35 => _35._meta]))
|
|
1205
1213
|
);
|
|
1206
1214
|
} catch (error) {
|
|
1207
1215
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
@@ -1264,7 +1272,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1264
1272
|
);
|
|
1265
1273
|
}
|
|
1266
1274
|
setupRootsHandlers() {
|
|
1267
|
-
if (_optionalChain([this, 'access',
|
|
1275
|
+
if (_optionalChain([this, 'access', _36 => _36.#rootsConfig, 'optionalAccess', _37 => _37.enabled]) === false) {
|
|
1268
1276
|
this.#logger.debug(
|
|
1269
1277
|
"[FastMCP debug] roots capability explicitly disabled via config"
|
|
1270
1278
|
);
|
|
@@ -1358,7 +1366,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1358
1366
|
}
|
|
1359
1367
|
args = parsed.value;
|
|
1360
1368
|
}
|
|
1361
|
-
const progressToken = _optionalChain([request, 'access',
|
|
1369
|
+
const progressToken = _optionalChain([request, 'access', _38 => _38.params, 'optionalAccess', _39 => _39._meta, 'optionalAccess', _40 => _40.progressToken]);
|
|
1362
1370
|
let result;
|
|
1363
1371
|
try {
|
|
1364
1372
|
const reportProgress = async (progress) => {
|
|
@@ -1418,7 +1426,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1418
1426
|
elicit: (params, options) => this.#server.elicitInput(params, options),
|
|
1419
1427
|
log,
|
|
1420
1428
|
reportProgress,
|
|
1421
|
-
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,
|
|
1422
1430
|
session: this.#auth,
|
|
1423
1431
|
sessionId: this.sessionId,
|
|
1424
1432
|
streamContent
|
|
@@ -1534,7 +1542,7 @@ function normalizePath(path) {
|
|
|
1534
1542
|
return path.startsWith("/") ? path : `/${path}`;
|
|
1535
1543
|
}
|
|
1536
1544
|
function parseBasicAuthHeader(authHeader) {
|
|
1537
|
-
const basicMatch = _optionalChain([authHeader, 'optionalAccess',
|
|
1545
|
+
const basicMatch = _optionalChain([authHeader, 'optionalAccess', _44 => _44.match, 'call', _45 => _45(/^Basic\s+(.+)$/)]);
|
|
1538
1546
|
if (!basicMatch) return null;
|
|
1539
1547
|
try {
|
|
1540
1548
|
const credentials = Buffer.from(basicMatch[1], "base64").toString("utf-8");
|
|
@@ -2019,7 +2027,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2019
2027
|
enableJsonResponse: httpConfig.enableJsonResponse,
|
|
2020
2028
|
eventStore: httpConfig.eventStore,
|
|
2021
2029
|
host: httpConfig.host,
|
|
2022
|
-
..._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]) ? {
|
|
2023
2031
|
oauth: {
|
|
2024
2032
|
protectedResource: {
|
|
2025
2033
|
resource: this.#options.oauth.protectedResource.resource
|
|
@@ -2068,7 +2076,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2068
2076
|
enableJsonResponse: httpConfig.enableJsonResponse,
|
|
2069
2077
|
eventStore: httpConfig.eventStore,
|
|
2070
2078
|
host: httpConfig.host,
|
|
2071
|
-
..._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]) ? {
|
|
2072
2080
|
oauth: {
|
|
2073
2081
|
protectedResource: {
|
|
2074
2082
|
resource: this.#options.oauth.protectedResource.resource
|
|
@@ -2174,7 +2182,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2174
2182
|
*/
|
|
2175
2183
|
#createUnauthorizedResponse(message) {
|
|
2176
2184
|
const oauth = this.#options.oauth;
|
|
2177
|
-
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;
|
|
2178
2186
|
const wwwAuthenticateParts = [
|
|
2179
2187
|
'error="invalid_token"',
|
|
2180
2188
|
`error_description="${message.replace(/"/g, '\\"')}"`
|
|
@@ -2286,7 +2294,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2286
2294
|
}
|
|
2287
2295
|
}
|
|
2288
2296
|
const oauthConfig = this.#options.oauth;
|
|
2289
|
-
if (_optionalChain([oauthConfig, 'optionalAccess',
|
|
2297
|
+
if (_optionalChain([oauthConfig, 'optionalAccess', _63 => _63.enabled]) && req.method === "GET") {
|
|
2290
2298
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
2291
2299
|
const authorizationServerMetadataPath = joinPaths(
|
|
2292
2300
|
"",
|
|
@@ -2320,8 +2328,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2320
2328
|
}
|
|
2321
2329
|
}
|
|
2322
2330
|
}
|
|
2323
|
-
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess',
|
|
2324
|
-
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess',
|
|
2331
|
+
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _64 => _64.proxy]);
|
|
2332
|
+
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _65 => _65.enabled])) {
|
|
2325
2333
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
2326
2334
|
const oauthPath = basePathRelativePath;
|
|
2327
2335
|
try {
|
|
@@ -2374,7 +2382,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2374
2382
|
const statusCode = error.statusCode || 400;
|
|
2375
2383
|
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
2376
2384
|
JSON.stringify(
|
|
2377
|
-
_optionalChain([error, 'access',
|
|
2385
|
+
_optionalChain([error, 'access', _66 => _66.toJSON, 'optionalCall', _67 => _67()]) || {
|
|
2378
2386
|
error: "invalid_request"
|
|
2379
2387
|
}
|
|
2380
2388
|
)
|
|
@@ -2401,7 +2409,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2401
2409
|
} catch (error) {
|
|
2402
2410
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2403
2411
|
JSON.stringify(
|
|
2404
|
-
_optionalChain([error, 'access',
|
|
2412
|
+
_optionalChain([error, 'access', _68 => _68.toJSON, 'optionalCall', _69 => _69()]) || {
|
|
2405
2413
|
error: "invalid_request"
|
|
2406
2414
|
}
|
|
2407
2415
|
)
|
|
@@ -2423,7 +2431,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2423
2431
|
} catch (error) {
|
|
2424
2432
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2425
2433
|
JSON.stringify(
|
|
2426
|
-
_optionalChain([error, 'access',
|
|
2434
|
+
_optionalChain([error, 'access', _70 => _70.toJSON, 'optionalCall', _71 => _71()]) || {
|
|
2427
2435
|
error: "server_error"
|
|
2428
2436
|
}
|
|
2429
2437
|
)
|
|
@@ -2492,7 +2500,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2492
2500
|
} catch (error) {
|
|
2493
2501
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
2494
2502
|
JSON.stringify(
|
|
2495
|
-
_optionalChain([error, 'access',
|
|
2503
|
+
_optionalChain([error, 'access', _72 => _72.toJSON, 'optionalCall', _73 => _73()]) || {
|
|
2496
2504
|
error: "server_error"
|
|
2497
2505
|
}
|
|
2498
2506
|
)
|
|
@@ -2550,8 +2558,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2550
2558
|
const basicAuth = parseBasicAuthHeader(
|
|
2551
2559
|
req.headers.authorization
|
|
2552
2560
|
);
|
|
2553
|
-
const clientId = _optionalChain([basicAuth, 'optionalAccess',
|
|
2554
|
-
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));
|
|
2555
2563
|
let response;
|
|
2556
2564
|
if (grantType === "authorization_code") {
|
|
2557
2565
|
response = await oauthProxy.exchangeAuthorizationCode({
|
|
@@ -2581,7 +2589,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2581
2589
|
const statusCode = error.statusCode || 400;
|
|
2582
2590
|
res.writeHead(statusCode, { "Content-Type": "application/json" }).end(
|
|
2583
2591
|
JSON.stringify(
|
|
2584
|
-
_optionalChain([error, 'access',
|
|
2592
|
+
_optionalChain([error, 'access', _76 => _76.toJSON, 'optionalCall', _77 => _77()]) || {
|
|
2585
2593
|
error: "invalid_request"
|
|
2586
2594
|
}
|
|
2587
2595
|
)
|
|
@@ -2652,23 +2660,23 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2652
2660
|
const envBasePath = process.env.FASTMCP_BASE_PATH;
|
|
2653
2661
|
const envStateless = process.env.FASTMCP_STATELESS;
|
|
2654
2662
|
const envHost = process.env.FASTMCP_HOST;
|
|
2655
|
-
const transportType = _optionalChain([overrides, 'optionalAccess',
|
|
2663
|
+
const transportType = _optionalChain([overrides, 'optionalAccess', _78 => _78.transportType]) || (transportArg === "http-stream" ? "httpStream" : transportArg) || envTransport || "stdio";
|
|
2656
2664
|
if (transportType === "httpStream") {
|
|
2657
2665
|
const port = parseInt(
|
|
2658
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
2666
|
+
_optionalChain([overrides, 'optionalAccess', _79 => _79.httpStream, 'optionalAccess', _80 => _80.port, 'optionalAccess', _81 => _81.toString, 'call', _82 => _82()]) || portArg || envPort || "8080"
|
|
2659
2667
|
);
|
|
2660
|
-
const host = _optionalChain([overrides, 'optionalAccess',
|
|
2661
|
-
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";
|
|
2662
2670
|
const basePath = normalizeBasePath(
|
|
2663
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
2671
|
+
_optionalChain([overrides, 'optionalAccess', _87 => _87.httpStream, 'optionalAccess', _88 => _88.basePath]) || basePathArg || envBasePath
|
|
2664
2672
|
);
|
|
2665
|
-
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess',
|
|
2666
|
-
const stateless = _optionalChain([overrides, 'optionalAccess',
|
|
2667
|
-
const cors = _optionalChain([overrides, 'optionalAccess',
|
|
2668
|
-
const eventStore = _optionalChain([overrides, 'optionalAccess',
|
|
2669
|
-
const sslCa = _optionalChain([overrides, 'optionalAccess',
|
|
2670
|
-
const sslCert = _optionalChain([overrides, 'optionalAccess',
|
|
2671
|
-
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]);
|
|
2672
2680
|
return {
|
|
2673
2681
|
httpStream: {
|
|
2674
2682
|
basePath,
|
|
@@ -2767,4 +2775,4 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2767
2775
|
|
|
2768
2776
|
|
|
2769
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;
|
|
2770
|
-
//# sourceMappingURL=chunk-
|
|
2778
|
+
//# sourceMappingURL=chunk-IXYHFFR6.cjs.map
|