fastmcp 4.28.4 → 4.29.0

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 (37) hide show
  1. package/README.md +21 -0
  2. package/dist/FastMCP.cjs +4 -4
  3. package/dist/FastMCP.d.cts +4 -2
  4. package/dist/FastMCP.d.ts +4 -2
  5. package/dist/FastMCP.js +3 -3
  6. package/dist/auth/index.cjs +2 -2
  7. package/dist/auth/index.js +1 -1
  8. package/dist/{chunk-DPJW5QEO.cjs → chunk-5EEESM57.cjs} +64 -92
  9. package/dist/chunk-5EEESM57.cjs.map +1 -0
  10. package/dist/{chunk-OCCYKYIM.cjs → chunk-FBDPX4H2.cjs} +30 -3
  11. package/dist/chunk-FBDPX4H2.cjs.map +1 -0
  12. package/dist/{chunk-B2QUCZGV.js → chunk-JCKJRUCE.js} +30 -3
  13. package/dist/chunk-JCKJRUCE.js.map +1 -0
  14. package/dist/{chunk-UFPH23EN.js → chunk-RWPENEKV.js} +5 -1
  15. package/dist/{chunk-UFPH23EN.js.map → chunk-RWPENEKV.js.map} +1 -1
  16. package/dist/{chunk-7IQ5QHVZ.cjs → chunk-UHJQUSUX.cjs} +5 -1
  17. package/dist/chunk-UHJQUSUX.cjs.map +1 -0
  18. package/dist/{chunk-Q57EM4LH.js → chunk-VN5SZ6IE.js} +31 -59
  19. package/dist/chunk-VN5SZ6IE.js.map +1 -0
  20. package/dist/edge/index.cjs +15 -4
  21. package/dist/edge/index.cjs.map +1 -1
  22. package/dist/edge/index.d.cts +4 -0
  23. package/dist/edge/index.d.ts +4 -0
  24. package/dist/edge/index.js +13 -2
  25. package/dist/edge/index.js.map +1 -1
  26. package/dist/examples/custom-routes.cjs +4 -4
  27. package/dist/examples/custom-routes.js +3 -3
  28. package/dist/openapi/index.cjs +145 -132
  29. package/dist/openapi/index.cjs.map +1 -1
  30. package/dist/openapi/index.js +136 -123
  31. package/dist/openapi/index.js.map +1 -1
  32. package/package.json +3 -3
  33. package/dist/chunk-7IQ5QHVZ.cjs.map +0 -1
  34. package/dist/chunk-B2QUCZGV.js.map +0 -1
  35. package/dist/chunk-DPJW5QEO.cjs.map +0 -1
  36. package/dist/chunk-OCCYKYIM.cjs.map +0 -1
  37. package/dist/chunk-Q57EM4LH.js.map +0 -1
package/README.md CHANGED
@@ -1848,6 +1848,27 @@ server.addTool({
1848
1848
  });
