fastmcp 4.25.1 → 4.26.1

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.
Files changed (38) hide show
  1. package/README.md +10 -2
  2. package/dist/FastMCP.cjs +3 -3
  3. package/dist/FastMCP.d.cts +3 -2
  4. package/dist/FastMCP.d.ts +3 -2
  5. package/dist/FastMCP.js +2 -2
  6. package/dist/{OAuthProvider-CPC9zG96.d.cts → OAuthProvider-5T2VSp7V.d.cts} +34 -1
  7. package/dist/{OAuthProvider-CPC9zG96.d.ts → OAuthProvider-5T2VSp7V.d.ts} +34 -1
  8. package/dist/auth/index.cjs +2 -2
  9. package/dist/auth/index.d.cts +17 -3
  10. package/dist/auth/index.d.ts +17 -3
  11. package/dist/auth/index.js +1 -1
  12. package/dist/{chunk-SQSE766U.js → chunk-GUHJKVLX.js} +67 -32
  13. package/dist/chunk-GUHJKVLX.js.map +1 -0
  14. package/dist/{chunk-3VYVXSBB.js → chunk-KYUSH4TQ.js} +188 -41
  15. package/dist/chunk-KYUSH4TQ.js.map +1 -0
  16. package/dist/{chunk-VWHJYU4V.cjs → chunk-MT5SJOZ5.cjs} +96 -61
  17. package/dist/chunk-MT5SJOZ5.cjs.map +1 -0
  18. package/dist/{chunk-AKHG27NY.cjs → chunk-UNS6EZVP.cjs} +202 -55
  19. package/dist/chunk-UNS6EZVP.cjs.map +1 -0
  20. package/dist/edge/index.cjs +110 -16
  21. package/dist/edge/index.cjs.map +1 -1
  22. package/dist/edge/index.d.cts +7 -2
  23. package/dist/edge/index.d.ts +7 -2
  24. package/dist/edge/index.js +110 -16
  25. package/dist/edge/index.js.map +1 -1
  26. package/dist/examples/custom-routes.cjs +3 -3
  27. package/dist/examples/custom-routes.js +2 -2
  28. package/dist/openapi/index.cjs +22 -9
  29. package/dist/openapi/index.cjs.map +1 -1
  30. package/dist/openapi/index.d.cts +6 -5
  31. package/dist/openapi/index.d.ts +6 -5
  32. package/dist/openapi/index.js +16 -3
  33. package/dist/openapi/index.js.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/chunk-3VYVXSBB.js.map +0 -1
  36. package/dist/chunk-AKHG27NY.cjs.map +0 -1
  37. package/dist/chunk-SQSE766U.js.map +0 -1
  38. package/dist/chunk-VWHJYU4V.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkAKHG27NYcjs = require('./chunk-AKHG27NY.cjs');
3
+ var _chunkUNS6EZVPcjs = require('./chunk-UNS6EZVP.cjs');
4
4
 
5
5
 
6
6
 
@@ -141,7 +141,7 @@ var DiscoveryDocumentCache = class {
141
141
  throw error;
142
142
  }
143
143
  if (!res.ok) {
144
- await _chunkAKHG27NYcjs.cancelResponseBody.call(void 0, res);
144
+ await _chunkUNS6EZVPcjs.cancelResponseBody.call(void 0, res);
145
145
  throw new Error(
146
146
  `Failed to fetch discovery document from ${url}: ${res.status} ${res.statusText}`
147
147
  );
@@ -258,7 +258,7 @@ var imageContent = async (input) => {
258
258
  signal: AbortSignal.timeout(timeoutMs)
259
259
  });
260
260
  if (!response.ok) {
261
- await _chunkAKHG27NYcjs.cancelResponseBody.call(void 0, response);
261
+ await _chunkUNS6EZVPcjs.cancelResponseBody.call(void 0, response);
262
262
  throw new Error(
263
263
  `Server responded with status: ${response.status} - ${response.statusText}`
264
264
  );
@@ -340,7 +340,7 @@ var audioContent = async (input) => {
340
340
  signal: AbortSignal.timeout(timeoutMs)
341
341
  });
