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.
@@ -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
- const pingConfig = this.#getPingConfig();
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', _43 => _43.enabled]) || _optionalChain([extra, 'access', _44 => _44.signal, 'optionalAccess', _45 => _45.aborted])) {
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', _46 => _46.unref, 'optionalCall', _47 => _47()]);
1238
+ _optionalChain([timer, 'access', _47 => _47.unref, 'optionalCall', _48 => _48()]);
1211
1239
  const stop = () => {
1212
1240
  clearInterval(timer);
1213
- _optionalChain([extra, 'access', _48 => _48.signal, 'optionalAccess', _49 => _49.removeEventListener, 'call', _50 => _50("abort", stop)]);
1241
+ _optionalChain([extra, 'access', _49 => _49.signal, 'optionalAccess', _50 => _50.removeEventListener, 'call', _51 => _51("abort", stop)]);
1214
1242
  };
1215
- _optionalChain([extra, 'access', _51 => _51.signal, 'optionalAccess', _52 => _52.addEventListener, 'call', _53 => _53("abort", stop, { once: true })]);
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', _54 => _54.params, 'optionalAccess', _55 => _55._meta]),
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', _56 => _56.params, 'optionalAccess', _57 => _57._meta]),
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', _58 => _58.params, 'optionalAccess', _59 => _59._meta]),
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', _60 => _60.#rootsConfig, 'optionalAccess', _61 => _61.enabled]) === false) {
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', _62 => _62.params, 'optionalAccess', _63 => _63._meta, 'optionalAccess', _64 => _64.progressToken]);
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', _65 => _65.params, 'optionalAccess', _66 => _66._meta, 'optionalAccess', _67 => _67.requestId]) === "string" ? request.params._meta.requestId : void 0,
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', _68 => _68.match, 'call', _69 => _69(/^Basic\s+(.*)$/i)]);
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', _70 => _70.scopes]);
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', _71 => _71.then]) === "function";
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', _72 => _72.session]), context);
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', _73 => _73.session]),
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', _74 => _74()]);
2857
+ _optionalChain([onClose, 'optionalCall', _75 => _75()]);
2830
2858
  this.#removeSession(session);
2831
- _optionalChain([originalOnClose, 'optionalCall', _75 => _75()]);
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', _76 => _76.enabled]) ? _optionalChain([oauth, 'access', _77 => _77.protectedResource, 'optionalAccess', _78 => _78.resource]) : void 0;
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', _79 => _79.enabled]) ? _optionalChain([oauth, 'access', _80 => _80.protectedResource, 'optionalAccess', _81 => _81.resource]) : void 0;
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', _82 => _82.enabled]) && req.method === "GET") {
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', _83 => _83.proxy]);
3118
- if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _84 => _84.enabled])) {
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', _85 => _85.toJSON, 'optionalCall', _86 => _86()]) || {
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', _87 => _87.toJSON, 'optionalCall', _88 => _88()]) || {
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', _89 => _89.toJSON, 'optionalCall', _90 => _90()]) || {
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', _91 => _91.toJSON, 'optionalCall', _92 => _92()]) || {
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', _93 => _93.toJSON, 'optionalCall', _94 => _94()]) || {
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', _95 => _95.#options, 'access', _96 => _96.oauth, 'optionalAccess', _97 => _97.enabled]) ? _optionalChain([this, 'access', _98 => _98.#options, 'access', _99 => _99.oauth, 'access', _100 => _100.protectedResource, 'optionalAccess', _101 => _101.resource]) : void 0;
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', _102 => _102.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
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', _103 => _103.httpStream, 'optionalAccess', _104 => _104.port, 'optionalAccess', _105 => _105.toString, 'call', _106 => _106()]) || portArg || envPort || "8080"
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', _107 => _107.httpStream, 'optionalAccess', _108 => _108.host]) || hostArg || envHost || "localhost";
3569
- const endpoint = _optionalChain([overrides, 'optionalAccess', _109 => _109.httpStream, 'optionalAccess', _110 => _110.endpoint]) || endpointArg || envEndpoint || "/mcp";
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', _111 => _111.httpStream, 'optionalAccess', _112 => _112.basePath]) || basePathArg || envBasePath
3599
+ _optionalChain([overrides, 'optionalAccess', _112 => _112.httpStream, 'optionalAccess', _113 => _113.basePath]) || basePathArg || envBasePath
3572
3600
  );
3573
- const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _113 => _113.httpStream, 'optionalAccess', _114 => _114.enableJsonResponse]) || false;
3574
- const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _115 => _115.httpStream, 'optionalAccess', _116 => _116.stateless]), () => ( // A bare `--stateless` means `--stateless true`.
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', _117 => _117.httpStream, 'optionalAccess', _118 => _118.cors]);
3577
- const eventStore = _optionalChain([overrides, 'optionalAccess', _119 => _119.httpStream, 'optionalAccess', _120 => _120.eventStore]);
3578
- const sseEndpoint = _optionalChain([overrides, 'optionalAccess', _121 => _121.httpStream, 'optionalAccess', _122 => _122.sseEndpoint]);
3579
- const sslCa = _optionalChain([overrides, 'optionalAccess', _123 => _123.httpStream, 'optionalAccess', _124 => _124.sslCa]);
3580
- const sslCert = _optionalChain([overrides, 'optionalAccess', _125 => _125.httpStream, 'optionalAccess', _126 => _126.sslCert]);
3581
- const sslKey = _optionalChain([overrides, 'optionalAccess', _127 => _127.httpStream, 'optionalAccess', _128 => _128.sslKey]);
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', _129 => _129.protectedResource]))
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-4JEDH2ON.cjs.map
3730
+ //# sourceMappingURL=chunk-LTBNX7PX.cjs.map