1849
1849
  ```
1850
1850
 
1851
+ #### Loaders that use auth
1852
+
1853
+ `embedded()` is called on the server, not on a session, so by default the loader gets no `auth`. Pass the tool's `context` and the loader sees the same `auth` and load context it would get from `resources/read`:
1854
+
1855
+ ```js
1856
+ server.addTool({
1857
+ name: "get_my_profile",
1858
+ parameters: z.object({}),
1859
+ execute: async (args, context) => {
1860
+ return {
1861
+ content: [
1862
+ {
1863
+ type: "resource",
1864
+ resource: await server.embedded("user://me", context),
1865
+ },
1866
+ ],
1867
+ };
1868
+ },
1869
+ });
1870
+ ```
1871
+
1851
1872
  ### Prompts
1852
1873
 
1853
1874
  [Prompts](https://modelcontextprotocol.io/docs/concepts/prompts) enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs. They provide a powerful way to standardize and share common LLM interactions.
package/dist/FastMCP.cjs CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkDPJW5QEOcjs = require('./chunk-DPJW5QEO.cjs');
14
+ var _chunk5EEESM57cjs = require('./chunk-5EEESM57.cjs');
15
15
 
16
16
 
17
17
 
@@ -24,8 +24,8 @@ var _chunkDPJW5QEOcjs = require('./chunk-DPJW5QEO.cjs');
24
24
 
25
25
 
26
26
 
27
- var _chunk7IQ5QHVZcjs = require('./chunk-7IQ5QHVZ.cjs');
28
- require('./chunk-OCCYKYIM.cjs');
27
+ var _chunkUHJQUSUXcjs = require('./chunk-UHJQUSUX.cjs');
28
+ require('./chunk-FBDPX4H2.cjs');
29
29
 
30
30
 
31
31
 
@@ -50,5 +50,5 @@ require('./chunk-OCCYKYIM.cjs');
50
50
 
51
51
 
52
52
 
53
- exports.AuthProvider = _chunk7IQ5QHVZcjs.AuthProvider; exports.AzureProvider = _chunk7IQ5QHVZcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunkDPJW5QEOcjs.DiscoveryDocumentCache; exports.FastMCP = _chunkDPJW5QEOcjs.FastMCP; exports.FastMCPError = _chunkDPJW5QEOcjs.FastMCPError; exports.FastMCPSession = _chunkDPJW5QEOcjs.FastMCPSession; exports.GitHubProvider = _chunk7IQ5QHVZcjs.GitHubProvider; exports.GoogleProvider = _chunk7IQ5QHVZcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunkDPJW5QEOcjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunk7IQ5QHVZcjs.OAuthProvider; exports.ServerState = _chunkDPJW5QEOcjs.ServerState; exports.SessionError = _chunkDPJW5QEOcjs.SessionError; exports.UnexpectedStateError = _chunkDPJW5QEOcjs.UnexpectedStateError; exports.UserError = _chunkDPJW5QEOcjs.UserError; exports.audioContent = _chunkDPJW5QEOcjs.audioContent; exports.getAuthSession = _chunk7IQ5QHVZcjs.getAuthSession; exports.imageContent = _chunkDPJW5QEOcjs.imageContent; exports.jsonSchemaAdapter = _chunkDPJW5QEOcjs.jsonSchemaAdapter; exports.requireAll = _chunk7IQ5QHVZcjs.requireAll; exports.requireAny = _chunk7IQ5QHVZcjs.requireAny; exports.requireAuth = _chunk7IQ5QHVZcjs.requireAuth; exports.requireRole = _chunk7IQ5QHVZcjs.requireRole; exports.requireScopes = _chunk7IQ5QHVZcjs.requireScopes;
53
+ exports.AuthProvider = _chunkUHJQUSUXcjs.AuthProvider; exports.AzureProvider = _chunkUHJQUSUXcjs.AzureProvider; exports.DiscoveryDocumentCache = _chunk5EEESM57cjs.DiscoveryDocumentCache; exports.FastMCP = _chunk5EEESM57cjs.FastMCP; exports.FastMCPError = _chunk5EEESM57cjs.FastMCPError; exports.FastMCPSession = _chunk5EEESM57cjs.FastMCPSession; exports.GitHubProvider = _chunkUHJQUSUXcjs.GitHubProvider; exports.GoogleProvider = _chunkUHJQUSUXcjs.GoogleProvider; exports.MEDIA_FETCH_TIMEOUT_MS = _chunk5EEESM57cjs.MEDIA_FETCH_TIMEOUT_MS; exports.OAuthProvider = _chunkUHJQUSUXcjs.OAuthProvider; exports.ServerState = _chunk5EEESM57cjs.ServerState; exports.SessionError = _chunk5EEESM57cjs.SessionError; exports.UnexpectedStateError = _chunk5EEESM57cjs.UnexpectedStateError; exports.UserError = _chunk5EEESM57cjs.UserError; exports.audioContent = _chunk5EEESM57cjs.audioContent; exports.getAuthSession = _chunkUHJQUSUXcjs.getAuthSession; exports.imageContent = _chunk5EEESM57cjs.imageContent; exports.jsonSchemaAdapter = _chunk5EEESM57cjs.jsonSchemaAdapter; exports.requireAll = _chunkUHJQUSUXcjs.requireAll; exports.requireAny = _chunkUHJQUSUXcjs.requireAny; exports.requireAuth = _chunkUHJQUSUXcjs.requireAuth; exports.requireRole = _chunkUHJQUSUXcjs.requireRole; exports.requireScopes = _chunkUHJQUSUXcjs.requireScopes;
54
54
  //# sourceMappingURL=FastMCP.cjs.map
@@ -1102,9 +1102,10 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
1102
1102
  * Embeds a resource by URI, making it easy to include resources in tool responses.
1103
1103
  *
1104
1104
  * @param uri - The URI of the resource to embed
1105
+ * @param context - The calling tool's context; its `session` reaches the loader as `auth`
1105
1106
  * @returns Promise<ResourceContent> - The embedded resource content
1106
1107
  */
1107
- embedded(uri: string): Promise<ResourceContent["resource"]>;
1108
+ embedded(uri: string, context?: LoadContext<T>): Promise<ResourceContent["resource"]>;
1108
1109
  /**
1109
1110
  * Returns the underlying Hono app instance for direct access to Hono's native API.
1110
1111
  * This allows you to add custom routes, middleware, and handlers using Hono's standard methods.
@@ -1192,7 +1193,8 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
1192
1193
  }>): Promise<void>;
1193
1194
  /**
1194
1195
  * Stops transports created by `start()`. Transports passed to `connect()`
1195
- * remain open and belong to the caller.
1196
+ * remain open and belong to the caller, and continue receiving registration
1197
+ * updates until they are closed.
1196
1198
  */
1197
1199
  stop(): Promise<void>;
1198
1200
  }
package/dist/FastMCP.d.ts CHANGED
@@ -1102,9 +1102,10 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
1102
1102
  * Embeds a resource by URI, making it easy to include resources in tool responses.
1103
1103
  *
1104
1104
  * @param uri - The URI of the resource to embed
1105
+ * @param context - The calling tool's context; its `session` reaches the loader as `auth`
1105
1106
  * @returns Promise<ResourceContent> - The embedded resource content
1106
1107
  */
1107
- embedded(uri: string): Promise<ResourceContent["resource"]>;
1108
+ embedded(uri: string, context?: LoadContext<T>): Promise<ResourceContent["resource"]>;
1108
1109
  /**
1109
1110
  * Returns the underlying Hono app instance for direct access to Hono's native API.
1110
1111
  * This allows you to add custom routes, middleware, and handlers using Hono's standard methods.
@@ -1192,7 +1193,8 @@ declare class FastMCP<T extends FastMCPSessionAuth = FastMCPSessionAuth> extends
1192
1193
  }>): Promise<void>;
1193
1194
  /**
1194
1195
  * Stops transports created by `start()`. Transports passed to `connect()`
1195
- * remain open and belong to the caller.
1196
+ * remain open and belong to the caller, and continue receiving registration
1197
+ * updates until they are closed.
1196
1198
  */
1197
1199
  stop(): Promise<void>;
1198
1200
  }
package/dist/FastMCP.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  audioContent,
12
12
  imageContent,
13
13
  jsonSchemaAdapter
14
- } from "./chunk-Q57EM4LH.js";
14
+ } from "./chunk-VN5SZ6IE.js";
15
15
  import {
16
16
  AuthProvider,
17
17
  AzureProvider,
@@ -24,8 +24,8 @@ import {
24
24
  requireAuth,
25
25
  requireRole,
26
26
  requireScopes
27
- } from "./chunk-UFPH23EN.js";
28
- import "./chunk-B2QUCZGV.js";
27
+ } from "./chunk-RWPENEKV.js";
28
+ import "./chunk-JCKJRUCE.js";
29
29
  export {
30
30
  AuthProvider,
31
31
  AzureProvider,
@@ -25,7 +25,7 @@
25
25
 
26
26
 
27
27
 
28
- var _chunk7IQ5QHVZcjs = require('../chunk-7IQ5QHVZ.cjs');
28
+ var _chunkUHJQUSUXcjs = require('../chunk-UHJQUSUX.cjs');
29
29
 
30
30
 
31
31
 
@@ -53,5 +53,5 @@ var _chunk7IQ5QHVZcjs = require('../chunk-7IQ5QHVZ.cjs');
53
53
 
54
54
 
55
55
 
56
- exports.AuthProvider = _chunk7IQ5QHVZcjs.AuthProvider; exports.AzureProvider = _chunk7IQ5QHVZcjs.AzureProvider; exports.ConsentManager = _chunk7IQ5QHVZcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunk7IQ5QHVZcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunk7IQ5QHVZcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunk7IQ5QHVZcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunk7IQ5QHVZcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunk7IQ5QHVZcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunk7IQ5QHVZcjs.DiskStore; exports.EncryptedTokenStorage = _chunk7IQ5QHVZcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunk7IQ5QHVZcjs.GitHubProvider; exports.GoogleProvider = _chunk7IQ5QHVZcjs.GoogleProvider; exports.JWKSVerifier = _chunk7IQ5QHVZcjs.JWKSVerifier; exports.JWTIssuer = _chunk7IQ5QHVZcjs.JWTIssuer; exports.MemoryTokenStorage = _chunk7IQ5QHVZcjs.MemoryTokenStorage; exports.OAuthProvider = _chunk7IQ5QHVZcjs.OAuthProvider; exports.OAuthProxy = _chunk7IQ5QHVZcjs.OAuthProxy; exports.OAuthProxyError = _chunk7IQ5QHVZcjs.OAuthProxyError; exports.PKCEUtils = _chunk7IQ5QHVZcjs.PKCEUtils; exports.TOKEN_ENDPOINT_AUTH_METHODS = _chunk7IQ5QHVZcjs.TOKEN_ENDPOINT_AUTH_METHODS; exports.getAuthSession = _chunk7IQ5QHVZcjs.getAuthSession; exports.requireAll = _chunk7IQ5QHVZcjs.requireAll; exports.requireAny = _chunk7IQ5QHVZcjs.requireAny; exports.requireAuth = _chunk7IQ5QHVZcjs.requireAuth; exports.requireRole = _chunk7IQ5QHVZcjs.requireRole; exports.requireScopes = _chunk7IQ5QHVZcjs.requireScopes;
56
+ exports.AuthProvider = _chunkUHJQUSUXcjs.AuthProvider; exports.AzureProvider = _chunkUHJQUSUXcjs.AzureProvider; exports.ConsentManager = _chunkUHJQUSUXcjs.ConsentManager; exports.DEFAULT_ACCESS_TOKEN_TTL = _chunkUHJQUSUXcjs.DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = _chunkUHJQUSUXcjs.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_AUTHORIZATION_CODE_TTL = _chunkUHJQUSUXcjs.DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_REFRESH_TOKEN_TTL = _chunkUHJQUSUXcjs.DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_TRANSACTION_TTL = _chunkUHJQUSUXcjs.DEFAULT_TRANSACTION_TTL; exports.DiskStore = _chunkUHJQUSUXcjs.DiskStore; exports.EncryptedTokenStorage = _chunkUHJQUSUXcjs.EncryptedTokenStorage; exports.GitHubProvider = _chunkUHJQUSUXcjs.GitHubProvider; exports.GoogleProvider = _chunkUHJQUSUXcjs.GoogleProvider; exports.JWKSVerifier = _chunkUHJQUSUXcjs.JWKSVerifier; exports.JWTIssuer = _chunkUHJQUSUXcjs.JWTIssuer; exports.MemoryTokenStorage = _chunkUHJQUSUXcjs.MemoryTokenStorage; exports.OAuthProvider = _chunkUHJQUSUXcjs.OAuthProvider; exports.OAuthProxy = _chunkUHJQUSUXcjs.OAuthProxy; exports.OAuthProxyError = _chunkUHJQUSUXcjs.OAuthProxyError; exports.PKCEUtils = _chunkUHJQUSUXcjs.PKCEUtils; exports.TOKEN_ENDPOINT_AUTH_METHODS = _chunkUHJQUSUXcjs.TOKEN_ENDPOINT_AUTH_METHODS; exports.getAuthSession = _chunkUHJQUSUXcjs.getAuthSession; exports.requireAll = _chunkUHJQUSUXcjs.requireAll; exports.requireAny = _chunkUHJQUSUXcjs.requireAny; exports.requireAuth = _chunkUHJQUSUXcjs.requireAuth; exports.requireRole = _chunkUHJQUSUXcjs.requireRole; exports.requireScopes = _chunkUHJQUSUXcjs.requireScopes;
57
57
  //# sourceMappingURL=index.cjs.map
@@ -25,7 +25,7 @@ import {
25
25
  requireAuth,
26
26
  requireRole,
27
27
  requireScopes
28
- } from "../chunk-UFPH23EN.js";
28
+ } from "../chunk-RWPENEKV.js";
29
29
  export {
30
30
  AuthProvider,
31
31
  AzureProvider,
@@ -1,11 +1,11 @@
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 _chunk7IQ5QHVZcjs = require('./chunk-7IQ5QHVZ.cjs');
3
+ var _chunkUHJQUSUXcjs = require('./chunk-UHJQUSUX.cjs');
4
4
 
5
5
 
6
6
 
7
7
 
8
- var _chunkOCCYKYIMcjs = require('./chunk-OCCYKYIM.cjs');
8
+ var _chunkFBDPX4H2cjs = require('./chunk-FBDPX4H2.cjs');
9
9
 
10
10
  // src/FastMCP.ts
11
11
  var _indexjs = require('@modelcontextprotocol/sdk/server/index.js');
@@ -141,7 +141,7 @@ var DiscoveryDocumentCache = class {
141
141
  throw error;
142
142
  }
143
143
  if (!res.ok) {
144
- await _chunk7IQ5QHVZcjs.cancelResponseBody.call(void 0, res);
144
+ await _chunkUHJQUSUXcjs.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 _chunk7IQ5QHVZcjs.cancelResponseBody.call(void 0, response);
261
+ await _chunkUHJQUSUXcjs.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 _chunk7IQ5QHVZcjs.cancelResponseBody.call(void 0, response);
343
+ await _chunkUHJQUSUXcjs.cancelResponseBody.call(void 0, response);
344
344
  throw new Error(
345
345
  `Server responded with status: ${response.status} - ${response.statusText}`
346
346
  );
@@ -1655,8 +1655,8 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1655
1655
  tools.map(async (tool) => {
1656
1656
  let inputSchema;
1657
1657
  try {
1658
- inputSchema = tool.parameters ? _chunkOCCYKYIMcjs.strictInputSchema.call(void 0,
1659
- tool.parameters["~standard"].vendor === "zod" && "_zod" in tool.parameters ? _chunkOCCYKYIMcjs.zodInputSchema.call(void 0, tool.parameters, "draft-7") : await _xsschema.toJsonSchema.call(void 0, tool.parameters)
1658
+ inputSchema = tool.parameters ? _chunkFBDPX4H2cjs.strictInputSchema.call(void 0,
1659
+ tool.parameters["~standard"].vendor === "zod" && "_zod" in tool.parameters ? _chunkFBDPX4H2cjs.zodInputSchema.call(void 0, tool.parameters, "draft-7") : await _xsschema.toJsonSchema.call(void 0, tool.parameters)
1660
1660
  ) : {
1661
1661
  additionalProperties: false,
1662
1662
  properties: {},
@@ -1678,7 +1678,7 @@ ${error instanceof Error ? error.stack : JSON.stringify(error)}`
1678
1678
  let outputSchema;
