fastmcp 4.30.1 → 4.30.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.js +1 -1
- package/dist/{chunk-5KA6SOWT.js → chunk-3JQE5IXF.js} +59 -31
- package/dist/chunk-3JQE5IXF.js.map +1 -0
- package/dist/{chunk-4JEDH2ON.cjs → chunk-LTBNX7PX.cjs} +101 -73
- package/dist/chunk-LTBNX7PX.cjs.map +1 -0
- package/dist/examples/custom-routes.cjs +2 -2
- package/dist/examples/custom-routes.js +1 -1
- package/dist/openapi/index.cjs +9 -9
- package/dist/openapi/index.cjs.map +1 -1
- package/dist/openapi/index.js +3 -3
- package/dist/openapi/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4JEDH2ON.cjs.map +0 -1
- package/dist/chunk-5KA6SOWT.js.map +0 -1
|
@@ -1029,7 +1029,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1029
1029
|
streamableHttp ? { timeout: 1e3 } : void 0
|
|
1030
1030
|
);
|
|
1031
1031
|
this.#roots = _optionalChain([roots, 'optionalAccess', _40 => _40.roots]) || [];
|
|
1032
|
-
if (streamableHttp) {
|
|
1032
|
+
if (streamableHttp || this.#connectionState === "ready") {
|
|
1033
1033
|
this.emit("rootsChanged", { roots: this.#roots });
|
|
1034
1034
|
}
|
|
1035
1035
|
return;
|
|
@@ -1101,6 +1101,28 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1101
1101
|
);
|
|
1102
1102
|
});
|
|
1103
1103
|
}
|
|
1104
|
+
/**
|
|
1105
|
+
* A gateway can start a stdio server long before any client connects and
|
|
1106
|
+
* forward the first initialize only then, after #setUpSession stopped
|
|
1107
|
+
* waiting for it. Finish the setup when that client initializes.
|
|
1108
|
+
*/
|
|
1109
|
+
#setUpLateClient(streamableHttp) {
|
|
1110
|
+
const finish = () => {
|
|
1111
|
+
const capabilities = this.#server.getClientCapabilities();
|
|
1112
|
+
if (!capabilities || this.#clientCapabilities || this.#connectionState === "closed") {
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
this.#clientCapabilities = capabilities;
|
|
1116
|
+
void this.#loadRoots(streamableHttp);
|
|
1117
|
+
this.#startPing();
|
|
1118
|
+
};
|
|
1119
|
+
const oninitialized = this.#server.oninitialized;
|
|
1120
|
+
this.#server.oninitialized = () => {
|
|
1121
|
+
_optionalChain([oninitialized, 'optionalCall', _43 => _43()]);
|
|
1122
|
+
finish();
|
|
1123
|
+
};
|
|
1124
|
+
finish();
|
|
1125
|
+
}
|
|
1104
1126
|
async #setUpSession(streamableHttp) {
|
|
1105
1127
|
if (!this.#stateless) {
|
|
1106
1128
|
let attempt = 0;
|
|
@@ -1135,38 +1157,44 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1135
1157
|
}
|
|
1136
1158
|
}
|
|
1137
1159
|
if (this.#clientCapabilities) {
|
|
1138
|
-
|
|
1139
|
-
if (pingConfig.enabled) {
|
|
1140
|
-
this.#pingInterval = setInterval(async () => {
|
|
1141
|
-
if (this.#pingInFlight) {
|
|
1142
|
-
return;
|
|
1143
|
-
}
|
|
1144
|
-
this.#pingInFlight = true;
|
|
1145
|
-
try {
|
|
1146
|
-
await this.#server.ping();
|
|
1147
|
-
} catch (e4) {
|
|
1148
|
-
const logLevel = pingConfig.logLevel;
|
|
1149
|
-
if (logLevel === "debug") {
|
|
1150
|
-
this.#logger.debug("[FastMCP debug] server ping failed");
|
|
1151
|
-
} else if (logLevel === "warning") {
|
|
1152
|
-
this.#logger.warn(
|
|
1153
|
-
"[FastMCP warning] server is not responding to ping"
|
|
1154
|
-
);
|
|
1155
|
-
} else if (logLevel === "error") {
|
|
1156
|
-
this.#logger.error(
|
|
1157
|
-
"[FastMCP error] server is not responding to ping"
|
|
1158
|
-
);
|
|
1159
|
-
} else {
|
|
1160
|
-
this.#logger.info("[FastMCP info] server ping failed");
|
|
1161
|
-
}
|
|
1162
|
-
} finally {
|
|
1163
|
-
this.#pingInFlight = false;
|
|
1164
|
-
}
|
|
1165
|
-
}, pingConfig.intervalMs);
|
|
1166
|
-
}
|
|
1160
|
+
this.#startPing();
|
|
1167
1161
|
}
|
|
1168
1162
|
this.#connectionState = "ready";
|
|
1169
1163
|
this.emit("ready");
|
|
1164
|
+
if (!this.#stateless && !this.#clientCapabilities) {
|
|
1165
|
+
this.#setUpLateClient(streamableHttp);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
#startPing() {
|
|
1169
|
+
const pingConfig = this.#getPingConfig();
|
|
1170
|
+
if (pingConfig.enabled) {
|
|
1171
|
+
this.#pingInterval = setInterval(async () => {
|
|
1172
|
+
if (this.#pingInFlight) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
this.#pingInFlight = true;
|
|
1176
|
+
try {
|
|
1177
|
+
await this.#server.ping();
|
|
1178
|
+
} catch (e4) {
|
|
1179
|
+
const logLevel = pingConfig.logLevel;
|
|
1180
|
+
if (logLevel === "debug") {
|
|
1181
|
+
this.#logger.debug("[FastMCP debug] server ping failed");
|
|
1182
|
+
} else if (logLevel === "warning") {
|
|
1183
|
+
this.#logger.warn(
|
|
1184
|
+
"[FastMCP warning] server is not responding to ping"
|
|
1185
|
+
);
|
|
1186
|
+
} else if (logLevel === "error") {
|
|
1187
|
+
this.#logger.error(
|
|
1188
|
+
"[FastMCP error] server is not responding to ping"
|
|
1189
|
+
);
|
|
1190
|
+
} else {
|
|
1191
|
+
this.#logger.info("[FastMCP info] server ping failed");
|
|
1192
|
+
}
|
|
1193
|
+
} finally {
|
|
1194
|
+
this.#pingInFlight = false;
|
|
1195
|
+
}
|
|
1196
|
+
}, pingConfig.intervalMs);
|
|
1197
|
+
}
|
|
1170
1198
|
}
|
|
1171
1199
|
/**
|
|
1172
1200
|
* Periodically writes to the response stream of an in-flight tool call, so an
|
|
@@ -1187,7 +1215,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1187
1215
|
*/
|
|
1188
1216
|
#startStreamKeepalive(extra, toolName) {
|
|
1189
1217
|
const config = this.#streamKeepaliveConfig;
|
|
1190
|
-
if (!_optionalChain([config, 'optionalAccess',
|
|
1218
|
+
if (!_optionalChain([config, 'optionalAccess', _44 => _44.enabled]) || _optionalChain([extra, 'access', _45 => _45.signal, 'optionalAccess', _46 => _46.aborted])) {
|
|
1191
1219
|
return () => {
|
|
1192
1220
|
};
|
|
1193
1221
|
}
|
|
@@ -1207,12 +1235,12 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1207
1235
|
);
|
|
1208
1236
|
});
|
|
1209
1237
|
}, intervalMs);
|
|
1210
|
-
_optionalChain([timer, 'access',
|
|
1238
|
+
_optionalChain([timer, 'access', _47 => _47.unref, 'optionalCall', _48 => _48()]);
|
|
1211
1239
|
const stop = () => {
|
|
1212
1240
|
clearInterval(timer);
|
|
1213
|
-
_optionalChain([extra, 'access',
|
|
1241
|
+
_optionalChain([extra, 'access', _49 => _49.signal, 'optionalAccess', _50 => _50.removeEventListener, 'call', _51 => _51("abort", stop)]);
|
|
1214
1242
|
};
|
|
1215
|
-
_optionalChain([extra, 'access',
|
|
1243
|
+
_optionalChain([extra, 'access', _52 => _52.signal, 'optionalAccess', _53 => _53.addEventListener, 'call', _54 => _54("abort", stop, { once: true })]);
|
|
1216
1244
|
return stop;
|
|
1217
1245
|
}
|
|
1218
1246
|
async #validateStructuredContent(tool, value, toolName) {
|
|
@@ -1432,7 +1460,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1432
1460
|
_nullishCoalesce(args, () => ( {})),
|
|
1433
1461
|
this.#auth,
|
|
1434
1462
|
this.#createLoadContext(
|
|
1435
|
-
_optionalChain([request, 'access',
|
|
1463
|
+
_optionalChain([request, 'access', _55 => _55.params, 'optionalAccess', _56 => _56._meta]),
|
|
1436
1464
|
extra.sendNotification,
|
|
1437
1465
|
extra.requestId
|
|
1438
1466
|
)
|
|
@@ -1504,7 +1532,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1504
1532
|
match,
|
|
1505
1533
|
this.#auth,
|
|
1506
1534
|
this.#createLoadContext(
|
|
1507
|
-
_optionalChain([request, 'access',
|
|
1535
|
+
_optionalChain([request, 'access', _57 => _57.params, 'optionalAccess', _58 => _58._meta]),
|
|
1508
1536
|
extra.sendNotification,
|
|
1509
1537
|
extra.requestId
|
|
1510
1538
|
)
|
|
@@ -1536,7 +1564,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1536
1564
|
maybeArrayResult = await resource.load(
|
|
1537
1565
|
this.#auth,
|
|
1538
1566
|
this.#createLoadContext(
|
|
1539
|
-
_optionalChain([request, 'access',
|
|
1567
|
+
_optionalChain([request, 'access', _59 => _59.params, 'optionalAccess', _60 => _60._meta]),
|
|
1540
1568
|
extra.sendNotification,
|
|
1541
1569
|
extra.requestId
|
|
1542
1570
|
)
|
|
@@ -1605,7 +1633,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1605
1633
|
);
|
|
1606
1634
|
}
|
|
1607
1635
|
setupRootsHandlers() {
|
|
1608
|
-
if (_optionalChain([this, 'access',
|
|
1636
|
+
if (_optionalChain([this, 'access', _61 => _61.#rootsConfig, 'optionalAccess', _62 => _62.enabled]) === false) {
|
|
1609
1637
|
this.#logger.debug(
|
|
1610
1638
|
"[FastMCP debug] roots capability explicitly disabled via config"
|
|
1611
1639
|
);
|
|
@@ -1749,7 +1777,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1749
1777
|
}
|
|
1750
1778
|
args = parsed.value;
|
|
1751
1779
|
}
|
|
1752
|
-
const progressToken = _optionalChain([request, 'access',
|
|
1780
|
+
const progressToken = _optionalChain([request, 'access', _63 => _63.params, 'optionalAccess', _64 => _64._meta, 'optionalAccess', _65 => _65.progressToken]);
|
|
1753
1781
|
let result;
|
|
1754
1782
|
const timeoutAbort = new AbortController();
|
|
1755
1783
|
const sourceSignal = AbortSignal.any([
|
|
@@ -1840,7 +1868,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
|
|
|
1840
1868
|
elicit: this.#createElicit(extra.requestId),
|
|
1841
1869
|
log,
|
|
1842
1870
|
reportProgress,
|
|
1843
|
-
requestId: typeof _optionalChain([request, 'access',
|
|
1871
|
+
requestId: typeof _optionalChain([request, 'access', _66 => _66.params, 'optionalAccess', _67 => _67._meta, 'optionalAccess', _68 => _68.requestId]) === "string" ? request.params._meta.requestId : void 0,
|
|
1844
1872
|
session: this.#auth,
|
|
1845
1873
|
sessionId: this.sessionId,
|
|
1846
1874
|
signal,
|
|
@@ -2053,7 +2081,7 @@ function normalizePath(path) {
|
|
|
2053
2081
|
return path.startsWith("/") ? path : `/${path}`;
|
|
2054
2082
|
}
|
|
2055
2083
|
function parseBasicAuthHeader(authHeader) {
|
|
2056
|
-
const basicMatch = _optionalChain([authHeader, 'optionalAccess',
|
|
2084
|
+
const basicMatch = _optionalChain([authHeader, 'optionalAccess', _69 => _69.match, 'call', _70 => _70(/^Basic\s+(.*)$/i)]);
|
|
2057
2085
|
if (!basicMatch) return null;
|
|
2058
2086
|
const credentials = Buffer.from(basicMatch[1].trim(), "base64").toString(
|
|
2059
2087
|
"utf-8"
|
|
@@ -2120,7 +2148,7 @@ var OAUTH_INVALID_CLIENT_RESPONSE_HEADERS = {
|
|
|
2120
2148
|
"WWW-Authenticate": 'Basic realm="oauth", charset="UTF-8"'
|
|
2121
2149
|
};
|
|
2122
2150
|
function grantedScopes(auth) {
|
|
2123
|
-
const scopes = _optionalChain([auth, 'optionalAccess',
|
|
2151
|
+
const scopes = _optionalChain([auth, 'optionalAccess', _71 => _71.scopes]);
|
|
2124
2152
|
const values = Array.isArray(scopes) ? scopes : scopes instanceof Set ? [...scopes] : [];
|
|
2125
2153
|
return values.filter((scope) => typeof scope === "string");
|
|
2126
2154
|
}
|
|
@@ -2199,7 +2227,7 @@ function toolAdmits(tool, auth, logger) {
|
|
|
2199
2227
|
if (typeof admitted === "boolean") {
|
|
2200
2228
|
return admitted;
|
|
2201
2229
|
}
|
|
2202
|
-
const isPromise = typeof _optionalChain([admitted, 'optionalAccess',
|
|
2230
|
+
const isPromise = typeof _optionalChain([admitted, 'optionalAccess', _72 => _72.then]) === "function";
|
|
2203
2231
|
if (isPromise) {
|
|
2204
2232
|
Promise.resolve(admitted).catch(() => {
|
|
2205
2233
|
});
|
|
@@ -2401,7 +2429,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2401
2429
|
(resource) => resource.uri === uri
|
|
2402
2430
|
);
|
|
2403
2431
|
if (directResource) {
|
|
2404
|
-
const result = await directResource.load(_optionalChain([context, 'optionalAccess',
|
|
2432
|
+
const result = await directResource.load(_optionalChain([context, 'optionalAccess', _73 => _73.session]), context);
|
|
2405
2433
|
const results = Array.isArray(result) ? result : [result];
|
|
2406
2434
|
const firstResult = results[0];
|
|
2407
2435
|
if (!firstResult) {
|
|
@@ -2430,7 +2458,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2430
2458
|
}
|
|
2431
2459
|
const result = await template.load(
|
|
2432
2460
|
params,
|
|
2433
|
-
_optionalChain([context, 'optionalAccess',
|
|
2461
|
+
_optionalChain([context, 'optionalAccess', _74 => _74.session]),
|
|
2434
2462
|
context
|
|
2435
2463
|
);
|
|
2436
2464
|
const results = Array.isArray(result) ? result : [result];
|
|
@@ -2826,9 +2854,9 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2826
2854
|
const originalOnClose = transport.onclose;
|
|
2827
2855
|
transport.onclose = () => {
|
|
2828
2856
|
closed = true;
|
|
2829
|
-
_optionalChain([onClose, 'optionalCall',
|
|
2857
|
+
_optionalChain([onClose, 'optionalCall', _75 => _75()]);
|
|
2830
2858
|
this.#removeSession(session);
|
|
2831
|
-
_optionalChain([originalOnClose, 'optionalCall',
|
|
2859
|
+
_optionalChain([originalOnClose, 'optionalCall', _76 => _76()]);
|
|
2832
2860
|
};
|
|
2833
2861
|
await session.connect(transport);
|
|
2834
2862
|
if (closed) {
|
|
@@ -2855,7 +2883,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2855
2883
|
*/
|
|
2856
2884
|
#createInsufficientScopeResponse(challenge, id) {
|
|
2857
2885
|
const oauth = this.#options.oauth;
|
|
2858
|
-
const resource = _optionalChain([oauth, 'optionalAccess',
|
|
2886
|
+
const resource = _optionalChain([oauth, 'optionalAccess', _77 => _77.enabled]) ? _optionalChain([oauth, 'access', _78 => _78.protectedResource, 'optionalAccess', _79 => _79.resource]) : void 0;
|
|
2859
2887
|
const wwwAuthenticateParts = [
|
|
2860
2888
|
'error="insufficient_scope"',
|
|
2861
2889
|
`scope="${challenge.scopes.filter((scope) => SCOPE_TOKEN.test(scope)).join(" ")}"`
|
|
@@ -2941,7 +2969,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
2941
2969
|
*/
|
|
2942
2970
|
#createUnauthorizedResponse(message) {
|
|
2943
2971
|
const oauth = this.#options.oauth;
|
|
2944
|
-
const resource = _optionalChain([oauth, 'optionalAccess',
|
|
2972
|
+
const resource = _optionalChain([oauth, 'optionalAccess', _80 => _80.enabled]) ? _optionalChain([oauth, 'access', _81 => _81.protectedResource, 'optionalAccess', _82 => _82.resource]) : void 0;
|
|
2945
2973
|
const wwwAuthenticateParts = [
|
|
2946
2974
|
'error="invalid_token"',
|
|
2947
2975
|
`error_description="${message.replace(/"/g, '\\"')}"`
|
|
@@ -3080,7 +3108,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3080
3108
|
}
|
|
3081
3109
|
}
|
|
3082
3110
|
const oauthConfig = this.#options.oauth;
|
|
3083
|
-
if (_optionalChain([oauthConfig, 'optionalAccess',
|
|
3111
|
+
if (_optionalChain([oauthConfig, 'optionalAccess', _83 => _83.enabled]) && req.method === "GET") {
|
|
3084
3112
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
3085
3113
|
const authorizationServerMetadataPath = joinPaths(
|
|
3086
3114
|
"",
|
|
@@ -3114,8 +3142,8 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3114
3142
|
}
|
|
3115
3143
|
}
|
|
3116
3144
|
}
|
|
3117
|
-
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess',
|
|
3118
|
-
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess',
|
|
3145
|
+
const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _84 => _84.proxy]);
|
|
3146
|
+
if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _85 => _85.enabled])) {
|
|
3119
3147
|
const url2 = new URL(req.url || "", `http://${host}`);
|
|
3120
3148
|
const oauthPath = basePathRelativePath;
|
|
3121
3149
|
try {
|
|
@@ -3168,7 +3196,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3168
3196
|
const statusCode = error.statusCode || 400;
|
|
3169
3197
|
res.writeHead(statusCode, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(
|
|
3170
3198
|
JSON.stringify(
|
|
3171
|
-
_optionalChain([error, 'access',
|
|
3199
|
+
_optionalChain([error, 'access', _86 => _86.toJSON, 'optionalCall', _87 => _87()]) || {
|
|
3172
3200
|
error: "invalid_request"
|
|
3173
3201
|
}
|
|
3174
3202
|
)
|
|
@@ -3193,7 +3221,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3193
3221
|
} catch (error) {
|
|
3194
3222
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
3195
3223
|
JSON.stringify(
|
|
3196
|
-
_optionalChain([error, 'access',
|
|
3224
|
+
_optionalChain([error, 'access', _88 => _88.toJSON, 'optionalCall', _89 => _89()]) || {
|
|
3197
3225
|
error: "invalid_request"
|
|
3198
3226
|
}
|
|
3199
3227
|
)
|
|
@@ -3211,7 +3239,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3211
3239
|
} catch (error) {
|
|
3212
3240
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
3213
3241
|
JSON.stringify(
|
|
3214
|
-
_optionalChain([error, 'access',
|
|
3242
|
+
_optionalChain([error, 'access', _90 => _90.toJSON, 'optionalCall', _91 => _91()]) || {
|
|
3215
3243
|
error: "server_error"
|
|
3216
3244
|
}
|
|
3217
3245
|
)
|
|
@@ -3275,7 +3303,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3275
3303
|
} catch (error) {
|
|
3276
3304
|
res.writeHead(400, { "Content-Type": "application/json" }).end(
|
|
3277
3305
|
JSON.stringify(
|
|
3278
|
-
_optionalChain([error, 'access',
|
|
3306
|
+
_optionalChain([error, 'access', _92 => _92.toJSON, 'optionalCall', _93 => _93()]) || {
|
|
3279
3307
|
error: "server_error"
|
|
3280
3308
|
}
|
|
3281
3309
|
)
|
|
@@ -3390,7 +3418,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3390
3418
|
}
|
|
3391
3419
|
res.writeHead(200, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(JSON.stringify(response));
|
|
3392
3420
|
} catch (error) {
|
|
3393
|
-
const body = _optionalChain([error, 'access',
|
|
3421
|
+
const body = _optionalChain([error, 'access', _94 => _94.toJSON, 'optionalCall', _95 => _95()]) || {
|
|
3394
3422
|
error: "invalid_request"
|
|
3395
3423
|
};
|
|
3396
3424
|
if (body.error === "invalid_client") {
|
|
@@ -3420,7 +3448,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3420
3448
|
* regardless (RFC 7235), so no config is needed just to get the header.
|
|
3421
3449
|
*/
|
|
3422
3450
|
#httpStreamOAuthConfig() {
|
|
3423
|
-
const resource = _optionalChain([this, 'access',
|
|
3451
|
+
const resource = _optionalChain([this, 'access', _96 => _96.#options, 'access', _97 => _97.oauth, 'optionalAccess', _98 => _98.enabled]) ? _optionalChain([this, 'access', _99 => _99.#options, 'access', _100 => _100.oauth, 'access', _101 => _101.protectedResource, 'optionalAccess', _102 => _102.resource]) : void 0;
|
|
3424
3452
|
if (!resource) {
|
|
3425
3453
|
return {};
|
|
3426
3454
|
}
|
|
@@ -3560,25 +3588,25 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3560
3588
|
const envBasePath = process.env.FASTMCP_BASE_PATH;
|
|
3561
3589
|
const envStateless = process.env.FASTMCP_STATELESS;
|
|
3562
3590
|
const envHost = process.env.FASTMCP_HOST;
|
|
3563
|
-
const transportType = _optionalChain([overrides, 'optionalAccess',
|
|
3591
|
+
const transportType = _optionalChain([overrides, 'optionalAccess', _103 => _103.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
|
|
3564
3592
|
if (transportType === "httpStream") {
|
|
3565
3593
|
const port = parseInt(
|
|
3566
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
3594
|
+
_optionalChain([overrides, 'optionalAccess', _104 => _104.httpStream, 'optionalAccess', _105 => _105.port, 'optionalAccess', _106 => _106.toString, 'call', _107 => _107()]) || portArg || envPort || "8080"
|
|
3567
3595
|
);
|
|
3568
|
-
const host = _optionalChain([overrides, 'optionalAccess',
|
|
3569
|
-
const endpoint = _optionalChain([overrides, 'optionalAccess',
|
|
3596
|
+
const host = _optionalChain([overrides, 'optionalAccess', _108 => _108.httpStream, 'optionalAccess', _109 => _109.host]) || hostArg || envHost || "localhost";
|
|
3597
|
+
const endpoint = _optionalChain([overrides, 'optionalAccess', _110 => _110.httpStream, 'optionalAccess', _111 => _111.endpoint]) || endpointArg || envEndpoint || "/mcp";
|
|
3570
3598
|
const basePath = normalizeBasePath(
|
|
3571
|
-
_optionalChain([overrides, 'optionalAccess',
|
|
3599
|
+
_optionalChain([overrides, 'optionalAccess', _112 => _112.httpStream, 'optionalAccess', _113 => _113.basePath]) || basePathArg || envBasePath
|
|
3572
3600
|
);
|
|
3573
|
-
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess',
|
|
3574
|
-
const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess',
|
|
3601
|
+
const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _114 => _114.httpStream, 'optionalAccess', _115 => _115.enableJsonResponse]) || false;
|
|
3602
|
+
const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _116 => _116.httpStream, 'optionalAccess', _117 => _117.stateless]), () => ( // A bare `--stateless` means `--stateless true`.
|
|
3575
3603
|
(statelessArg === "" ? true : parseBooleanSetting(statelessArg, "--stateless")))), () => ( parseBooleanSetting(envStateless, "FASTMCP_STATELESS"))), () => ( false));
|
|
3576
|
-
const cors = _optionalChain([overrides, 'optionalAccess',
|
|
3577
|
-
const eventStore = _optionalChain([overrides, 'optionalAccess',
|
|
3578
|
-
const sseEndpoint = _optionalChain([overrides, 'optionalAccess',
|
|
3579
|
-
const sslCa = _optionalChain([overrides, 'optionalAccess',
|
|
3580
|
-
const sslCert = _optionalChain([overrides, 'optionalAccess',
|
|
3581
|
-
const sslKey = _optionalChain([overrides, 'optionalAccess',
|
|
3604
|
+
const cors = _optionalChain([overrides, 'optionalAccess', _118 => _118.httpStream, 'optionalAccess', _119 => _119.cors]);
|
|
3605
|
+
const eventStore = _optionalChain([overrides, 'optionalAccess', _120 => _120.httpStream, 'optionalAccess', _121 => _121.eventStore]);
|
|
3606
|
+
const sseEndpoint = _optionalChain([overrides, 'optionalAccess', _122 => _122.httpStream, 'optionalAccess', _123 => _123.sseEndpoint]);
|
|
3607
|
+
const sslCa = _optionalChain([overrides, 'optionalAccess', _124 => _124.httpStream, 'optionalAccess', _125 => _125.sslCa]);
|
|
3608
|
+
const sslCert = _optionalChain([overrides, 'optionalAccess', _126 => _126.httpStream, 'optionalAccess', _127 => _127.sslCert]);
|
|
3609
|
+
const sslKey = _optionalChain([overrides, 'optionalAccess', _128 => _128.httpStream, 'optionalAccess', _129 => _129.sslKey]);
|
|
3582
3610
|
return {
|
|
3583
3611
|
httpStream: {
|
|
3584
3612
|
basePath,
|
|
@@ -3670,7 +3698,7 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3670
3698
|
*/
|
|
3671
3699
|
#useEndpointAsResource(endpoint) {
|
|
3672
3700
|
const oauth = this.#options.oauth;
|
|
3673
|
-
if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess',
|
|
3701
|
+
if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _130 => _130.protectedResource]))
|
|
3674
3702
|
return;
|
|
3675
3703
|
this.#options = {
|
|
3676
3704
|
...this.#options,
|
|
@@ -3699,4 +3727,4 @@ var FastMCP = class extends FastMCPEventEmitter {
|
|
|
3699
3727
|
|
|
3700
3728
|
|
|
3701
3729
|
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;
|
|
3702
|
-
//# sourceMappingURL=chunk-
|
|
3730
|
+
//# sourceMappingURL=chunk-LTBNX7PX.cjs.map
|