fastmcp 4.20.1 → 4.20.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 CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkTMDXVX4Lcjs = require('./chunk-TMDXVX4L.cjs');
14
+ var _chunkX4AKKWFDcjs = require('./chunk-X4AKKWFD.cjs');
15
15
 
16
16
 
17
17
 
@@ -49,5 +49,5 @@ var _chunkYO76IUZ6cjs = require('./chunk-YO76IUZ6.cjs');
49
49
 
50
50
 
51
51
 
52
- exports.AuthProvider = _chunkYO76IUZ6cjs.AuthProvider; exports.AzureProvider = _chunkYO76IUZ6cjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkTMDXVX4Lcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkTMDXVX4Lcjs.FastMCP; exports.FastMCPError = _chunkTMDXVX4Lcjs.FastMCPError; exports.FastMCPSession = _chunkTMDXVX4Lcjs.FastMCPSession; exports.GitHubProvider = _chunkYO76IUZ6cjs.GitHubProvider; exports.GoogleProvider = _chunkYO76IUZ6cjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkTMDXVX4Lcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkYO76IUZ6cjs.OAuthProvider; exports.ServerState = _chunkTMDXVX4Lcjs.ServerState; exports.SessionError = _chunkTMDXVX4Lcjs.SessionError; exports.UnexpectedStateError = _chunkTMDXVX4Lcjs.UnexpectedStateError; exports.UserError = _chunkTMDXVX4Lcjs.UserError; exports.audioContent = _chunkTMDXVX4Lcjs.audioContent; exports.getAuthSession = _chunkYO76IUZ6cjs.getAuthSession; exports.imageContent = _chunkTMDXVX4Lcjs.imageContent; exports.jsonSchemaAdapter = _chunkTMDXVX4Lcjs.jsonSchemaAdapter; exports.requireAll = _chunkYO76IUZ6cjs.requireAll; exports.requireAny = _chunkYO76IUZ6cjs.requireAny; exports.requireAuth = _chunkYO76IUZ6cjs.requireAuth; exports.requireRole = _chunkYO76IUZ6cjs.requireRole; exports.requireScopes = _chunkYO76IUZ6cjs.requireScopes;
52
+ exports.AuthProvider = _chunkYO76IUZ6cjs.AuthProvider; exports.AzureProvider = _chunkYO76IUZ6cjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkX4AKKWFDcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkX4AKKWFDcjs.FastMCP; exports.FastMCPError = _chunkX4AKKWFDcjs.FastMCPError; exports.FastMCPSession = _chunkX4AKKWFDcjs.FastMCPSession; exports.GitHubProvider = _chunkYO76IUZ6cjs.GitHubProvider; exports.GoogleProvider = _chunkYO76IUZ6cjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkX4AKKWFDcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkYO76IUZ6cjs.OAuthProvider; exports.ServerState = _chunkX4AKKWFDcjs.ServerState; exports.SessionError = _chunkX4AKKWFDcjs.SessionError; exports.UnexpectedStateError = _chunkX4AKKWFDcjs.UnexpectedStateError; exports.UserError = _chunkX4AKKWFDcjs.UserError; exports.audioContent = _chunkX4AKKWFDcjs.audioContent; exports.getAuthSession = _chunkYO76IUZ6cjs.getAuthSession; exports.imageContent = _chunkX4AKKWFDcjs.imageContent; exports.jsonSchemaAdapter = _chunkX4AKKWFDcjs.jsonSchemaAdapter; exports.requireAll = _chunkYO76IUZ6cjs.requireAll; exports.requireAny = _chunkYO76IUZ6cjs.requireAny; exports.requireAuth = _chunkYO76IUZ6cjs.requireAuth; exports.requireRole = _chunkYO76IUZ6cjs.requireRole; exports.requireScopes = _chunkYO76IUZ6cjs.requireScopes;
53
53
  //# sourceMappingURL=FastMCP.cjs.map
package/dist/FastMCP.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  audioContent,
12
12
  imageContent,
13
13
  jsonSchemaAdapter
14
- } from "./chunk-RGV6FTGL.js";
14
+ } from "./chunk-KBWJEPOD.js";
15
15
  import {
16
16
  AuthProvider,
17
17
  AzureProvider,
@@ -2280,8 +2280,15 @@ var FastMCP = class extends FastMCPEventEmitter {
2280
2280
  if (!res.headersSent) {
2281
2281
  res.statusCode = honoResponse.status;
2282
2282
  honoResponse.headers.forEach((value, key) => {
2283
+ if (key.toLowerCase() === "set-cookie") {
2284
+ return;
2285
+ }
2283
2286
  res.setHeader(key, value);
2284
2287
  });
2288
+ const setCookies = honoResponse.headers.getSetCookie();
2289
+ if (setCookies.length > 0) {
2290
+ res.setHeader("Set-Cookie", setCookies);
2291
+ }
2285
2292
  if (honoResponse.body) {
2286
2293
  const reader = honoResponse.body.getReader();
2287
2294
  let resolveClosed;
@@ -2679,26 +2686,24 @@ var FastMCP = class extends FastMCPEventEmitter {
2679
2686
  }
2680
2687
  };
2681
2688
  /**
2682
- * mcp-proxy only emits `WWW-Authenticate` on 401 when `oauth` is set.
2683
- * Custom `authenticate()` still needs that challenge with no OAuth metadata
2684
- * configured (RFC 7235). Pass an empty oauth object in that case so the
2685
- * header is present without advertising a resource_metadata URL that 404s.
2689
+ * Only advertise `resource_metadata` when OAuth is enabled: the
2690
+ * `/.well-known/oauth-protected-resource` endpoint is served only under
2691
+ * `oauth.enabled`, so gating here avoids pointing clients at a URL that
2692
+ * would 404. mcp-proxy emits the `WWW-Authenticate` challenge on every 401
2693
+ * regardless (RFC 7235), so no config is needed just to get the header.
2686
2694
  */
2687
2695
  #httpStreamOAuthConfig() {
2688
2696
  const resource = this.#options.oauth?.enabled ? this.#options.oauth.protectedResource?.resource : void 0;
2689
- if (resource) {
2690
- return {
2691
- oauth: {
2692
- protectedResource: {
2693
- resource
2694
- }
2695
- }
2696
- };
2697
- }
2698
- if (this.#authenticate) {
2699
- return { oauth: {} };
2697
+ if (!resource) {
2698
+ return {};
2700
2699
  }
2701
- return {};
2700
+ return {
2701
+ oauth: {
2702
+ protectedResource: {
2703
+ resource
2704
+ }
2705
+ }
2706
+ };
2702
2707
  }
2703
2708
  /**
2704
2709
  * On `httpStream`, `authenticate` is handed to both mcp-proxy (which calls it
@@ -2902,4 +2907,4 @@ export {
2902
2907
  FastMCPSession,
2903
2908
  FastMCP
2904
2909
  };
2905
- //# sourceMappingURL=chunk-RGV6FTGL.js.map
2910
+ //# sourceMappingURL=chunk-KBWJEPOD.js.map