1679
1679
  if (tool.outputSchema) {
1680
1680
  try {
1681
- outputSchema = _chunkOCCYKYIMcjs.objectRootSchema.call(void 0,
1681
+ outputSchema = _chunkFBDPX4H2cjs.objectRootSchema.call(void 0,
1682
1682
  await _xsschema.toJsonSchema.call(void 0, tool.outputSchema)
1683
1683
  );
1684
1684
  } catch (error) {
@@ -2273,9 +2273,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2273
2273
  addPrompt(prompt) {
2274
2274
  this.#prompts = this.#prompts.filter((p) => p.name !== prompt.name);
2275
2275
  this.#prompts.push(prompt);
2276
- if (this.#serverState === "running" /* Running */) {
2277
- this.#promptsListChanged(this.#prompts);
2278
- }
2276
+ this.#promptsListChanged(this.#prompts);
2279
2277
  }
2280
2278
  /**
2281
2279
  * Adds prompts to the server.
@@ -2289,9 +2287,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2289
2287
  promptsByName.set(prompt.name, prompt);
2290
2288
  }
2291
2289
  this.#prompts = Array.from(promptsByName.values());
2292
- if (this.#serverState === "running" /* Running */) {
2293
- this.#promptsListChanged(this.#prompts);
2294
- }
2290
+ this.#promptsListChanged(this.#prompts);
2295
2291
  }
2296
2292
  /**
2297
2293
  * Adds a resource to the server.
@@ -2301,9 +2297,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2301
2297
  (r) => r.name !== resource.name && r.uri !== resource.uri
2302
2298
  );
2303
2299
  this.#resources.push(resource);
2304
- if (this.#serverState === "running" /* Running */) {
2305
- this.#resourcesListChanged(this.#resources);
2306
- }
2300
+ this.#resourcesListChanged(this.#resources);
2307
2301
  }