342
342
  if (!response.ok) {
343
- await _chunkAKHG27NYcjs.cancelResponseBody.call(void 0, response);
343
+ await _chunkUNS6EZVPcjs.cancelResponseBody.call(void 0, response);
344
344
  throw new Error(
345
345
  `Server responded with status: ${response.status} - ${response.statusText}`
346
346
  );
@@ -697,7 +697,7 @@ var FastMCPSession = class extends FastMCPSessionEventEmitter {
697
697
  this.setupCompleteHandlers();
698
698
  if (supportsTools) {
699
699
  this.setupToolHandlers(
700
- toolsVisibleTo(tools, this.#auth, this.#authRequired)
700
+ toolsVisibleTo(tools, this.#auth, this.#authRequired, this.#logger)
701
701
  );
702
702
  }
703
703
  if (resources.length || resourcesTemplates.length) {
@@ -839,7 +839,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
839
839
  }
840
840
  this.#tools = tools;
841
841
  this.setupToolHandlers(
842
- toolsVisibleTo(tools, this.#auth, this.#authRequired)
842
+ toolsVisibleTo(tools, this.#auth, this.#authRequired, this.#logger)
843
843
  );
844
844
  this.triggerListChangedNotification("notifications/tools/list_changed");
845
845
  }
@@ -862,7 +862,12 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
862
862
  */
863
863
  updateAuth(auth) {
864
864
  this.#auth = auth;
865
- const tools = toolsVisibleTo(this.#tools, auth, this.#authRequired);
865
+ const tools = toolsVisibleTo(
866
+ this.#tools,
867
+ auth,
868
+ this.#authRequired,
869
+ this.#logger
870
+ );
866
871
  if (tools.length !== this.#visibleTools.length || tools.some((tool, index) => tool !== this.#visibleTools[index])) {
867
872
  this.setupToolHandlers(tools);
868
873
  this.triggerListChangedNotification("notifications/tools/list_changed");
@@ -1934,6 +1939,9 @@ function convertObjectToSnakeCase(obj) {
1934
1939
  }
1935
1940
  return result;
1936
1941
  }
1942
+ function cookieHeaders(req) {
1943
+ return req.headers.cookie ? { cookie: req.headers.cookie } : {};
1944
+ }
1937
1945
  function isStreamableHttpTransport(transport) {
1938
1946
  return "handleRequest" in transport && typeof transport.handleRequest === "function";
1939
1947
  }
@@ -2058,6 +2066,20 @@ function grantedScopes(auth) {
2058
2066
  const values = Array.isArray(scopes) ? scopes : scopes instanceof Set ? [...scopes] : [];
2059
2067
  return values.filter((scope) => typeof scope === "string");
2060
2068
  }
2069
+ async function sendOAuthProxyResponse(res, response) {
2070
+ const body = await response.text();
2071
+ const headers = {};
2072
+ response.headers.forEach((value, key) => {
2073
+ if (key.toLowerCase() !== "set-cookie") {
2074
+ headers[key] = value;
2075
+ }
2076
+ });
2077
+ const setCookies = response.headers.getSetCookie();
2078
+ if (setCookies.length > 0) {
2079
+ headers["set-cookie"] = setCookies;
2080
+ }
2081
+ res.writeHead(response.status, headers).end(body);
2082
+ }
2061
2083
  function stripBasePath(path, basePath) {
2062
2084
  if (!basePath) {
2063
2085
  return path;
@@ -2070,12 +2092,32 @@ function stripBasePath(path, basePath) {
2070
2092
  }
2071
2093
  return null;
2072
2094
  }
2073
- function toolsVisibleTo(tools, auth, authRequired) {
2074
- if (auth) {
2075
- return tools.filter(
2076
- (tool) => tool.canAccess ? tool.canAccess(auth) : true
2095
+ var toolsWithInvalidCanAccess = /* @__PURE__ */ new WeakSet();
2096
+ function toolAdmits(tool, auth, logger) {
2097
+ if (!tool.canAccess) {
2098
+ return true;
2099
+ }
2100
+ const admitted = tool.canAccess(auth);
2101
+ if (typeof admitted === "boolean") {
2102
+ return admitted;
2103
+ }
2104
+ const isPromise = typeof _optionalChain([admitted, 'optionalAccess', _71 => _71.then]) === "function";
2105
+ if (isPromise) {
2106
+ Promise.resolve(admitted).catch(() => {
2107
+ });
2108
+ }
2109
+ if (admitted && !toolsWithInvalidCanAccess.has(tool)) {
2110
+ toolsWithInvalidCanAccess.add(tool);
2111
+ logger.warn(
2112
+ `[FastMCP warning] Tool '${tool.name}' is hidden: its canAccess returned ${isPromise ? "a Promise" : "a non-boolean value"}. canAccess must return a boolean synchronously.`
2077
2113
  );
2078
2114
  }
2115
+ return false;
2116
+ }
2117
+ function toolsVisibleTo(tools, auth, authRequired, logger) {
2118
+ if (auth) {
2119
+ return tools.filter((tool) => toolAdmits(tool, auth, logger));
2120
+ }
2079
2121
  return authRequired ? tools.filter((tool) => !tool.canAccess) : tools;
2080
2122
  }
2081
2123
  var FastMCPEventEmitterBase = _events.EventEmitter;
@@ -2585,6 +2627,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2585
2627
  );
2586
2628
  },
2587
2629
  port: httpConfig.port,
2630
+ sseEndpoint: httpConfig.sseEndpoint,
2588
2631
  sslCa: httpConfig.sslCa,
2589
2632
  sslCert: httpConfig.sslCert,
2590
2633
  sslKey: httpConfig.sslKey,
@@ -2639,6 +2682,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2639
2682
  );
2640
2683
  },
2641
2684
  port: httpConfig.port,
2685
+ sseEndpoint: httpConfig.sseEndpoint,
2642
2686
  sslCa: httpConfig.sslCa,
2643
2687
  sslCert: httpConfig.sslCert,
2644
2688
  sslKey: httpConfig.sslKey,
@@ -2695,9 +2739,9 @@ var FastMCP = class extends FastMCPEventEmitter {
2695
2739
  const originalOnClose = transport.onclose;
2696
2740
  transport.onclose = () => {
2697
2741
  closed = true;
2698
- _optionalChain([onClose, 'optionalCall', _71 => _71()]);
2742
+ _optionalChain([onClose, 'optionalCall', _72 => _72()]);
2699
2743
  this.#removeSession(session);
2700
- _optionalChain([originalOnClose, 'optionalCall', _72 => _72()]);
2744
+ _optionalChain([originalOnClose, 'optionalCall', _73 => _73()]);
2701
2745
  };
2702
2746
  await session.connect(transport);
2703
2747
  if (closed) {
@@ -2724,7 +2768,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2724
2768
  */
2725
2769
  #createInsufficientScopeResponse(challenge, id) {
2726
2770
  const oauth = this.#options.oauth;
2727
- const resource = _optionalChain([oauth, 'optionalAccess', _73 => _73.enabled]) ? _optionalChain([oauth, 'access', _74 => _74.protectedResource, 'optionalAccess', _75 => _75.resource]) : void 0;
2771
+ const resource = _optionalChain([oauth, 'optionalAccess', _74 => _74.enabled]) ? _optionalChain([oauth, 'access', _75 => _75.protectedResource, 'optionalAccess', _76 => _76.resource]) : void 0;
2728
2772
  const wwwAuthenticateParts = [
2729
2773
  'error="insufficient_scope"',
2730
2774
  `scope="${challenge.scopes.filter((scope) => SCOPE_TOKEN.test(scope)).join(" ")}"`
@@ -2810,7 +2854,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2810
2854
  */
2811
2855
  #createUnauthorizedResponse(message) {
2812
2856
  const oauth = this.#options.oauth;
2813
- const resource = _optionalChain([oauth, 'optionalAccess', _76 => _76.enabled]) ? _optionalChain([oauth, 'access', _77 => _77.protectedResource, 'optionalAccess', _78 => _78.resource]) : void 0;
2857
+ const resource = _optionalChain([oauth, 'optionalAccess', _77 => _77.enabled]) ? _optionalChain([oauth, 'access', _78 => _78.protectedResource, 'optionalAccess', _79 => _79.resource]) : void 0;
2814
2858
  const wwwAuthenticateParts = [
2815
2859
  'error="invalid_token"',
2816
2860
  `error_description="${message.replace(/"/g, '\\"')}"`
@@ -2949,7 +2993,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2949
2993
  }
2950
2994
  }
2951
2995
  const oauthConfig = this.#options.oauth;
2952
- if (_optionalChain([oauthConfig, 'optionalAccess', _79 => _79.enabled]) && req.method === "GET") {
2996
+ if (_optionalChain([oauthConfig, 'optionalAccess', _80 => _80.enabled]) && req.method === "GET") {
2953
2997
  const url2 = new URL(req.url || "", `http://${host}`);
2954
2998
  const authorizationServerMetadataPath = joinPaths(
2955
2999
  "",
@@ -2983,8 +3027,8 @@ var FastMCP = class extends FastMCPEventEmitter {
2983
3027
  }
2984
3028
  }
2985
3029
  }
2986
- const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _80 => _80.proxy]);
2987
- if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _81 => _81.enabled])) {
3030
+ const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _81 => _81.proxy]);
3031
+ if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _82 => _82.enabled])) {
2988
3032
  const url2 = new URL(req.url || "", `http://${host}`);
2989
3033
  const oauthPath = basePathRelativePath;
2990
3034
  try {
@@ -3037,7 +3081,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3037
3081
  const statusCode = error.statusCode || 400;
3038
3082
  res.writeHead(statusCode, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(
3039
3083
  JSON.stringify(
3040
- _optionalChain([error, 'access', _82 => _82.toJSON, 'optionalCall', _83 => _83()]) || {
3084
+ _optionalChain([error, 'access', _83 => _83.toJSON, 'optionalCall', _84 => _84()]) || {
3041
3085
  error: "invalid_request"
3042
3086
  }
3043
3087
  )
@@ -3052,19 +3096,17 @@ var FastMCP = class extends FastMCPEventEmitter {
3052
3096
  try {
3053
3097
  const params = Object.fromEntries(url2.searchParams.entries());
3054
3098
  const response = await oauthProxy.authorize(
3055
- params
3099
+ params,
3100
+ // The consent cookie this browser already holds, if any
3101
+ new Request(`http://${host}${req.url}`, {
3102
+ headers: cookieHeaders(req)
3103
+ })
3056
3104
  );
3057
- const location = response.headers.get("Location");
3058
- if (location) {
3059
- res.writeHead(response.status, { Location: location }).end();
3060
- } else {
3061
- const html = await response.text();
3062
- res.writeHead(response.status, { "Content-Type": "text/html" }).end(html);
3063
- }
3105
+ await sendOAuthProxyResponse(res, response);
3064
3106
  } catch (error) {
3065
3107
  res.writeHead(400, { "Content-Type": "application/json" }).end(
3066
3108
  JSON.stringify(
3067
- _optionalChain([error, 'access', _84 => _84.toJSON, 'optionalCall', _85 => _85()]) || {
3109
+ _optionalChain([error, 'access', _85 => _85.toJSON, 'optionalCall', _86 => _86()]) || {
3068
3110
  error: "invalid_request"
3069
3111
  }
3070
3112
  )
@@ -3074,19 +3116,15 @@ var FastMCP = class extends FastMCPEventEmitter {
3074
3116
  }
3075
3117
  if (req.method === "GET" && oauthPath === "/oauth/callback") {
3076
3118
  try {
3077
- const mockRequest = new Request(`http://${host}${req.url}`);
3119
+ const mockRequest = new Request(`http://${host}${req.url}`, {
3120
+ headers: cookieHeaders(req)
3121
+ });
3078
3122
  const response = await oauthProxy.handleCallback(mockRequest);
3079
- const location = response.headers.get("Location");
3080
- if (location) {
3081
- res.writeHead(response.status, { Location: location }).end();
3082
- } else {
3083
- const text = await response.text();
3084
- res.writeHead(response.status).end(text);
3085
- }
3123
+ await sendOAuthProxyResponse(res, response);
3086
3124
  } catch (error) {
3087
3125
  res.writeHead(400, { "Content-Type": "application/json" }).end(
3088
3126
  JSON.stringify(
3089
- _optionalChain([error, 'access', _86 => _86.toJSON, 'optionalCall', _87 => _87()]) || {
3127
+ _optionalChain([error, 'access', _87 => _87.toJSON, 'optionalCall', _88 => _88()]) || {
3090
3128
  error: "server_error"
3091
3129
  }
3092
3130
  )
@@ -3139,23 +3177,18 @@ var FastMCP = class extends FastMCPEventEmitter {
3139
3177
  {
3140
3178
  body: Buffer.concat(bodyChunks).toString("utf8"),
3141
3179
  headers: {
3180
+ ...cookieHeaders(req),
3142
3181
  "Content-Type": "application/x-www-form-urlencoded"
3143
3182
  },
3144
3183
  method: "POST"
3145
3184
  }
3146
3185
  );
3147
3186
  const response = await oauthProxy.handleConsent(mockRequest);
3148
- const location = response.headers.get("Location");
3149
- if (location) {
3150
- res.writeHead(response.status, { Location: location }).end();
3151
- } else {
3152
- const text = await response.text();
3153
- res.writeHead(response.status).end(text);
3154
- }
3187
+ await sendOAuthProxyResponse(res, response);
3155
3188
  } catch (error) {
3156
3189
  res.writeHead(400, { "Content-Type": "application/json" }).end(
3157
3190
  JSON.stringify(
3158
- _optionalChain([error, 'access', _88 => _88.toJSON, 'optionalCall', _89 => _89()]) || {
3191
+ _optionalChain([error, 'access', _89 => _89.toJSON, 'optionalCall', _90 => _90()]) || {
3159
3192
  error: "server_error"
3160
3193
  }
3161
3194
  )
@@ -3270,7 +3303,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3270
3303
  }
3271
3304
  res.writeHead(200, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(JSON.stringify(response));
3272
3305
  } catch (error) {
3273
- const body = _optionalChain([error, 'access', _90 => _90.toJSON, 'optionalCall', _91 => _91()]) || {
3306
+ const body = _optionalChain([error, 'access', _91 => _91.toJSON, 'optionalCall', _92 => _92()]) || {
3274
3307
  error: "invalid_request"
3275
3308
  };
3276
3309
  if (body.error === "invalid_client") {
@@ -3300,7 +3333,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3300
3333
  * regardless (RFC 7235), so no config is needed just to get the header.
3301
3334
  */
3302
3335
  #httpStreamOAuthConfig() {
3303
- const resource = _optionalChain([this, 'access', _92 => _92.#options, 'access', _93 => _93.oauth, 'optionalAccess', _94 => _94.enabled]) ? _optionalChain([this, 'access', _95 => _95.#options, 'access', _96 => _96.oauth, 'access', _97 => _97.protectedResource, 'optionalAccess', _98 => _98.resource]) : void 0;
3336
+ const resource = _optionalChain([this, 'access', _93 => _93.#options, 'access', _94 => _94.oauth, 'optionalAccess', _95 => _95.enabled]) ? _optionalChain([this, 'access', _96 => _96.#options, 'access', _97 => _97.oauth, 'access', _98 => _98.protectedResource, 'optionalAccess', _99 => _99.resource]) : void 0;
3304
3337
  if (!resource) {
3305
3338
  return {};
3306
3339
  }
@@ -3406,24 +3439,25 @@ var FastMCP = class extends FastMCPEventEmitter {
3406
3439
  const envBasePath = process.env.FASTMCP_BASE_PATH;
3407
3440
  const envStateless = process.env.FASTMCP_STATELESS;
3408
3441
  const envHost = process.env.FASTMCP_HOST;
3409
- const transportType = _optionalChain([overrides, 'optionalAccess', _99 => _99.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
3442
+ const transportType = _optionalChain([overrides, 'optionalAccess', _100 => _100.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
3410
3443
  if (transportType === "httpStream") {
3411
3444
  const port = parseInt(
3412
- _optionalChain([overrides, 'optionalAccess', _100 => _100.httpStream, 'optionalAccess', _101 => _101.port, 'optionalAccess', _102 => _102.toString, 'call', _103 => _103()]) || portArg || envPort || "8080"
3445
+ _optionalChain([overrides, 'optionalAccess', _101 => _101.httpStream, 'optionalAccess', _102 => _102.port, 'optionalAccess', _103 => _103.toString, 'call', _104 => _104()]) || portArg || envPort || "8080"
3413
3446
  );
3414
- const host = _optionalChain([overrides, 'optionalAccess', _104 => _104.httpStream, 'optionalAccess', _105 => _105.host]) || hostArg || envHost || "localhost";
3415
- const endpoint = _optionalChain([overrides, 'optionalAccess', _106 => _106.httpStream, 'optionalAccess', _107 => _107.endpoint]) || endpointArg || envEndpoint || "/mcp";
3447
+ const host = _optionalChain([overrides, 'optionalAccess', _105 => _105.httpStream, 'optionalAccess', _106 => _106.host]) || hostArg || envHost || "localhost";
3448
+ const endpoint = _optionalChain([overrides, 'optionalAccess', _107 => _107.httpStream, 'optionalAccess', _108 => _108.endpoint]) || endpointArg || envEndpoint || "/mcp";
3416
3449
  const basePath = normalizeBasePath(
3417
- _optionalChain([overrides, 'optionalAccess', _108 => _108.httpStream, 'optionalAccess', _109 => _109.basePath]) || basePathArg || envBasePath
3450
+ _optionalChain([overrides, 'optionalAccess', _109 => _109.httpStream, 'optionalAccess', _110 => _110.basePath]) || basePathArg || envBasePath
3418
3451
  );
3419
- const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _110 => _110.httpStream, 'optionalAccess', _111 => _111.enableJsonResponse]) || false;
3420
- const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _112 => _112.httpStream, 'optionalAccess', _113 => _113.stateless]), () => ( // A bare `--stateless` means `--stateless true`.
3452
+ const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _111 => _111.httpStream, 'optionalAccess', _112 => _112.enableJsonResponse]) || false;
3453
+ const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _113 => _113.httpStream, 'optionalAccess', _114 => _114.stateless]), () => ( // A bare `--stateless` means `--stateless true`.
3421
3454
  (statelessArg === "" ? true : parseBooleanSetting(statelessArg, "--stateless")))), () => ( parseBooleanSetting(envStateless, "FASTMCP_STATELESS"))), () => ( false));
3422
- const cors = _optionalChain([overrides, 'optionalAccess', _114 => _114.httpStream, 'optionalAccess', _115 => _115.cors]);
3423
- const eventStore = _optionalChain([overrides, 'optionalAccess', _116 => _116.httpStream, 'optionalAccess', _117 => _117.eventStore]);
3424
- const sslCa = _optionalChain([overrides, 'optionalAccess', _118 => _118.httpStream, 'optionalAccess', _119 => _119.sslCa]);
3425
- const sslCert = _optionalChain([overrides, 'optionalAccess', _120 => _120.httpStream, 'optionalAccess', _121 => _121.sslCert]);
3426
- const sslKey = _optionalChain([overrides, 'optionalAccess', _122 => _122.httpStream, 'optionalAccess', _123 => _123.sslKey]);
3455
+ const cors = _optionalChain([overrides, 'optionalAccess', _115 => _115.httpStream, 'optionalAccess', _116 => _116.cors]);
3456
+ const eventStore = _optionalChain([overrides, 'optionalAccess', _117 => _117.httpStream, 'optionalAccess', _118 => _118.eventStore]);
3457
+ const sseEndpoint = _optionalChain([overrides, 'optionalAccess', _119 => _119.httpStream, 'optionalAccess', _120 => _120.sseEndpoint]);
3458
+ const sslCa = _optionalChain([overrides, 'optionalAccess', _121 => _121.httpStream, 'optionalAccess', _122 => _122.sslCa]);
3459
+ const sslCert = _optionalChain([overrides, 'optionalAccess', _123 => _123.httpStream, 'optionalAccess', _124 => _124.sslCert]);
3460
+ const sslKey = _optionalChain([overrides, 'optionalAccess', _125 => _125.httpStream, 'optionalAccess', _126 => _126.sslKey]);
3427
3461
  return {
3428
3462
  httpStream: {
3429
3463
  basePath,
@@ -3433,6 +3467,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3433
3467
  eventStore,
3434
3468
  host,
3435
3469
  port,
3470
+ sseEndpoint,
3436
3471
  sslCa,
3437
3472
  sslCert,
3438
3473
  sslKey,
@@ -3514,7 +3549,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3514
3549
  */
3515
3550
  #useEndpointAsResource(endpoint) {
3516
3551
  const oauth = this.#options.oauth;
3517
- if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _124 => _124.protectedResource]))
3552
+ if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _127 => _127.protectedResource]))
3518
3553
  return;
3519
3554
  this.#options = {
3520
3555
  ...this.#options,
@@ -3543,4 +3578,4 @@ var FastMCP = class extends FastMCPEventEmitter {
3543
3578
 
3544
3579
 
3545
3580
  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;
3546
- //# sourceMappingURL=chunk-VWHJYU4V.cjs.map
3581
+ //# sourceMappingURL=chunk-MT5SJOZ5.cjs.map