2308
2302
  /**
2309
2303
  * Adds resources to the server.
@@ -2315,9 +2309,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2315
2309
  );
2316
2310
  this.#resources.push(resource);
2317
2311
  }
2318
- if (this.#serverState === "running" /* Running */) {
2319
- this.#resourcesListChanged(this.#resources);
2320
- }
2312
+ this.#resourcesListChanged(this.#resources);
2321
2313
  }
2322
2314
  /**
2323
2315
  * Adds a resource template to the server.
@@ -2327,9 +2319,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2327
2319
  (t) => t.name !== resource.name
2328
2320
  );
2329
2321
  this.#resourcesTemplates.push(resource);
2330
- if (this.#serverState === "running" /* Running */) {
2331
- this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2332
- }
2322
+ this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2333
2323
  }
2334
2324
  /**
2335
2325
  * Adds resource templates to the server.
@@ -2341,9 +2331,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2341
2331
  );
2342
2332
  this.#resourcesTemplates.push(resource);
2343
2333
  }
2344
- if (this.#serverState === "running" /* Running */) {
2345
- this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2346
- }
2334
+ this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2347
2335
  }
2348
2336
  /**
2349
2337
  * Adds a tool to the server.
@@ -2352,9 +2340,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2352
2340
  assertToolSchemas(tool);
2353
2341
  this.#tools = this.#tools.filter((t) => t.name !== tool.name);
2354
2342
  this.#tools.push(tool);
2355
- if (this.#serverState === "running" /* Running */) {
2356
- this.#toolsListChanged(this.#tools);
2357
- }
2343
+ this.#toolsListChanged(this.#tools);
2358
2344
  }
2359
2345
  /**
2360
2346
  * Adds tools to the server.
@@ -2367,9 +2353,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2367
2353
  toolsByName.set(tool.name, tool);
2368
2354
  }
2369
2355
  this.#tools = Array.from(toolsByName.values());
2370
- if (this.#serverState === "running" /* Running */) {
2371
- this.#toolsListChanged(this.#tools);
2372
- }
2356
+ this.#toolsListChanged(this.#tools);
2373
2357
  }
2374
2358
  /**
2375
2359
  * Connects the server to a transport you constructed yourself, instead of
@@ -2409,14 +2393,15 @@ var FastMCP = class extends FastMCPEventEmitter {
2409
2393
  * Embeds a resource by URI, making it easy to include resources in tool responses.
2410
2394
  *
2411
2395
  * @param uri - The URI of the resource to embed
2396
+ * @param context - The calling tool's context; its `session` reaches the loader as `auth`
2412
2397
  * @returns Promise<ResourceContent> - The embedded resource content
2413
2398
  */
2414
- async embedded(uri) {
2399
+ async embedded(uri, context) {
2415
2400
  const directResource = this.#resources.find(
2416
2401
  (resource) => resource.uri === uri
2417
2402
  );
2418
2403
  if (directResource) {
2419
- const result = await directResource.load();
2404
+ const result = await directResource.load(_optionalChain([context, 'optionalAccess', _72 => _72.session]), context);
2420
2405
  const results = Array.isArray(result) ? result : [result];
2421
2406
  const firstResult = results[0];
2422
2407
  if (!firstResult) {
@@ -2444,7 +2429,9 @@ var FastMCP = class extends FastMCPEventEmitter {
2444
2429
  continue;
2445
2430
  }
2446
2431
  const result = await template.load(
2447
- params
2432
+ params,
2433
+ _optionalChain([context, 'optionalAccess', _73 => _73.session]),
2434
+ context
2448
2435
  );
2449
2436
  const results = Array.isArray(result) ? result : [result];
2450
2437
  const firstResult = results[0];
@@ -2497,9 +2484,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2497
2484
  */
2498
2485
  removePrompt(name) {
2499
2486
  this.#prompts = this.#prompts.filter((p) => p.name !== name);
2500
- if (this.#serverState === "running" /* Running */) {
2501
- this.#promptsListChanged(this.#prompts);
2502
- }
2487
+ this.#promptsListChanged(this.#prompts);
2503
2488
  }
2504
2489
  /**
2505
2490
  * Removes prompts from the server.
@@ -2508,18 +2493,14 @@ var FastMCP = class extends FastMCPEventEmitter {
2508
2493
  for (const name of names) {
2509
2494
  this.#prompts = this.#prompts.filter((p) => p.name !== name);
2510
2495
  }
2511
- if (this.#serverState === "running" /* Running */) {
2512
- this.#promptsListChanged(this.#prompts);
2513
- }
2496
+ this.#promptsListChanged(this.#prompts);
2514
2497
  }
2515
2498
  /**
2516
2499
  * Removes a resource from the server.
2517
2500
  */
2518
2501
  removeResource(name) {
2519
2502
  this.#resources = this.#resources.filter((r) => r.name !== name);
2520
- if (this.#serverState === "running" /* Running */) {
2521
- this.#resourcesListChanged(this.#resources);
2522
- }
2503
+ this.#resourcesListChanged(this.#resources);
2523
2504
  }
2524
2505
  /**
2525
2506
  * Removes resources from the server.
@@ -2528,9 +2509,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2528
2509
  for (const name of names) {
2529
2510
  this.#resources = this.#resources.filter((r) => r.name !== name);
2530
2511
  }
2531
- if (this.#serverState === "running" /* Running */) {
2532
- this.#resourcesListChanged(this.#resources);
2533
- }
2512
+ this.#resourcesListChanged(this.#resources);
2534
2513
  }
2535
2514
  /**
2536
2515
  * Removes a resource template from the server.
@@ -2539,9 +2518,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2539
2518
  this.#resourcesTemplates = this.#resourcesTemplates.filter(
2540
2519
  (t) => t.name !== name
2541
2520
  );
2542
- if (this.#serverState === "running" /* Running */) {
2543
- this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2544
- }
2521
+ this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2545
2522
  }
2546
2523
  /**
2547
2524
  * Removes resource templates from the server.
@@ -2552,18 +2529,14 @@ var FastMCP = class extends FastMCPEventEmitter {
2552
2529
  (t) => t.name !== name
2553
2530
  );
2554
2531
  }
2555
- if (this.#serverState === "running" /* Running */) {
2556
- this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2557
- }
2532
+ this.#resourceTemplatesListChanged(this.#resourcesTemplates);
2558
2533
  }
2559
2534
  /**
2560
2535
  * Removes a tool from the server.
2561
2536
  */
2562
2537
  removeTool(name) {
2563
2538
  this.#tools = this.#tools.filter((t) => t.name !== name);
2564
- if (this.#serverState === "running" /* Running */) {
2565
- this.#toolsListChanged(this.#tools);
2566
- }
2539
+ this.#toolsListChanged(this.#tools);
2567
2540
  }
2568
2541
  /**
2569
2542
  * Removes tools from the server.
@@ -2572,9 +2545,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2572
2545
  for (const name of names) {
2573
2546
  this.#tools = this.#tools.filter((t) => t.name !== name);
2574
2547
  }
2575
- if (this.#serverState === "running" /* Running */) {
2576
- this.#toolsListChanged(this.#tools);
2577
- }
2548
+ this.#toolsListChanged(this.#tools);
2578
2549
  }
2579
2550
  /**
2580
2551
  * Notifies subscribed clients that a resource's contents have changed.
@@ -2815,7 +2786,8 @@ var FastMCP = class extends FastMCPEventEmitter {
2815
2786
  }
2816
2787
  /**
2817
2788
  * Stops transports created by `start()`. Transports passed to `connect()`
2818
- * remain open and belong to the caller.
2789
+ * remain open and belong to the caller, and continue receiving registration
2790
+ * updates until they are closed.
2819
2791
  */
2820
2792
  async stop() {
2821
2793
  await Promise.all(
@@ -2854,9 +2826,9 @@ var FastMCP = class extends FastMCPEventEmitter {
2854
2826
  const originalOnClose = transport.onclose;
2855
2827
  transport.onclose = () => {
2856
2828
  closed = true;
2857
- _optionalChain([onClose, 'optionalCall', _72 => _72()]);
2829
+ _optionalChain([onClose, 'optionalCall', _74 => _74()]);
2858
2830
  this.#removeSession(session);
2859
- _optionalChain([originalOnClose, 'optionalCall', _73 => _73()]);
2831
+ _optionalChain([originalOnClose, 'optionalCall', _75 => _75()]);
2860
2832
  };
2861
2833
  await session.connect(transport);
2862
2834
  if (closed) {
@@ -2883,7 +2855,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2883
2855
  */
2884
2856
  #createInsufficientScopeResponse(challenge, id) {
2885
2857
  const oauth = this.#options.oauth;
2886
- const resource = _optionalChain([oauth, 'optionalAccess', _74 => _74.enabled]) ? _optionalChain([oauth, 'access', _75 => _75.protectedResource, 'optionalAccess', _76 => _76.resource]) : void 0;
2858
+ const resource = _optionalChain([oauth, 'optionalAccess', _76 => _76.enabled]) ? _optionalChain([oauth, 'access', _77 => _77.protectedResource, 'optionalAccess', _78 => _78.resource]) : void 0;
2887
2859
  const wwwAuthenticateParts = [
2888
2860
  'error="insufficient_scope"',
2889
2861
  `scope="${challenge.scopes.filter((scope) => SCOPE_TOKEN.test(scope)).join(" ")}"`
@@ -2969,7 +2941,7 @@ var FastMCP = class extends FastMCPEventEmitter {
2969
2941
  */
2970
2942
  #createUnauthorizedResponse(message) {
2971
2943
  const oauth = this.#options.oauth;
2972
- const resource = _optionalChain([oauth, 'optionalAccess', _77 => _77.enabled]) ? _optionalChain([oauth, 'access', _78 => _78.protectedResource, 'optionalAccess', _79 => _79.resource]) : void 0;
2944
+ const resource = _optionalChain([oauth, 'optionalAccess', _79 => _79.enabled]) ? _optionalChain([oauth, 'access', _80 => _80.protectedResource, 'optionalAccess', _81 => _81.resource]) : void 0;
2973
2945
  const wwwAuthenticateParts = [
2974
2946
  'error="invalid_token"',
2975
2947
  `error_description="${message.replace(/"/g, '\\"')}"`
@@ -3108,7 +3080,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3108
3080
  }
3109
3081
  }
3110
3082
  const oauthConfig = this.#options.oauth;
3111
- if (_optionalChain([oauthConfig, 'optionalAccess', _80 => _80.enabled]) && req.method === "GET") {
3083
+ if (_optionalChain([oauthConfig, 'optionalAccess', _82 => _82.enabled]) && req.method === "GET") {
3112
3084
  const url2 = new URL(req.url || "", `http://${host}`);
3113
3085
  const authorizationServerMetadataPath = joinPaths(
3114
3086
  "",
@@ -3142,8 +3114,8 @@ var FastMCP = class extends FastMCPEventEmitter {
3142
3114
  }
3143
3115
  }
3144
3116
  }
3145
- const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _81 => _81.proxy]);
3146
- if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _82 => _82.enabled])) {
3117
+ const oauthProxy = _optionalChain([oauthConfig, 'optionalAccess', _83 => _83.proxy]);
3118
+ if (oauthProxy && _optionalChain([oauthConfig, 'optionalAccess', _84 => _84.enabled])) {
3147
3119
  const url2 = new URL(req.url || "", `http://${host}`);
3148
3120
  const oauthPath = basePathRelativePath;
3149
3121
  try {
@@ -3196,7 +3168,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3196
3168
  const statusCode = error.statusCode || 400;
3197
3169
  res.writeHead(statusCode, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(
3198
3170
  JSON.stringify(
3199
- _optionalChain([error, 'access', _83 => _83.toJSON, 'optionalCall', _84 => _84()]) || {
3171
+ _optionalChain([error, 'access', _85 => _85.toJSON, 'optionalCall', _86 => _86()]) || {
3200
3172
  error: "invalid_request"
3201
3173
  }
3202
3174
  )
@@ -3221,7 +3193,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3221
3193
  } catch (error) {
3222
3194
  res.writeHead(400, { "Content-Type": "application/json" }).end(
3223
3195
  JSON.stringify(
3224
- _optionalChain([error, 'access', _85 => _85.toJSON, 'optionalCall', _86 => _86()]) || {
3196
+ _optionalChain([error, 'access', _87 => _87.toJSON, 'optionalCall', _88 => _88()]) || {
3225
3197
  error: "invalid_request"
3226
3198
  }
3227
3199
  )
@@ -3239,7 +3211,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3239
3211
  } catch (error) {
3240
3212
  res.writeHead(400, { "Content-Type": "application/json" }).end(
3241
3213
  JSON.stringify(
3242
- _optionalChain([error, 'access', _87 => _87.toJSON, 'optionalCall', _88 => _88()]) || {
3214
+ _optionalChain([error, 'access', _89 => _89.toJSON, 'optionalCall', _90 => _90()]) || {
3243
3215
  error: "server_error"
3244
3216
  }
3245
3217
  )
@@ -3303,7 +3275,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3303
3275
  } catch (error) {
3304
3276
  res.writeHead(400, { "Content-Type": "application/json" }).end(
3305
3277
  JSON.stringify(
3306
- _optionalChain([error, 'access', _89 => _89.toJSON, 'optionalCall', _90 => _90()]) || {
3278
+ _optionalChain([error, 'access', _91 => _91.toJSON, 'optionalCall', _92 => _92()]) || {
3307
3279
  error: "server_error"
3308
3280
  }
3309
3281
  )
@@ -3418,7 +3390,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3418
3390
  }
3419
3391
  res.writeHead(200, OAUTH_CREDENTIAL_RESPONSE_HEADERS).end(JSON.stringify(response));
3420
3392
  } catch (error) {
3421
- const body = _optionalChain([error, 'access', _91 => _91.toJSON, 'optionalCall', _92 => _92()]) || {
3393
+ const body = _optionalChain([error, 'access', _93 => _93.toJSON, 'optionalCall', _94 => _94()]) || {
3422
3394
  error: "invalid_request"
3423
3395
  };
3424
3396
  if (body.error === "invalid_client") {
@@ -3448,7 +3420,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3448
3420
  * regardless (RFC 7235), so no config is needed just to get the header.
3449
3421
  */
3450
3422
  #httpStreamOAuthConfig() {
3451
- 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;
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;
3452
3424
  if (!resource) {
3453
3425
  return {};
3454
3426
  }
@@ -3588,25 +3560,25 @@ var FastMCP = class extends FastMCPEventEmitter {
3588
3560
  const envBasePath = process.env.FASTMCP_BASE_PATH;
3589
3561
  const envStateless = process.env.FASTMCP_STATELESS;
3590
3562
  const envHost = process.env.FASTMCP_HOST;
3591
- const transportType = _optionalChain([overrides, 'optionalAccess', _100 => _100.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
3563
+ const transportType = _optionalChain([overrides, 'optionalAccess', _102 => _102.transportType]) || parseTransportSetting(transportArg, "--transport") || parseTransportSetting(envTransport, "FASTMCP_TRANSPORT") || "stdio";
3592
3564
  if (transportType === "httpStream") {
3593
3565
  const port = parseInt(
3594
- _optionalChain([overrides, 'optionalAccess', _101 => _101.httpStream, 'optionalAccess', _102 => _102.port, 'optionalAccess', _103 => _103.toString, 'call', _104 => _104()]) || portArg || envPort || "8080"
3566
+ _optionalChain([overrides, 'optionalAccess', _103 => _103.httpStream, 'optionalAccess', _104 => _104.port, 'optionalAccess', _105 => _105.toString, 'call', _106 => _106()]) || portArg || envPort || "8080"
3595
3567
  );
3596
- const host = _optionalChain([overrides, 'optionalAccess', _105 => _105.httpStream, 'optionalAccess', _106 => _106.host]) || hostArg || envHost || "localhost";
3597
- const endpoint = _optionalChain([overrides, 'optionalAccess', _107 => _107.httpStream, 'optionalAccess', _108 => _108.endpoint]) || endpointArg || envEndpoint || "/mcp";
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";
3598
3570
  const basePath = normalizeBasePath(
3599
- _optionalChain([overrides, 'optionalAccess', _109 => _109.httpStream, 'optionalAccess', _110 => _110.basePath]) || basePathArg || envBasePath
3571
+ _optionalChain([overrides, 'optionalAccess', _111 => _111.httpStream, 'optionalAccess', _112 => _112.basePath]) || basePathArg || envBasePath
3600
3572
  );
3601
- const enableJsonResponse = _optionalChain([overrides, 'optionalAccess', _111 => _111.httpStream, 'optionalAccess', _112 => _112.enableJsonResponse]) || false;
3602
- const stateless = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([overrides, 'optionalAccess', _113 => _113.httpStream, 'optionalAccess', _114 => _114.stateless]), () => ( // A bare `--stateless` means `--stateless true`.
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`.
3603
3575
  (statelessArg === "" ? true : parseBooleanSetting(statelessArg, "--stateless")))), () => ( parseBooleanSetting(envStateless, "FASTMCP_STATELESS"))), () => ( false));
3604
- const cors = _optionalChain([overrides, 'optionalAccess', _115 => _115.httpStream, 'optionalAccess', _116 => _116.cors]);
3605
- const eventStore = _optionalChain([overrides, 'optionalAccess', _117 => _117.httpStream, 'optionalAccess', _118 => _118.eventStore]);
3606
- const sseEndpoint = _optionalChain([overrides, 'optionalAccess', _119 => _119.httpStream, 'optionalAccess', _120 => _120.sseEndpoint]);
3607
- const sslCa = _optionalChain([overrides, 'optionalAccess', _121 => _121.httpStream, 'optionalAccess', _122 => _122.sslCa]);
3608
- const sslCert = _optionalChain([overrides, 'optionalAccess', _123 => _123.httpStream, 'optionalAccess', _124 => _124.sslCert]);
3609
- const sslKey = _optionalChain([overrides, 'optionalAccess', _125 => _125.httpStream, 'optionalAccess', _126 => _126.sslKey]);
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]);
3610
3582
  return {
3611
3583
  httpStream: {
3612
3584
  basePath,
@@ -3631,7 +3603,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3631
3603
  * Notifies all sessions that the prompts list has changed.
3632
3604
  */
3633
3605
  #promptsListChanged(prompts) {
3634
- for (const session of this.#sessions) {
3606
+ for (const session of [...this.#sessions]) {
3635
3607
  session.promptsListChanged(prompts);
3636
3608
  }
3637
3609
  }
@@ -3669,7 +3641,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3669
3641
  * Notifies all sessions that the resources list has changed.
3670
3642
  */
3671
3643
  #resourcesListChanged(resources) {
3672
- for (const session of this.#sessions) {
3644
+ for (const session of [...this.#sessions]) {
3673
3645
  session.resourcesListChanged(resources);
3674
3646
  }
3675
3647
  }
@@ -3677,7 +3649,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3677
3649
  * Notifies all sessions that the resource templates list has changed.
3678
3650
  */
3679
3651
  #resourceTemplatesListChanged(templates) {
3680
- for (const session of this.#sessions) {
3652
+ for (const session of [...this.#sessions]) {
3681
3653
  session.resourceTemplatesListChanged(templates);
3682
3654
  }
3683
3655
  }
@@ -3685,7 +3657,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3685
3657
  * Notifies all sessions that the tools list has changed.
3686
3658
  */
3687
3659
  #toolsListChanged(tools) {
3688
- for (const session of this.#sessions) {
3660
+ for (const session of [...this.#sessions]) {
3689
3661
  session.toolsListChanged(tools);
3690
3662
  }
3691
3663
  }
@@ -3698,7 +3670,7 @@ var FastMCP = class extends FastMCPEventEmitter {
3698
3670
  */
3699
3671
  #useEndpointAsResource(endpoint) {
3700
3672
  const oauth = this.#options.oauth;
3701
- if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _127 => _127.protectedResource]))
3673
+ if (this.#providerResourceBase === void 0 || !_optionalChain([oauth, 'optionalAccess', _129 => _129.protectedResource]))
3702
3674
  return;
3703
3675
  this.#options = {
3704
3676
  ...this.#options,
@@ -3727,4 +3699,4 @@ var FastMCP = class extends FastMCPEventEmitter {
3727
3699
 
3728
3700
 
3729
3701
  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;
3730
- //# sourceMappingURL=chunk-DPJW5QEO.cjs.map
3702
+ //# sourceMappingURL=chunk-5EEESM57.cjs.map